• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Forms.Cursor类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Windows.Forms.Cursor的典型用法代码示例。如果您正苦于以下问题:C# Cursor类的具体用法?C# Cursor怎么用?C# Cursor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Cursor类属于System.Windows.Forms命名空间,在下文中一共展示了Cursor类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Surface

        public Surface()
        {
            ScreenRectangle = CaptureHelpers.GetScreenBounds();
            ScreenRectangle0Based = CaptureHelpers.ScreenToClient(ScreenRectangle);

            InitializeComponent();

            using (MemoryStream cursorStream = new MemoryStream(Resources.Crosshair))
            {
                Cursor = new Cursor(cursorStream);
            }

            DrawableObjects = new List<DrawableObject>();
            Config = new SurfaceOptions();
            timerStart = new Stopwatch();
            timerFPS = new Stopwatch();

            borderPen = new Pen(Color.Black);
            borderDotPen = new Pen(Color.White);
            borderDotPen.DashPattern = new float[] { 5, 5 };
            nodeBackgroundBrush = new SolidBrush(Color.White);
            textFont = new Font("Verdana", 16, FontStyle.Bold);
            infoFont = new Font("Verdana", 9);
            textBackgroundBrush = new SolidBrush(Color.FromArgb(75, Color.Black));
            textBackgroundPenWhite = new Pen(Color.FromArgb(50, Color.White));
            textBackgroundPenBlack = new Pen(Color.FromArgb(150, Color.Black));
            markerPen = new Pen(Color.FromArgb(200, Color.Red)) { DashStyle = DashStyle.Dash };
        }
开发者ID:andre-d,项目名称:ShareXYZ,代码行数:28,代码来源:Surface.cs


示例2: RectangleTransparent

        public RectangleTransparent()
        {
            clearPen = new Pen(Color.FromArgb(1, 0, 0, 0));
            borderDotPen = new Pen(Color.Black, 1);
            borderDotPen2 = new Pen(Color.White, 1);
            borderDotPen2.DashPattern = new float[] { 5, 5 };
            penTimer = Stopwatch.StartNew();
            ScreenRectangle = CaptureHelpers.GetScreenBounds();

            surface = new Bitmap(ScreenRectangle.Width, ScreenRectangle.Height);
            gSurface = Graphics.FromImage(surface);
            gSurface.InterpolationMode = InterpolationMode.NearestNeighbor;
            gSurface.SmoothingMode = SmoothingMode.HighSpeed;
            gSurface.CompositingMode = CompositingMode.SourceCopy;
            gSurface.CompositingQuality = CompositingQuality.HighSpeed;
            gSurface.Clear(Color.FromArgb(1, 0, 0, 0));

            StartPosition = FormStartPosition.Manual;
            Bounds = ScreenRectangle;
            Text = "ShareX - " + Resources.RectangleTransparent_RectangleTransparent_Rectangle_capture_transparent;

            Shown += RectangleLight_Shown;
            KeyUp += RectangleLight_KeyUp;
            MouseDown += RectangleLight_MouseDown;
            MouseUp += RectangleLight_MouseUp;

            using (MemoryStream cursorStream = new MemoryStream(Resources.Crosshair))
            {
                Cursor = new Cursor(cursorStream);
            }

            timer = new Timer { Interval = 10 };
            timer.Tick += timer_Tick;
            timer.Start();
        }
开发者ID:KamilKZ,项目名称:ShareX,代码行数:35,代码来源:RectangleTransparent.cs


示例3: LoadCursorFromResource

 private static Cursor LoadCursorFromResource(string resourceName)
 {
     Cursor result;
     try
     {
         var tempFile = Path.GetTempFileName();
         using (Stream s =
             Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName))
         using (var resourceFile = new FileStream(tempFile, FileMode.Create))
         {
             if (s != null)
             {
                 var b = new byte[s.Length + 1];
                 s.Read(b, 0, Convert.ToInt32(s.Length));
                 resourceFile.Write(b, 0, Convert.ToInt32(b.Length - 1));
             }
             resourceFile.Flush();
         }
         result = new Cursor(NativeMethods.LoadCursorFromFile(tempFile));
         File.Delete(tempFile);
     }
     catch
     {
         result = Cursors.Cross;
     }
     return result;
 }
开发者ID:borisblizzard,项目名称:arcreator,代码行数:27,代码来源:CaptureForm.cs


示例4: OnInitial

 public void OnInitial(Controller controller,Cursor palmCursor,Form targetForm)
 {
     
     this.palmCursor = palmCursor;
     this.targetForm = targetForm;
     this.targetForm = targetForm;
 }
开发者ID:craigchang0728,项目名称:LeapMotion,代码行数:7,代码来源:LeapListener.cs


示例5: Crosshair

 /// <summary>
 /// Creates a new crosshair control.
 /// </summary>
 public Crosshair()
 {
     InitializeComponent();
     myImage = new Bitmap(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("ManagedWinapi.crosshair.ico"));
     myCursor = new Cursor(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("ManagedWinapi.crosshair.ico"));
     dragger.Image = myImage;
 }
开发者ID:floatas,项目名称:highsign,代码行数:10,代码来源:Crosshair.cs


示例6: OnDeactivate

        protected override void OnDeactivate()
        {
            base.OnDeactivate();

            if (this.pencilToolCursor != null)
            {
                this.pencilToolCursor.Dispose();
                this.pencilToolCursor = null;
            }

            if (mouseDown)
            {
                Point lastTracePoint = (Point)tracePoints[tracePoints.Count - 1];
                OnMouseUp(new MouseEventArgs(mouseButton, 0, lastTracePoint.X, lastTracePoint.Y, 0));
            }

            this.savedRects = null;
            this.tracePoints = null;
            this.bitmapLayer = null;

            if (this.renderArgs != null)
            {
                this.renderArgs.Dispose();
                this.renderArgs = null;
            }

            this.mouseDown = false;

            if (clipRegion != null)
            {
                clipRegion.Dispose();
                clipRegion = null;
            }
        }
开发者ID:metadeta96,项目名称:openpdn,代码行数:34,代码来源:PencilTool.cs


示例7: ToolEllipse

		public ToolEllipse()
		{
            System.IO.MemoryStream ms = new System.IO.MemoryStream(Genetibase.NuGenAnnotation.Properties.Resources.Ellipse);
            Cursor = new Cursor(ms);
            ms.Close();
			//Cursor = new Cursor(GetType(), "Ellipse.cur");
		}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:7,代码来源:ToolEllipse.cs


示例8: GetComponentImages

    /// <summary>
    /// Obtient les images et curseur associé à un composant.
    /// </summary>
    /// <param name="type">descripteur de type du composant</param>
    /// <param name="small">image bitmap 16x16 associée au composant (ou null)</param>
    /// <param name="large">image bitmap 32x32 associée au composant (ou null)</param>
    /// <param name="cursor">curseur de dépôt associé au composant (ou <see cref="Cursors.Cross"/>)</param>
    /// <returns>true si l'image du composant a pu être obtenue</returns>
    public static bool GetComponentImages(                                     // <wao spécif>
      Type type, out Image small, out Image large, out Cursor cursor ) {       // <wao spécif code.&body>

      // valeurs par défaut
      small = null;
      large = null;
      cursor = Cursors.Cross;

      // tenter de récupérer l'image du composant via l'attribut ToolboxBitmap
      object[] attrs = type.GetCustomAttributes( typeof( ToolboxBitmapAttribute ), false );
      if ( attrs.Length > 0 ) {
        small = (attrs[ 0 ] as ToolboxBitmapAttribute).GetImage( type, false );
        large = (attrs[ 0 ] as ToolboxBitmapAttribute).GetImage( type, true );
      }

      // tenter de récupérer l'image du composant via son nom par défaut
      if ( small == null ) {
        small = ToolboxBitmapAttribute.GetImageFromResource( type, type.Name + ".bmp", false );
        large = ToolboxBitmapAttribute.GetImageFromResource( type, type.Name + ".bmp", true  );
      }

      // aucune image trouvée
      if ( small == null ) return false;

      // composer le cross-cursor pour le dépôt
      cursor = CursorHelper.ImageToCrossCursor( small );
      return true;
    }
开发者ID:NicolasR,项目名称:Composants,代码行数:36,代码来源:CursorHelper.cs


示例9: ToolPolygon

		public ToolPolygon()
		{
            System.IO.MemoryStream ms = new System.IO.MemoryStream(Genetibase.NuGenAnnotation.Properties.Resources.Pencil);
            Cursor = new Cursor(ms);
            ms.Close();
			//Cursor = new Cursor(GetType(), "Pencil.cur");
		}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:7,代码来源:ToolPolygon.cs


示例10: RectangleAnnotateForm

        public RectangleAnnotateForm(RectangleAnnotateOptions options)
        {
            Options = options;

            backgroundImage = Screenshot.CaptureFullscreen();
            borderDotPen = new Pen(Color.Black, 1);
            borderDotPen2 = new Pen(Color.White, 1);
            borderDotPen2.DashPattern = new float[] { 5, 5 };
            textBackgroundBrush = new SolidBrush(Color.FromArgb(75, Color.Black));
            textBackgroundPenWhite = new Pen(Color.FromArgb(50, Color.White));
            textBackgroundPenBlack = new Pen(Color.FromArgb(150, Color.Black));
            infoFont = new Font("Verdana", 9);
            penTimer = Stopwatch.StartNew();
            ScreenRectangle = CaptureHelpers.GetScreenBounds();

            InitializeComponent();
            Icon = ShareXResources.Icon;

            using (MemoryStream cursorStream = new MemoryStream(Resources.Crosshair))
            {
                Cursor = new Cursor(cursorStream);
            }

            timer = new Timer { Interval = 10 };
            timer.Tick += timer_Tick;
            timer.Start();
        }
开发者ID:yuhongfang,项目名称:ShareX,代码行数:27,代码来源:RectangleAnnotateForm.cs


示例11: MagnifierTool

        /// <summary>
        /// Creates an instance of this class
        /// </summary>
        public MagnifierTool(MapBox parentMapBox) 
            : base("Magnifier", "A tool to magnify the portion of the map below the cursor")
        {
            _parentMapBox = parentMapBox;
            _parentMapBox.MapChanged += HandleMapChanged;
            Map = _parentMapBox.Map;

            MagnificationFactor = 1.10;

            Offset = new Size(5,5);

            _magnified = new PictureBox();
            _magnified.Size = new Size(75, 75);
            _magnified.BorderStyle = BorderStyle.FixedSingle;
            _magnified.Visible = false;

            _parentMapBox.Controls.Add(_magnified);

            Map = _parentMapBox.Map;
            _map = Map.Clone();
            _map.Size = _magnified.Size;
            _map.Zoom = _map.Size.Width*(Map.Envelope.Width/Map.Size.Width) / _magnification;
            _map.Center = _map.Center;
            _magnified.Image = _map.GetMap();

            Enabled = true;

            var ms = Assembly.GetExecutingAssembly().GetManifestResourceStream("WinFormSamples.Magnifier.cur");
            if (ms != null)
                Cursor = new Cursor(ms);
        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:34,代码来源:MagnifierTool.cs


示例12: GutterMargin

		static GutterMargin()
		{
			Stream cursorStream = Assembly.GetCallingAssembly().GetManifestResourceStream("GodLesZ.eAthenaEditor.Library.Resources.RightArrow.cur");
			if (cursorStream == null) throw new Exception("could not find cursor resource");
			RightLeftCursor = new Cursor(cursorStream);
			cursorStream.Close();
		}
开发者ID:GodLesZ,项目名称:svn-dump,代码行数:7,代码来源:GutterMargin.cs


示例13: ViewportControl

 public ViewportControl()
 {
     this.InitializeComponent();
     this.BackColor = SystemColors.AppWorkspace;
     base.MouseWheel += new MouseEventHandler(this.ViewportControl_MouseWheel);
     this.m_invisibleCursor = new Cursor(new MemoryStream(Resources.invisible_cursor));
 }
开发者ID:Azerothian,项目名称:fc3editor,代码行数:7,代码来源:ViewportControl.cs


示例14: MeasureDisTool

        public MeasureDisTool(IHookHelper m_hookHelper0)
        {
            if (m_hookHelper0 != null)
            {
                m_hookHelper = m_hookHelper0;
            }
            else
            {
                return;
            }
            //
            // TODO: Define values for the public properties
            //
            base.m_category = ""; //localizable text
            base.m_caption = "measure";  //localizable text
            base.m_message = "This should work in ArcMap/MapControl/PageLayoutControl";  //localizable text
            base.m_toolTip = "量测";  //localizable text
            base.m_name = "measure";   //unique id, non-localizable (e.g. "MyCategory_MyTool")
            //frm = new FrmMeasure(m_hookHelper);
            m_Cursor = System.Windows.Forms.Cursors.Cross;

            try
            {
                //
                // TODO: change resource name if necessary
                //
                string bitmapResourceName = GetType().Name + ".bmp";
                base.m_bitmap = new Bitmap(GetType(), bitmapResourceName);
                base.m_cursor = new System.Windows.Forms.Cursor(GetType(), GetType().Name + ".cur");
            }
            catch (Exception ex)
            {
                System.Diagnostics.Trace.WriteLine(ex.Message, "Invalid Bitmap");
            }
        }
开发者ID:lovelll,项目名称:DQHP,代码行数:35,代码来源:MeasureDisTool.cs


示例15: Drawing

 static Drawing()
 {
     m_drawLineCursor = LoadCursor(Resources.DrawLineCursor);
       m_drawLineInvertedCursor = LoadCursor(Resources.DrawLineInvertedCursor);
       m_moveLineCursor = LoadCursor(Resources.MoveLineCursor);
       m_moveLineInvertedCursor = LoadCursor(Resources.MoveLineInvertedCursor);
 }
开发者ID:taradinoc,项目名称:trizbort,代码行数:7,代码来源:Drawing.cs


示例16: Form1

        public Form1()
        {
            InitializeComponent();

            _cursorDefault = Cursor.Current;
            _cursorFinder = EmbeddedResources.LoadCursor(EmbeddedResources.Finder);
            _finderHome = EmbeddedResources.LoadImage(EmbeddedResources.FinderHome);
            _finderGone = EmbeddedResources.LoadImage(EmbeddedResources.FinderGone);

            pictureBox1.Image = _finderHome;
            pictureBox1.MouseDown += new MouseEventHandler(OnFinderToolMouseDown);
            button_ok.Click += new EventHandler(OnButtonOKClicked);
            button_cancel.Click += new EventHandler(OnButtonCancelClicked);
            textBox_play.KeyDown += new KeyEventHandler(textBox_play_KeyDown);
            textBox_stop.KeyDown += new KeyEventHandler(textBox_stop_KeyDown);
            textBox_full.KeyDown += new KeyEventHandler(textBox_full_KeyDown);
            textBox_mute.KeyDown += new KeyEventHandler(textBox_mute_KeyDown);
            textBox_fwd.KeyDown += new KeyEventHandler(textBox_fwd_KeyDown);
            textBox_bwd.KeyDown += new KeyEventHandler(textBox_bwd_KeyDown);
            textBox_vup.KeyDown += new KeyEventHandler(textBox_vup_KeyDown);
            textBox_vdown.KeyDown += new KeyEventHandler(textBox_vdown_KeyDown);
            textBox_class_name.TextChanged += new EventHandler(OnTextBoxHandleTextChanged);

            this.AcceptButton = button_ok;
            this.CancelButton = button_cancel;
        
        }
开发者ID:dtx,项目名称:KMPC,代码行数:27,代码来源:Form1.cs


示例17: MouseEnter

 public void MouseEnter(MouseEventArgs e)
 {
     previousColor = this.Shape.ShapeColor;
         this.Shape.ShapeColor = Color.GreenYellow;
         previousCursor = Cursor.Current;
         this.Shape.Model.RaiseOnCursorChange(Cursors.Hand);
 }
开发者ID:Tom-Hoinacki,项目名称:OO-CASE-Tool,代码行数:7,代码来源:ClickableIconMaterial.cs


示例18: MouseArea

 // Methods
 public MouseArea()
 {
     this.components = null;
     this.picturePanel = null;
     this.startPoint = PointF.Empty;
     this.defaultCursor = Cursors.Default;
     this.shiftDown = false;
     //			this.filename = string.Empty;
     //			this.selectPath = new GraphicsPath();
     this.graphCenterPoint = PointF.Empty;
     this.currentOperation = ToolOperation.None;
     //			this.undostack = new UndoStack();
     this.oldPoint = Point.Empty;
     this.hori = false;
     this.oldindex = 0;
     this.mousedown = false;
     this.win32 = new Win32();
     this.lineOperation = null;
     this.SelectOperation = null;
     this.DrawOperation = null;
     this.ViewOperation = null;
     this.ColorOperation = null;
     this.BezierOperation = null;
     this.IsDrawing = false;
     this.TextOperation = null;
     this.editingOperation = null;
     this.polyOperation = null;
     this.FlipOperation = null;
     this.SubOperation = null;
     this.InitializeComponent();
     base.SetStyle(ControlStyles.DoubleBuffer | (ControlStyles.AllPaintingInWmPaint | (ControlStyles.SupportsTransparentBackColor | (ControlStyles.Selectable | ControlStyles.UserPaint))), true);
     this.CreateMenus();
 }
开发者ID:EdgarEDT,项目名称:myitoppsp,代码行数:34,代码来源:MouseArea.cs


示例19: AddCursor

 public void AddCursor(object key, string resourcename)
 {
     string name = "Resources." + resourcename;
     Type type = GetType();
     Cursor cursor = new Cursor(GetType(), name);
     m_map[key] = cursor;
 }
开发者ID:jjacksons,项目名称:GLUE,代码行数:7,代码来源:CursorCollection.cs


示例20: GutterMargin

		static GutterMargin()
		{
            Stream cursorStream = Assembly.GetCallingAssembly().GetManifestResourceStream("SAF.Framework.Controls.TextEditor.Resources.RightArrow.cur");
			if (cursorStream == null) throw new Exception("could not find cursor resource");
			RightLeftCursor = new Cursor(cursorStream);
			cursorStream.Close();
		}
开发者ID:JodenSoft,项目名称:JodenSoft,代码行数:7,代码来源:GutterMargin.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Forms.DataGrid类代码示例发布时间:2022-05-26
下一篇:
C# Forms.CurrencyManager类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap