Compartilhar via


InkPicture.Cursor Property

InkPicture.Cursor Property

Gets or sets the cursor that appears when the mouse pointer is over the InkPicture control.

Definition

Visual Basic .NET Overrides Public Property Cursor As Cursor
C# public override Cursor Cursor { get; set; }
Managed C++ public: __property virtual Cursor* get_Cursor();
public: __property virtual void set_Cursor(Cursor*);

Property Value

System.Windows.Forms.Cursor. The cursor that appears when the mouse pointer is over the InkPicture control.

This property is read/write. This property has no default value.

Exceptions

COMException Leave Site:
ObjectDisposedException Leave Site:

Remarks

If set to the default cursor, the inherited Default Leave Site property, the behavior of the mouse cursor is based on the drawing attributes of the current cursor in view. If you then disable the object while keeping the default cursor setting, the cursor override is disabled and the mouse cursor setting is based on the underlying window's mouse cursor attributes. Setting the cursor to null (Nothing in Microsoft® Visual Basic® .NET) also disables the object's cursor handling.

If the cursor is set to anything but the default setting, the object always uses that cursor whether or not the object is enabled.

This property refers to the visual display of the pointer, and not the ink input device, which is represented by the Microsoft.Ink.Cursor class.

Examples

[C#]

This C# example creates an InkPicture control, for which the InkEnabled property is linked to a button's click event, InkEnableToggle_Click. The InkEnableToggle_Click event assigns a Cursor Leave Site such that when theInkPicture.InkEnabled is true, the Default Leave Site cursor is used, but when theInkPicture.InkEnabled is false, a cross is used as the cursor.

using Microsoft.Ink;
//. . .

private void InkEnableToggle_Click(object sender, System.EventArgs e)
{
    if (theInkPicture.InkEnabled == false)
    {
        theInkPicture.InkEnabled = true;
        theInkPicture.Cursor = System.Windows.Forms.Cursors.Default;
    }
    else
    {
        theInkPicture.InkEnabled = false;
        theInkPicture.Cursor = System.Windows.Forms.Cursors.Cross;
    }
}

[VB.NET]

This Visual Basic .NET example creates an InkPicture control, for which the InkEnabled property is linked to a button's click event, InkEnableToggle_Click. The InkEnableToggle_Click event assigns a Cursor Leave Site such that when theInkPicture.InkEnabled is true, the Default Leave Site cursor is used, but when theInkPicture.InkEnabled is false, a cross is used as the cursor.

Imports Microsoft.Ink
'. . .

Private Sub InkEnableToggle_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles InkEnableToggle.Click
    If theInkPicture.InkEnabled = False Then
        theInkPicture.InkEnabled = True
        theInkPicture.Cursor = System.Windows.Forms.Cursors.Default
    Else
        theInkPicture.InkEnabled = False
        theInkPicture.Cursor = System.Windows.Forms.Cursors.Cross
    End If

End Sub

See Also