Compartir a través de


InkOverlay.Handle Property

InkOverlay.Handle Property

Gets or sets the handle of the window to which the InkOverlay object is attached.

Definition

Visual Basic .NET Public Property Handle As IntPtr
C# public IntPtr Handle { get; set; }
Managed C++ public: __property IntPtr* get_Handle();
public: __property void set_Handle(IntPtr*);

Property Value

System.IntPtr. The handle of the window to which the InkOverlay object is attached.

This property is read/write.

null Default. The InkOverlay object is not attached to a window.
System.Windows.Forms.Control The handle of the window to which the InkOverlay object is attached.

Exceptions

ArgumentException Leave Site: The window handle must live in the same process.
COMException Leave Site:
InvalidOperationException Leave Site: It is not possible to change the Window Handle while actively collecting ink.
ObjectDisposedException Leave Site:
SecurityException Leave Site: Insufficient security permission to use the specified window handle.

Remarks

The AttachedControl or Handle property must be set before the InkOverlay object can be enabled.

If the InkOverlay object is attached to a control, setting this property attaches the InkOverlay object to a window and clears the AttachedControl property.

Note: The InkOverlay must be disabled before setting this property. To disable the InkOverlay, set the Enabled property to false. You can then set this property and re-enable the object by setting the Enabled property to true.

If you use the AttachedControl property and the Handle property in your application, you will get a security exception when you run the application in the Internet zone. This is because the Handle property is not valid in the partial trust environment of the Internet zone, so the Tablet PC operating system reverts to the AttachedControl property.

Important Security InformationSecurity Alert: If using under partial trust, this property requires SecurityPermissionFlag.UnmanagedCode Leave Site permission in addition to the permissions required by InkOverlay. See Security And Trust for more information.

Examples

[C#]

This C# example is a method that redirects an InkOverlay, theInkOverlay, to collect ink on a new control.

private void SwitchOverlay(Control collectingControl)
{
     theInkOverlay.Enabled = false;
     theInkOverlay.Handle = collectingControl.Handle;
     theInkOverlay.Enabled = true;
}
            

[VB.NET]

This Microsoft® Visual Basic® .NET example is a subroutine that redirects an InkOverlay, theInkOverlay, to collect ink on a new control.

Private Sub SwitchOverlay(ByVal collectingControl As Control)
    theInkOverlay.Enabled = False
    theInkOverlay.Handle = collectingControl.Handle
    theInkOverlay.Enabled = True
End Sub 
        

See Also