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 var InkSerializedFormat : String

Field Value

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

Remarks

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

Examples

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 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

Ink Class

Ink Members

Microsoft.Ink Namespace

PersistenceFormat

CanPaste

ClipboardCopy

ClipboardPaste

Other Resources

System.Windows.Forms.DataObject