InkOverlay.EditingMode Property

Gets or sets a value that indicates whether the InkOverlay is in ink mode, deletion mode, or selecting/editing mode.

Namespace:  Microsoft.Ink
Assembly:  Microsoft.Ink (in Microsoft.Ink.dll)

Syntax

'Declaration
<BrowsableAttribute(True)> _
Public Property EditingMode As InkOverlayEditingMode
'Usage
Dim instance As InkOverlay 
Dim value As InkOverlayEditingMode 

value = instance.EditingMode

instance.EditingMode = value
[BrowsableAttribute(true)]
public InkOverlayEditingMode EditingMode { get; set; }
[BrowsableAttribute(true)]
public:
property InkOverlayEditingMode EditingMode {
    InkOverlayEditingMode get ();
    void set (InkOverlayEditingMode value);
}
public function get EditingMode () : InkOverlayEditingMode 
public function set EditingMode (value : InkOverlayEditingMode)

Property Value

Type: Microsoft.Ink.InkOverlayEditingMode
One of the InkOverlayEditingMode values indicating whether the InkOverlay is in ink mode, delete mode, or select/edit mode.

Remarks

An exception is raised 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

This example shows an event handler for a ListBox control that changes the EditingMode property for an InkOverlay object.

The EditingMode property cannot be changed while the object is collecting ink. Because ink collection is handled on a separate thread from your application code, the CollectingInk property can change to true while your application code is operating under the assumption that it is still false. To handle this contingency, access to the EditingMode property should be contained within a try-catch block.

' SelectedIndexChanged event handler for a list box with 3 mode choices: 
'  Ink     (index:0) 
'  Erase   (index:1) 
'  Select  (index:2) 
Private Sub listBoxEditMode_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)
    Try 

        ' mInkObject can be InkOverlay or InkPicture 
        If Not mInkObject.CollectingInk Then 
            Select Case DirectCast(sender, ListBox).SelectedIndex
                Case 0
                    mInkObject.EditingMode = InkOverlayEditingMode.Ink
                Case 1
                    mInkObject.EditingMode = InkOverlayEditingMode.Delete
                Case 2
                    mInkObject.EditingMode = InkOverlayEditingMode.Select 
            End Select 
        End If 

    Catch 
        ' handle or rethrow 
    End Try 
End Sub
// SelectedIndexChanged event handler for a list box with 3 mode choices: 
//  Ink     (index:0) 
//  Erase   (index:1) 
//  Select  (index:2) 
private void listBoxEditMode_SelectedIndexChanged(object sender, EventArgs e)
{
    try
    {
        // mInkObject can be InkOverlay or InkPicture 
        if (!mInkObject.CollectingInk)
        {
            switch (((ListBox)sender).SelectedIndex)
            {
                case 0:
                    mInkObject.EditingMode = InkOverlayEditingMode.Ink;
                    break;
                case 1:
                    mInkObject.EditingMode = InkOverlayEditingMode.Delete;
                    break;
                case 2:
                    mInkObject.EditingMode = InkOverlayEditingMode.Select;
                    break;
            }
        }
    }
    catch
    {
        // handle or rethrow
    }
}

Platforms

Windows 7, Windows Vista, Windows Server 2008 R2, Windows Server 2008

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Version Information

.NET Framework

Supported in: 3.0

See Also

Reference

InkOverlay Class

InkOverlay Members

Microsoft.Ink Namespace

InkOverlayEditingMode

InkOverlay.Enabled