Select and Delete Ink in Tablet PC in VB.NET
In my previous articles, I discussed how to use to use Ink and set its properties to draw on a Windows Form and Windows controls. In this article, I will discuss some more features of Tablet PC ink including selecting and deleting ink, Ink collection, and Ink object.
In my previous articles, I discussed how to use Ink and set its properties to draw on a Windows Form and Windows controls. In this article, I will discuss some more features of Tablet PC ink including selecting and deleting ink, Ink collection, and Ink object.
The EditingMode
The EditingMode property of InkOverlay allows us to set the editing mode of ink overlay. There are three modes - Ink, Select, and Delete. The EditingMode is a type of InkOverlayEditingMode enumeration. By default, Ink is the editing mode for ink overlay.
The Application
Attached project is a Windows Forms application which allows you to set height, width, and pen color properties of Ink. The application also allows you to change the modes of ink. Click Apply button to activate the ink.
The Select Ink check box changes the application from Ink mode to select mode. Here is the check box click event handler. As you can see from the below code, when check box is checked, the editing mode is changing to Select, otherwise its change back to Ink.
Private Sub SelectInkCheckBox_CheckedChanged(sender As Object, e As System.EventArgs)
If SelectInkCheckBox.Checked Then
inkOverlay.Enabled = False
inkOverlay.EditingMode = InkOverlayEditingMode.Select
inkOverlay.Handle = Me.Handle
inkOverlay.Enabled = True
Else
inkOverlay.Enabled = False
inkOverlay.EditingMode = InkOverlayEditingMode.Ink
inkOverlay.Handle = Me.Handle
inkOverlay.Enabled = True
End If
End Sub 'SelectInkCheckBox_CheckedChanged
Delete Ink button click changes the editing mode to Delete. In this case the default cursor converts to a rubber stamp and you can rollover the ink and it will start erasing the ink. Below code is the Delete button click event handler:
Private Sub DeleteBtn_Click(sender As Object, e As System.EventArgs)inkOverlay.Enabled = False
inkOverlay.EditingMode = InkOverlayEditingMode.Delete
inkOverlay.Handle = Me.Handle
inkOverlay.Enabled = True
End Sub 'DeleteBtn_Click