Sdílet prostřednictvím


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
<UIPermissionAttribute(SecurityAction.Demand, Clipboard := UIPermissionClipboard.AllClipboard)> _
<PermissionSetAttribute(SecurityAction.InheritanceDemand, Name := "FullTrust")> _
Public Function CanPaste As Boolean
'Usage
Dim instance As Ink 
Dim returnValue As Boolean 

returnValue = instance.CanPaste()
[UIPermissionAttribute(SecurityAction.Demand, Clipboard = UIPermissionClipboard.AllClipboard)]
[PermissionSetAttribute(SecurityAction.InheritanceDemand, Name = "FullTrust")]
public bool CanPaste()
[UIPermissionAttribute(SecurityAction::Demand, Clipboard = UIPermissionClipboard::AllClipboard)]
[PermissionSetAttribute(SecurityAction::InheritanceDemand, Name = L"FullTrust")]
public:
bool CanPaste()
public function CanPaste() : boolean

Return Value

Type: System.Boolean
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.

Examples

In this example, the Opening event of a ContextMenuStrip is used to enable or disable the Paste command on the menu. If the Clipboard contains data that can be pasted into the ink in the InkOverlay object, the Paste command on the menu is enabled.

Private Sub menuStrip_Opening(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles menuStrip.Opening
    Me.miPaste.Enabled = mInkOverlay.Ink.CanPaste()
End Sub
private void menuStrip_Opening(object sender, CancelEventArgs e)
{
    this.miPaste.Enabled = mInkOverlay.Ink.CanPaste();
}

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

CanPaste Overload

Microsoft.Ink Namespace

InkCollector