InkCollector.Handle 属性

获取或设置要附加 InkCollector 对象的窗口的句柄。

命名空间:  Microsoft.Ink
程序集:  Microsoft.Ink(在 Microsoft.Ink.dll 中)

语法

声明
Public Property Handle As IntPtr
用法
Dim instance As InkCollector
Dim value As IntPtr

value = instance.Handle

instance.Handle = value
public IntPtr Handle { get; set; }
public:
property IntPtr Handle {
    IntPtr get ();
    void set (IntPtr value);
}
/** @property */
public IntPtr get_Handle()
/** @property */
public  void set_Handle(IntPtr value)
public function get Handle () : IntPtr
public function set Handle (value : IntPtr)

属性值

类型:System.IntPtr
要附加 InkCollector 对象的窗口的句柄。

含义

nullnull 引用(在 Visual Basic 中为 Nothing)

InkCollector 对象不附加到窗口(如果 AttachedControl 也是 nullnull 引用(在 Visual Basic 中为 Nothing))。

System.Windows.Forms.Control.Handle

要附加 InkCollector 对象的窗口的句柄。

备注

必须先设置 AttachedControl 或 Handle 属性,然后才能启用 InkCollector 对象。

如果 InkCollector 对象附加到控件,则设置此属性可以将 InkCollector 对象附加到窗口,并清除 AttachedControl 属性。

备注

在设置此属性之前,必须禁用 InkCollector。若要禁用 InkCollector,请将 Enabled 属性设置为 false。然后,即可设置此属性,通过将 Enabled 属性设置为 true,可以重新启用该对象。

如果在应用程序中使用 AttachedControl 属性和 Handle 属性,则在 Internet 区域中运行应用程序时,将引发安全异常。这是因为在 Internet 区域的部分信任环境中,Handle 属性是无效的,因此 Tablet PC 操作系统恢复为 AttachedControl 属性。

ms571715.alert_security(zh-cn,VS.90).gif安全说明:

如果在部分信任环境下使用,则除了 InkCollector 所需的权限以外,该属性还需要 SecurityPermissionFlag.UnmanagedCode 权限。有关更多信息,请参见Security And Trust

示例

下面的示例演示的方法可以用于指示 InkCollector 对象或 InkOverlay 对象在新控件上收集墨迹。

Private Sub SwitchInkObjectHandle(ByVal collectingControl As Control)
    ' mInkObject can be InkCollector or InkOverlay
    mInkObject.Enabled = False
    ' setting the Handle property sets the AttachedControl property to null
    mInkObject.Handle = collectingControl.Handle
    mInkObject.Enabled = True
End Sub
private void SwitchInkObjectHandle(Control collectingControl)
{
    // mInkObject can be InkCollector or InkOverlay
    mInkObject.Enabled = false;
    // setting the Handle property sets the AttachedControl property to null
    mInkObject.Handle = collectingControl.Handle;
    mInkObject.Enabled = true;
}

平台

Windows Vista

.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求

版本信息

.NET Framework

受以下版本支持:3.0

另请参见

参考

InkCollector 类

InkCollector 成员

Microsoft.Ink 命名空间

InkCollector.InkCollector

InkCollector.Enabled

InkCollector.AttachedControl