How to get cursor size in C #

I need to get the rectangle size of a classic window.

How can I get the cursor size in C #?

+5
source share
3 answers

You can use Cursor.Size :

int cursorWidth = Cursor.Size.Width;
int cursorHeight = Cursor.Size.Height;

Yes, it really is that simple!

Hope this helps!

+9
source

A small example: Link

       if(this.Cursor != Cursors.Hand & 
         Cursor.Current == Cursors.Default)
       {
          // Draw the cursor stretched.
          Graphics graphics = this.CreateGraphics();
          Rectangle rectangle = new Rectangle(
            new Point(10,10), new Size(cursor.Size.Width * 2, 
            cursor.Size.Height * 2));
          cursor.DrawStretched(graphics, rectangle);


      // Draw the cursor in normal size.
      rectangle.Location = new Point(
      rectangle.Width + rectangle.Location.X, 
        rectangle.Height + rectangle.Location.Y);
      rectangle.Size = cursor.Size;
      cursor.Draw(graphics, rectangle);

      // Dispose of the cursor.
      cursor.Dispose();
   }
+2
source

All Articles