Share via


Ink.CanPaste Method ()

Returns a value that indicates whether the data on the Clipboard can be converted to an Ink object.

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

Syntax

'Declaration
Public Function CanPaste As Boolean
'Usage
Dim instance As Ink
Dim returnValue As Boolean

returnValue = instance.CanPaste
public bool CanPaste ()
public:
bool CanPaste ()
public boolean CanPaste ()
public function CanPaste () : boolean
Not applicable.

Return Value

true if the data can be converted to an Ink object; otherwise, false.

Remarks

Security noteSecurity Note:

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

Example

This C# example uses the form's MenuStart event to enable or disable the Paste command on the Edit menu. If the Clipboard contains data that can be pasted into the ink in the InkCollector object, theInkCollector, the Paste command on the Edit menu is enabled.

private void MenuStart_Event(object sender, EventArgs e)
{
    menuEditPaste.Enabled = false;
    try
    {
        if (theInkCollector.Ink.CanPaste())
            menuEditPaste.Enabled = true;
    }
    catch {}
}

This Microsoft Visual Basic.NET example uses the form's MenuStartMenuStart event to enable or disable the Paste command on the Edit menu. If the Clipboard contains data that can be pasted into the ink in the InkCollector object, theInkCollector, the Paste command on the Edit menu is enabled.

Private Sub MenuStart_Event(ByVal sender As Object, ByVal e as EventArgs)
    MenuEditPaste.Enabled = False
    Try
        If theInkCollector.Ink.CanPaste()
            menuEditPaste.Enabled = True
        End If
    Catch
    End Try
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
InkCollector