다음을 통해 공유


RealTimeStylus.RealTimeStylus Constructor

RealTimeStylus.RealTimeStylus Constructor

Creates a RealTimeStylus object, attaches it to the specified control, and specifies whether or not to use the mouse for input.

Definition

Visual Basic .NET Public Sub RealTimeStylus( _
ByVal attachedControl As Control, _
ByVal useMouseForInput As Boolean _
)
C# public RealTimeStylus(
Control attachedControl,
bool useMouseForInput
);
Managed C++ public: RealTimeStylus(
Control *attachedControl,
bool *useMouseForInput
);

Parameters

attachedControl System.Windows.Forms.Control. The control to which to attach the RealTimeStylus object. If this parameter is set to null (Nothing in Microsoft® Visual Basic® .NET), the RealTimeStylus object is not attached it to a window or control.
useMouseForInput System.Boolean. Set to true to use the mouse for tablet input; otherwise, false.

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 attachedControl parameter is specified and not set to null, the RealTimeStylus object is attached to and receives ink input from the specified control.

When the useMouseForInput parameter is specified, the RealTimeStylus object uses all attached tablets to collect ink.

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 Panel Leave Site object, thePanel. The mouse is not used for tablet input, but all other Tablet objects are.

[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, false);

    // ...
}

See Also