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


C# Forms.Cursor类代码示例

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


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


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