RealTimeStylus.RealTimeStylus Constructor

RealTimeStylus.RealTimeStylus Constructor

Creates a RealTimeStylus object, attaches it to the specified control, and restricts ink collection to the specified tablet.

Definition

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

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.
tablet Microsoft.Ink.Tablet. The tablet on which to collect ink, or null (Nothing in Microsoft® Visual Basic® .NET) to allow ink collection on any attached tablet.

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 tablet parameter is specified, its value determines on which tablets the RealTimeStylus object collects ink and whether it also uses the mouse to collect ink. See the following table for details.

Value Description
null All attached tablets and the mouse are used to collect ink.
mouse Only the mouse is used to collect ink.
other tablet Only the specified tablet is used 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. Only the Tablet object, theTablet, is used for input.

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

    // ...
}

See Also