EditingMode Property
EditingMode Property |
Returns or sets a value that specifies whether the object/control is in ink mode, deletion mode, or selecting/editing mode.
Declaration
[C++]
[propput] HRESULT put_EditingMode ([in] InkOverlayEditingMode EditingMode);
[propget] HRESULT get_EditingMode ([out, retval] InkOverlayEditingMode*
EditingMode);
[Microsoft® Visual Basic® 6.0]
Public Property Get EditingMode() As InkOverlayEditingMode
Public Property Let EditingMode(ByVal theMode As InkOverlayEditingMode)
Property Value
InkOverlayEditingMode Returns or sets a value that specifies whether the control is in ink mode, deletion mode, or selection/editing mode. The default value is IOEM_Ink, which specifies ink mode.
This property is read/write.
Remarks
The InkOverlay and InkPicture objects generate an error 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.
Example
[Visual Basic 6.0]
This Visual Basic 6.0 example creates an InkOverlay object and allows the user to alternately ink, select, and delete the ink by setting the EditingMode property, while reporting details on the SelectionMoved, SelectionMoving, SelectionResized, SelectionResizing, StrokesDeleted and StrokesDeleting events within a text box. This application starts with a standard .exe application and adds a reference to Tablet PC Type Library, a Picture control, Picture1, a command button, Command1, and a text box, Text1, then adds the following code to the form.
Option Explicit
Private WithEvents theInkOverlay As InkOverlay
Private Sub Command1_Click()
'Set the EditingMode to the next of
'the options with each click of the
'button.
If theInkOverlay.CollectingInk = True Then
'This is hard to do unless you are using
'multiple cursors at once.
Text1.Text = "Can't switch while collecting ink"
ElseIf theInkOverlay.EditingMode = IOEM_Ink Then
theInkOverlay.EditingMode = IOEM_Select
Command1.Caption = "Select"
ElseIf theInkOverlay.EditingMode = IOEM_Select Then
theInkOverlay.EditingMode = IOEM_Delete
Command1.Caption = "Delete"
Else
theInkOverlay.EditingMode = IOEM_Ink
Command1.Caption = "Ink"
End If
End Sub
Private Sub Form_Load()
'Set the InkOverlay to work in the
'panel of the Picture1 control.
Set theInkOverlay = New InkOverlay
theInkOverlay.hWnd = Picture1.hWnd
theInkOverlay.Enabled = True
Command1.Caption = "Ink"
Text1.Text = ""
End Sub
Private Sub theInkOverlay_SelectionMoved( _
ByVal OldSelectionRect As InkRectangle)
Text1.Text = "SelectionMoved: (" _
& OldSelectionRect.Left & ", " _
& OldSelectionRect.Top & ", " _
& OldSelectionRect.Right & ", " _
& OldSelectionRect.Bottom & ")"
End Sub
Private Sub theInkOverlay_SelectionMoving( _
ByVal CurSelectionRect As InkRectangle)
Text1.Text = "SelectionMoving: (" _
& CurSelectionRect.Left & ", " _
& CurSelectionRect.Top & ", " _
& CurSelectionRect.Right & ", " _
& CurSelectionRect.Bottom & ")"
End Sub
Private Sub theInkOverlay_SelectionResized( _
ByVal OldSelectionRect As InkRectangle)
Text1.Text = "SelectionResized: (" _
& OldSelectionRect.Left & ", " _
& OldSelectionRect.Top & ", " _
& OldSelectionRect.Right & ", " _
& OldSelectionRect.Bottom & ")"
End Sub
Private Sub theInkOverlay_SelectionResizing( _
ByVal CurSelectionRect As InkRectangle)
Text1.Text = "SelectionResizing: (" _
& CurSelectionRect.Left & ", " _
& CurSelectionRect.Top & ", " _
& CurSelectionRect.Right & ", " _
& CurSelectionRect.Bottom & ")"
End Sub
Private Sub theInkOverlay_StrokesDeleted()
Text1.Text = "StrokesDeleted"
End Sub
Private Sub theInkOverlay_StrokesDeleting( _
ByVal Strokes As InkStrokes)
'If you want to be able to undo this,
'this might be a good time to save these
'strokes somewhere.
Text1.Text = "StrokesDeleting: " _
& Strokes.Count & " will be deleted"
End Sub