Share via


Ink.InkSerializedFormat Field

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

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

Syntax

'Declaration
Public Shared ReadOnly InkSerializedFormat As String
'Usage
Dim value As String

value = Ink.InkSerializedFormat
public static readonly string InkSerializedFormat
public:
static initonly String^ InkSerializedFormat
public static final String InkSerializedFormat
public static final var InkSerializedFormat : String
Not applicable.

Field Value

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

Remarks

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

Example

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);
}

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

Platforms

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

Version Information

.NET Framework

Supported in: 3.0

See Also

Reference

Ink Class
Ink Members
Microsoft.Ink Namespace
PersistenceFormat
CanPaste
ClipboardCopy
ClipboardPaste