다음을 통해 공유


Ink.CanPaste Method

Ink.CanPaste Method

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

Definition

Visual Basic .NET Public Function CanPaste() As Boolean
C# public bool CanPaste();
Managed C++ public: bool* CanPaste();

Return Value

System.Boolean. Whether the data can be converted to an Ink object.

true The data can be converted to an Ink object.
false The data cannot be converted to an Ink object.

Remarks

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

Examples

[C#]

This C# example uses the form's MenuStart Leave Site event to enable or disable the Paste command on the Edit menu. If the Clipboard Leave Site 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 {}
}

[Visual Basic .NET]

This Microsoft® Visual Basic® .NET example uses the form's MenuStart Leave Site event to enable or disable the Paste command on the Edit menu. If the Clipboard Leave Site 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

See Also