Name
Cursor
Synopsis
This class wraps a Win32 cursor—the image that represents the
mouse pointer. Cursor is a slightly curious class
in that it wraps up both GDI-like functionality and global system
cursor/pointer behavior.
Unlike Win32, .NET cursors are static images—you cannot create
them from animations. You can, however, create cursors from COM
IPicture objects, files and streams, and Win32
cursor handles. You can also retrieve a Win32 handle using the
Handle property, or get a copy of the underlying
Win32 object with the CopyHandle() method.
Predefined cursors are available as static properties on the
Cursors class.
Similar to most of the System.Drawing objects,
Cursor objects are a scarce system resource, and
therefore you should manage their lifetimes carefully, calling
Dispose() when you are finished to release the
resources back to the OS. Also in keeping with the drawing objects,
you can paint the cursor imagery on a
System.Drawing.Graphics surface using the
Draw( ) and DrawStretched()
methods. The object’s dimensions can be obtained
from the Size property.
Each Control object has a
Cursor property, which you can use to the set the
default cursor shown while the mouse is over the control. You can
also temporarily set the cursor to something else (such as the
Cursors.WaitCursor) by using the static
Current property. This overrides any other
settings until you either set the Current value
back to Cursors.Default or call the
DoEvents() method.
You can find the screen coordinates ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access