当前位置: 首页>>代码示例>>C#>>正文


C# Cursors.AppStarting属性代码示例

本文整理汇总了C#中System.Windows.Forms.Cursors.AppStarting属性的典型用法代码示例。如果您正苦于以下问题:C# Cursors.AppStarting属性的具体用法?C# Cursors.AppStarting怎么用?C# Cursors.AppStarting使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在System.Windows.Forms.Cursors的用法示例。


在下文中一共展示了Cursors.AppStarting属性的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Cursors.AppStarting (All other cursor values)

//引入命名空间
using System;
using System.Drawing;
using System.Windows.Forms;
   
class MouseCursors: Form
{
     Cursor[] acursor = 
     { 
          Cursors.AppStarting, Cursors.Arrow,       Cursors.Cross,       
          Cursors.Default,     Cursors.Hand,        Cursors.Help,     
          Cursors.HSplit,      Cursors.IBeam,       Cursors.No,          
          Cursors.NoMove2D,    Cursors.NoMoveHoriz, Cursors.NoMoveVert,
          Cursors.PanEast,     Cursors.PanNE,       Cursors.PanNorth,    
          Cursors.PanNW,       Cursors.PanSE,       Cursors.PanSouth,
          Cursors.PanSW,       Cursors.PanWest,     Cursors.SizeAll,     
          Cursors.SizeNESW,    Cursors.SizeNS,      Cursors.SizeNWSE,
          Cursors.SizeWE,      Cursors.UpArrow,     Cursors.VSplit,      
          Cursors.WaitCursor
     };
     string[] astrCursor = 
     { 
          "AppStarting",       "Arrow",             "Cross",       
          "Default",           "Hand",              "Help",     
          "HSplit",            "IBeam",             "No",          
          "NoMove2D",          "NoMoveHoriz",       "NoMoveVert",
          "PanEast",           "PanNE",             "PanNorth",    
          "PanNW",             "PanSE",             "PanSouth",
          "PanSW",             "PanWest",           "SizeAll",     
          "SizeNESW",          "SizeNS",            "SizeNWSE",
          "SizeWE",            "UpArrow",           "VSplit",      
          "WaitCursor" 
     };
   
     public static void Main()
     {
          Application.Run(new MouseCursors());
     }
     public MouseCursors()
     {
          Text = "Mouse Cursors";
          ResizeRedraw = true;
     }
     protected override void OnMouseMove(MouseEventArgs mea)
     {
          int x = Math.Max(0, Math.Min(3, mea.X / (ClientSize.Width  / 4)));
          int y = Math.Max(0, Math.Min(6, mea.Y / (ClientSize.Height / 7)));
   
          Cursor.Current = acursor[4 * y + x];
     }
     protected override void OnPaint(PaintEventArgs pea)
     {
          Graphics     grfx   = pea.Graphics;
          Brush        brush  = new SolidBrush(ForeColor);
          Pen          pen    = new Pen(ForeColor);
          StringFormat strfmt = new StringFormat();
   
          strfmt.LineAlignment = strfmt.Alignment = StringAlignment.Center;
   
          for (int y = 0; y < 7; y++){
              for (int x = 0; x < 4; x++)
              {
                   Rectangle rect = Rectangle.FromLTRB(
                                             x      * ClientSize.Width  / 4,
                                             y      * ClientSize.Height / 7,
                                            (x + 1) * ClientSize.Width  / 4,
                                            (y + 1) * ClientSize.Height / 7);
       
                   grfx.DrawRectangle(pen, rect);
                   grfx.DrawString(astrCursor[4 * y + x], 
                                   Font, brush, rect, strfmt);
              }
          }    
     }
}
开发者ID:C#程序员,项目名称:System.Windows.Forms,代码行数:75,代码来源:Cursors.AppStarting


注:本文中的System.Windows.Forms.Cursors.AppStarting属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。