다음을 통해 공유


RealTimeStylus.RealTimeStylus Constructor

RealTimeStylus.RealTimeStylus Constructor

Creates a RealTimeStylus object and attaches it to the specified window.

Definition

Visual Basic .NET Public Sub RealTimeStylus( _
ByVal handle As IntPtr _
)
C# public RealTimeStylus(
IntPtr handle
);
Managed C++ public: RealTimeStylus(
IntPtr *handle
);

Parameters

handle System.IntPtr. The handle of the window to which to attach the RealTimeStylus object. If this parameter is set to 0, the RealTimeStylus object is not attached it to a window or control.

Exceptions

ArgumentException Leave Site: One of the parameters is not valid.
InvalidOperationException Leave Site: Initialization failed.

Remarks

For new RealTimeStylus objects, ink collection is initially disabled and the input region is set to the bounds of the window to which the RealTimeStylus object is attached. For more information, see the Enabled and WindowInputRectangle properties.

When the RealTimeStylus object is created with the default constructor or with a constructor with the handle parameter set to 0 or the attachedControl parameter set to null, then the RealTimeStylus object does not collect ink from a window or control. Instead, the only way to receive ink input is by cascading this RealTimeStylus object under one that is receiving ink input from a window or control. For more information on cascading the RealTimeStylus, see The Cascaded RealTimeStylus Model.

When the handle parameter is specified and not set to 0, the RealTimeStylus object is attached to and receives ink input from the specified window.

By default, the RealTimeStylus object uses all attached tablets and the mouse to collect ink.

Important Security InformationSecurity Alert: If using under partial trust, this constructor requires UIPermissionWindow.AllWindows Leave Site permission, in addition to the permissions required by RealTimeStylus. See Security And Trust for more information.

Examples

This Microsoft® Visual C#® .NET example is a snippet from a form's Load Leave Site event handler, which creates a RealTimeStylus object attached to the Handle Leave Site of the Panel Leave Site object, thePanel.

[C#]<![CDATA[using Microsoft.Ink;
using Microsoft.StylusInput;
using Microsoft.StylusInput.PluginData;

// ...

// The panel where the tablet pen data is collected.
private System.Windows.Forms.Panel thePanel;

// The form's Load event handler.
private void theForm_Load(object sender, System.EventArgs e)
{
    // ...

    // Create the RealTimeStylus object.
    this.theRealTimeStylus = new RealTimeStylus(this.thePanel.Handle);

    // ...
}

See Also