Share via


Ink.ClipboardCopy Method

Ink.ClipboardCopy Method

Copies the Ink object to the Clipboard Leave Site.

Definition

Visual Basic .NET Public Function ClipboardCopy( _
ByVal formats As InkClipboardFormats, _
ByVal modes As InkClipboardModes _
) As IDataObject
C# public IDataObject ClipboardCopy(
InkClipboardFormats formats,
InkClipboardModes modes
);
Managed C++ public: IDataObject* ClipboardCopy(
InkClipboardFormats *formats,
InkClipboardModes *modes
);

Parameters

> > > > > > >
formats Microsoft.Ink.InkClipboardFormats. A member of the InkClipboardFormats enumeration that specifies the format for the Ink object. The default value is Default.

None0 Specifies a flag that can be used to verify whether any formats are present by checking against it.
InkSerializedFormat1 Specifies ink is encoded in Ink Serialized Format (ISF). This is the most compact persistent representation of ink. Although it often contains only ink data, is extensible. Applications can set custom attributes (identified by a globally unique identifier (GUID)) on an Ink object, stroke, or point. This allows an application to store any kind of data or metadata it requires as an attribute in an ISF stream.
SketchInk2 Specifies ink is not expected to form words, but rather is interpreted as a picture. This is also useful for representing multiple words.
TextInk6 Specifies ink is expected to form words. It allows the ink to be converted to text. The recognized text is either the alternate with the greatest confidence rating or another alternate chosen from a list. This is useful for representing a single word.

This format includes the SketchInk format.

EnhancedMetafile8 Specifies the enhanced metafile to play to create the background. The metafile must remain valid for as long as it is used to render the ink background.
Metafile32 Specifies ink is stored as a metafile or a list of commands that can be played back to draw a graphic.
Bitmap64 Specifies the bitmap to use as the background. The bitmap device context must remain valid for as long as it is used to render the ink background.
PasteMask7 Specifies the formats that can be used for pasting.

This format includes the TextInk, SketchInk, and InkSerializedFormat formats.

CopyMask127 Specifies the formats that are copied to the Clipboard through ink.
Default127 The CopyMask format.
modesMicrosoft.Ink.InkClipboardModes. A member of the InkClipboardModes enumeration that specifies the mode for the Ink object. The default value is Default. >

> > > > > > > > > > > > > > > > > > > > > > > >
Copy0Copies the ink to the Clipboard.
Cut1Cuts the ink and copies it to the Clipboard.
ExtractOnly48Does not copy the ink to the Clipboard. Typically, use this option if you want to add something else, such as text, to the ink before you copy it to the Clipboard.
DelayedCopy32Uses delayed rendering to reduce the amount of data that is stored on the Clipboard. The data is rendered when a paste request is made.
Default0The Copy mode.

Return Value

System.Windows.Forms.IDataObject. Returns the data object to be created. The default value is null (Nothing in Microsoft® Visual Basic® .NET).

Remarks

This method copies the Ink object to the Clipboard Leave Site, including the CustomStrokes property. In addition, the RecognitionResult property of strokes in the Ink object's CustomStrokes collection is maintained.

If the Ink object's Strokes collection is empty, the method returns null (Nothing in Microsoft® Visual Basic® .NET), and the contents of the Clipboard Leave Site are not modified.

Caution: To avoid potential memory leaks as a result of using the DelayedCopy flag, call the SetDataObject Leave Site method of the Clipboard Leave Site object. This must be done before the application exits if the last call to the ClipboardCopy method used the DelayedCopy flag.

Important Security InformationSecurity Alert: If using under partial trust, this method requires UIPermissionClipboard.OwnClipboard Leave Site permission. See Security And Trust for more information.

Examples

[C#]

This C# example uses a menu's click event handler to copy all of the ink from the InkCollector object, theInkCollector, to the Clipboard Leave Site.

private void menuEditCopyAll_Click(object sender, EventArgs e)
{
    try
    {
        theInkCollector.Ink.ClipboardCopy(InkClipboardFormats.Default,
            InkClipboardModes.Copy);
    }
    catch
    {
        // Place exception handling code here.
    }
}

[Visual Basic .NET]

This Visual Basic .NET example uses a menu's click event handler to copy all of the ink from the InkCollector object, theInkCollector, to the Clipboard Leave Site.

Private Sub menuEditCopy_Click(Dim sender As Object, Dim e As EventArgs)
    Try
        theInkCollector.Ink.ClipboardCopy(InkClipboardFormats.Default, _
            InkClipboardModes.Copy)
    Catch
        'Place exception handling code here.
    End Try
End Sub

See Also