Class Cursor
Represents a mouse cursor, optionally loaded from a .cur or .ico file. The hotspot is extracted from CUR directory entries; ICO files default to (0, 0).
Implements
Inherited Members
Namespace: DRIT.Drawing.Imaging
Assembly: DRIT.Drawing.dll
Syntax
public sealed class Cursor : IDisposable
Constructors
Cursor(Stream)
Initializes a new Cursor from the specified stream.
Declaration
public Cursor(Stream stream)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | stream | The stream containing cursor data. |
Cursor(string)
Initializes a new Cursor from the specified file.
Declaration
public Cursor(string fileName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | fileName | The path to the cursor file (.cur or .ico). |
Properties
Current
Returns a default 1×1 transparent cursor. Setting the cursor is a no-op in the pure-managed implementation.
Declaration
public static Cursor Current { get; set; }
Property Value
| Type | Description |
|---|---|
| Cursor |
HotSpot
Gets the hotspot point of the cursor.
Declaration
public Point HotSpot { get; }
Property Value
| Type | Description |
|---|---|
| Point |
Size
Gets the size of the cursor.
Declaration
public Size Size { get; }
Property Value
| Type | Description |
|---|---|
| Size |
Methods
Dispose()
Releases all resources used by this Cursor.
Declaration
public void Dispose()
Draw(Graphics, Rectangle)
Draws the cursor image into targetRect.
Declaration
public void Draw(Graphics g, Rectangle targetRect)
Parameters
| Type | Name | Description |
|---|---|---|
| Graphics | g | |
| Rectangle | targetRect |
DrawStretched(Graphics, Rectangle)
Draws the cursor stretched to fill targetRect.
Declaration
public void DrawStretched(Graphics g, Rectangle targetRect)
Parameters
| Type | Name | Description |
|---|---|---|
| Graphics | g | |
| Rectangle | targetRect |