Ink.ClipboardCopy Method
Ink.ClipboardCopy Method |
Copies a specified Strokes collection to the Clipboard .
Definition
Visual Basic .NET Public Function ClipboardCopy( _
ByVal strokes As Strokes, _
ByVal formats As InkClipboardFormats, _
ByVal modes As InkClipboardModes _
) As IDataObjectC# public IDataObject ClipboardCopy(
Strokes strokes,
InkClipboardFormats formats,
InkClipboardModes modes
);Managed C++ public: IDataObject* ClipboardCopy(
Strokes *strokes,
InkClipboardFormats *formats,
InkClipboardModes *modes
);
Parameters
> > > > > > >
strokes Microsoft.Ink.Strokes. The Strokes collection to copy. 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. modes Microsoft.Ink.InkClipboardModes. A member of the InkClipboardModes enumeration that specifies the mode for the Ink object. The default value is Default
. > > > > > > > > > > > > > > > > > > > > > > > > >
Copy0
Copies the ink to the Clipboard. Cut1
Cuts the ink and copies it to the Clipboard. ExtractOnly48
Does 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. DelayedCopy32
Uses delayed rendering to reduce the amount of data that is stored on the Clipboard. The data is rendered when a paste request is made. Default0
The 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).Exceptions
ArgumentException : Invalid Stroke object. Verify that the Stroke object corresponds to this Ink object.
COMException :
ObjectDisposedException : The Ink object is disposed.
ThreadStateException :Remarks
This method copies all properties of the Strokes collection, including any RecognitionResult property.
Setting the strokes parameter to
null
(Nothing
in Microsoft® Visual Basic® .NET) copies the entire Ink object to the Clipboard , including the CustomStrokes property. In addition, the RecognitionResult properties for strokes in the Ink object's CustomStrokes collection are maintained.If an empty Strokes collection is passed, the method returns
null
(Nothing
in Visual Basic .NET) and the contents of the Clipboard are not modified.Caution: To avoid potential memory leaks as a result of using the DelayedCopy flag, call the SetDataObject method of the Clipboard object. This must be done before the application exits if the last call to the ClipboardCopy method used the DelayedCopy flag.
Security Alert: If using under partial trust, this method requires UIPermissionClipboard.OwnClipboard permission. See Security And Trust for more information.
Examples
[C#]
This C# example uses a menu's event handler to copy all of the ink from the InkCollector object, theInkCollector, to the Clipboard .
private void menuEditCopyAll_Click(object sender, EventArgs e) { try { theInkCollector.Ink.ClipboardCopy(theInkCollector.Ink.Strokes, InkClipboardFormats.Default, InkClipboardModes.Copy); } catch { // Place exception handling code here. } }
[Visual Basic .NET]
This Visual Basic .NET example uses a menu's event handler to copy all of the ink from the InkCollector object, theInkCollector, to the Clipboard .
Private Sub menuEditCopy_Click(Dim sender As Object, Dim e As EventArgs) Try theInkCollector.Ink.ClipboardCopy(theInkCollector.Ink.Strokes, InkClipboardFormats.Default, InkClipboardModes.Copy) Catch 'Place exception handling code here. End Try End Sub
See Also