Compartilhar via


InkPicture.InkEnabled Property

InkPicture.InkEnabled Property

Gets or sets a value that specifies whether the InkPicture control collects pen input.

Definition

Visual Basic .NET Public Property InkEnabled As Boolean
C# public bool InkEnabled { get; set; }
Managed C++ public: __property bool* get_InkEnabled();
public: __property void set_InkEnabled(bool*);

Property Value

System.Boolean. Whether or not the InkPicture control collects pen input.

This property is read/write.

true Default. The InkPicture control collects pen input.
false The InkPicture control does not report pen input. No pen-related events fire.

Exceptions

COMException Leave Site:
ObjectDisposedException Leave Site:

Remarks

In addition to ink, pen input may include in-air packets, cursor in range events, and so on.

The InkPicture control collects ink in Microsoft® Windows® XP Tablet PC Edition or any edition of Windows 2000, Windows Server 2003, or Windows XP on which the Windows XP Tablet PC Edition SDK is installed. However, handwriting recognition occurs only if you use Windows XP Tablet PC Edition. In any edition of Windows 2000, Windows Server 2003, or of Windows XP other than Windows XP Tablet PC Edition, the InkEnabled property is always false if the Windows XP Tablet PC Edition SDK is not installed.

If the window input rectangle of an enabled InkCollector or InkOverlay (set in the constructor or with the SetWindowInputRectangle method) overlaps the window input rectangle of an InkPicture, a COMException Leave Site exception is thrown.

Note: Overlap can occur without an error as long as only one of the input rectangles is enabled at anytime.

While a control is not enabled, you receive no events.

When you set the Enabled property of a container control to false, all of its contained controls are disabled as well.

You cannot set the InkEnabled property to false while the control is collecting ink (CollectingInk property is true.).

The InkEnabled property must be set to false before setting or calling specific properties and methods of the control. If you try to change the specified properties or call the specified methods, an error occurs.

The following properties and methods cannot be set or called unless the InkEnabled property is first set to false:

You should set the InkEnabled property for an InkPicture control to false before you shut down an application.

Examples

[C#]

This C# example is an event handler for a button click event for a form on which two controls are defined, an InkPicture control, theInkPicture, and a Button Leave Site control, theButton. The event handler updates the InkEnabled property value based on the current state of the property. The event handler also updates the text of the button to reflect what the next click of the button will do.

// Event handler for the button's Click event.
private void theButton_Click(object sender, System.EventArgs e)
{
    // Enable or disable ink collection on the InkPicture control
    // and update the button text.
    if (theInkPicture.Enabled)
    {
        theInkPicture.Enabled = false;
        theButton.Text = "Enable ink collection";
    }
    else
    {
        theInkPicture.Enabled = true;
        theButton.Text = "Disable ink collection";
    }
}

[Visual Basic .NET]

This Microsoft Visual Basic® .NET example is an event handler for a button click event for a form on which two controls are defined, an InkPicture control, theInkPicture, and a Button Leave Site control, theButton. The event handler updates the InkEnabled property value based on the current state of the property. The event handler also updates the text of the button to reflect what the next click of the button will do.

' Event handler for the button's Click event.
Private Sub theButton_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles theButton.Click

    ' Enable or disable ink collection on the InkPicture control
    ' and update the button text.
    If (theInkPicture.Enabled) Then
        theInkPicture.Enabled = False
        theButton.Text = "Enable ink collection"
    Else
        theInkPicture.Enabled = True
        theButton.Text = "Disable ink collection"
    End If
End Sub

See Also