Partager via


InkPicture.EditingMode Property

InkPicture.EditingMode Property

Gets or sets a value that indicates whether the InkPicture is in ink mode, delete mode, or select/edit mode.

Definition

Visual Basic .NET Public Property EditingMode As InkOverlayEditingMode
C# public InkOverlayEditingMode EditingMode { get; set; }
Managed C++ public: __property InkOverlayEditingMode* get_EditingMode();
public: __property void set_EditingMode(InkOverlayEditingMode*);

Property Value

Microsoft.Ink.InkOverlayEditingMode. Whether the InkPicture is in ink mode, deletion mode, or selection/editing mode.

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

Ink0 Specifies the object or control is in collection mode.
Delete1 Specifies the object or control is in deletion mode.
Select2 Specifies the object or control is in selection and editing mode.

Exceptions

COMException Leave Site:
ObjectDisposedException Leave Site:

Remarks

An error is generated if you change the EditingMode property while ink is being collected. To avoid this conflict, make sure the CollectingInk property is false before changing the EditingMode property.

For more information about erasing ink, see Erasing Ink with the Pen.

Examples

[C#]

This C# example shows functions that are called when menu items are clicked in order to change the editing mode of an InkPicture, theInkPicture.

private void menuItemInk_Click(object sender, System.EventArgs e)
{
    if (!theInkPicture.CollectingInk)
    {
        theInkPicture.EditingMode = InkOverlayEditingMode.Ink;
        menuItemInk.Checked = true;
        menuItemDelete.Checked = false;
        menuItemSelect.Checked = false;
    }
    else
    {
        // Unlikely to happen, but check anyway
        MessageBox.Show("Cannot change modes while collecting ink");
    }
}

private void menuItemDelete_Click(object sender, System.EventArgs e)
{
    if (!theInkPicture.CollectingInk)
    {
        theInkPicture.EditingMode = InkOverlayEditingMode.Delete;
        menuItemInk.Checked = false;
        menuItemDelete.Checked = true;
        menuItemSelect.Checked = false;
    }
    else
    {
        // Unlikely to happen, but check anyway
        MessageBox.Show("Cannot change modes while collecting ink");
    }
}

private void menuItemSelect_Click(object sender, System.EventArgs e)
{
    if (!theInkPicture.CollectingInk)
    {
        theInkPicture.EditingMode = InkOverlayEditingMode.Select;
        menuItemInk.Checked = false;
        menuItemDelete.Checked = false;
        menuItemSelect.Checked = true;
    }
    else
    {
        // Unlikely to happen, but check anyway
        MessageBox.Show("Cannot change modes while collecting ink");
    }
}

[VB.NET]

This Microsoft® Visual Basic® .NET example shows functions that are called when menu items are clicked in order to change the editing mode of an InkPicture, theInkPicture.

Imports Microsoft.Ink
'...
Private Sub MenuItemInk_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles MenuItemInk.Click
    If theInkPicture.CollectingInk = False Then
        theInkPicture.EditingMode = InkOverlayEditingMode.Ink
        MenuItemInk.Checked = True
        MenuItemDelete.Checked = False
        MenuItemSelect.Checked = False
    Else
        'Unlikely to happen, but check anyway
        MessageBox.Show("Cannot change modes while collecting ink")
    End If
End Sub

Private Sub MenuItemDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles MenuItemDelete.Click
    If theInkPicture.CollectingInk = False Then
        theInkPicture.EditingMode = InkOverlayEditingMode.Delete
        MenuItemInk.Checked = False
        MenuItemDelete.Checked = True
        MenuItemSelect.Checked = False
    Else
        'Unlikely to happen, but check anyway
        MessageBox.Show("Cannot change modes while collecting ink")
    End If
End Sub

Private Sub MenuItemSelect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles MenuItemSelect.Click
    If theInkPicture.CollectingInk = False Then
        theInkPicture.EditingMode = InkOverlayEditingMode.Select
        MenuItemInk.Checked = False
        MenuItemDelete.Checked = False
        MenuItemSelect.Checked = True
    Else
        'Unlikely to happen, but check anyway
        MessageBox.Show("Cannot change modes while collecting ink")
    End If
End Sub

See Also