Share via


Ink.InkSerializedFormat Field

Ink.InkSerializedFormat Field

Returns a string that contains the name of the format for ink serialized format (ISF) for querying the Clipboard.

Definition

Visual Basic .NET Public Shared InkSerializedFormat As String
C# public static String InkSerializedFormat;
Managed C++ public: static String InkSerializedFormat;

Field Value

System.String. The name of the format for ink serialized format (ISF).

This field is read-only. This field has no default value.

Remarks

This name should be used to query DataObject Leave Site on the Clipboard to see if it contains that particular format.

Examples

[C#]

This C# example shows how you could have a menu item called menuItemEdit which contains two submenus called menuItemCopy and menuItemPaste for copying and pasting selected strokes. Two methods are shown: menuItemCopy_Click (the event handler that is called when menuItemCopy is clicked) and menuItemEdit_Popup (the event handler that is called when the submenus of menuItemEdit are shown). In menuItemCopy, the selected ink from an InkOverlay named theInkOverlay is copied into the clipboard in Ink Serialized Format. In menuItemEdit_Popup, the menuItemCopy control is only enabled if one or more strokes are selected, and the menuItemPaste control is only enabled if ink has been copied to the clipboard in ISF. You can check this by using the InkSerializedFormat field.

private void menuItemCopy_Click(object sender, System.EventArgs e)
{
    // Check if anything is selected
    if (theInkOverlay.Selection.Count > 0)
    {
        // Copy the ink as ISF
        theInkOverlay.Ink.ClipboardCopy(theInkOverlay.Selection,
            InkClipboardFormats.InkSerializedFormat, InkClipboardModes.Copy);
    }
}

private void menuItemEdit_Popup(object sender, System.EventArgs e)
{
    // Only enable Copy if something is selected
    menuItemCopy.Enabled = (theInkOverlay.Selection.Count > 0);

    // Only enable Paste if ink serialialized format is in the clipboard
    IDataObject clipboardObject = Clipboard.GetDataObject();
    menuItemPaste.Enabled =
        clipboardObject.GetDataPresent(Ink.InkSerializedFormat);
}

[Visual Basic .NET]

This Microsoft® Visual Basic® .NET example shows how you could have a menu item called MenuItemEdit which contains two submenus called MenuItemCopy and MenuItemPaste for copying and pasting selected strokes. Two methods are shown: MenuItemCopy_Click (the event handler that is called when MenuItemCopy is clicked) and MenuItemEdit_Popup (the event handler that is called when the submenus of MenuItemEdit are shown). In MenuItemCopy, the selected ink from an InkOverlay named theInkOverlay is copied into the clipboard in Ink Serialized Format. In MenuItemEdit_Popup, the MenuItemCopy control is only enabled if one or more strokes are selected, and the MenuItemPaste control is only enabled if ink has been copied to the clipboard in ISF. You can check this by using the InkSerializedFormat field.

Private Sub MenuItemCopy_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItemCopy.Click
    ' Check if anything is selected
    If theInkOverlay.Selection.Count > 0 Then
        ' Copy the ink as ISF
        theInkOverlay.Ink.ClipboardCopy(theInkOverlay.Selection, _
            InkClipboardFormats.InkSerializedFormat, InkClipboardModes.Copy)
    End If
End Sub

Private Sub MenuItemEdit_Popup(ByVal sender As Object, ByVal e As System.EventArgs) Handles MenuItemEdit.Popup
    ' Only enable Copy if something is selected
    If theInkOverlay.Selection.Count > 0 Then
        MenuItemCopy.Enabled = True
    Else
        MenuItemCopy.Enabled = False
    End If

    ' Only enable Paste if ink serialialized format is in the clipboard
    Dim clipboardObject As IDataObject = Clipboard.GetDataObject()
    If clipboardObject.GetDataPresent(Ink.InkSerializedFormat) = True Then
        MenuItemPaste.Enabled = True
    Else
        MenuItemPaste.Enabled = False
    End If

End Sub

See Also