Share via


Ink.ClipboardCopy Method (Strokes, InkClipboardFormats, InkClipboardModes)

Copies a specified Strokes collection to the Clipboard.

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

Syntax

'Declaration
Public Function ClipboardCopy ( _
    strokes As Strokes, _
    formats As InkClipboardFormats, _
    modes As InkClipboardModes _
) As IDataObject
'Usage
Dim instance As Ink 
Dim strokes As Strokes 
Dim formats As InkClipboardFormats 
Dim modes As InkClipboardModes 
Dim returnValue As IDataObject 

returnValue = instance.ClipboardCopy(strokes, _
    formats, modes)
public IDataObject ClipboardCopy(
    Strokes strokes,
    InkClipboardFormats formats,
    InkClipboardModes modes
)
public:
IDataObject^ ClipboardCopy(
    Strokes^ strokes, 
    InkClipboardFormats formats, 
    InkClipboardModes modes
)
public function ClipboardCopy(
    strokes : Strokes, 
    formats : InkClipboardFormats, 
    modes : InkClipboardModes
) : IDataObject

Parameters

Return Value

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

Remarks

This method copies all properties of the Strokes collection, including any RecognitionResult property.

Setting the strokes parameter to nulla null reference (Nothing in Visual Basic) (Nothing in 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 nulla null reference (Nothing in Visual Basic) (Nothing in Visual Basic.NET) and the contents of the Clipboard are not modified.

Warning

To avoid potential memory leaks as a result of using the InkClipboardModes flag, call the System.Windows.Forms.Clipboard.SetDataObject(System.Object) 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 in enumeration InkClipboardModes..

Security noteSecurity Note:

If using under partial trust, this method requires UIPermissionClipboard.OwnClipboard permission. See Security And Trust for more information.

Examples

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

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

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

ClipboardCopy Overload

Microsoft.Ink Namespace

ClipboardPaste