RealTimeStylus.GetStyluses Method
Returns the array of Stylus objects encountered by the RealTimeStylus.
Namespace: Microsoft.StylusInput
Assembly: Microsoft.Ink (in Microsoft.Ink.dll)
Syntax
'Declaration
Public Function GetStyluses As Stylus()
'Usage
Dim instance As RealTimeStylus
Dim returnValue As Stylus()
returnValue = instance.GetStyluses()
public Stylus[] GetStyluses()
public:
array<Stylus^>^ GetStyluses()
public function GetStyluses() : Stylus[]
Return Value
Type: array<Microsoft.StylusInput.Stylus[]
The array of Stylus objects encountered by the RealTimeStylus.
Remarks
If no Stylus object has yet been detected on the Tablet objects associated with the RealTimeStylus, then this method returns an empty array.
This method throws an exception when the RealTimeStylus is disabled or disposed.
Examples
This C# example is a snippet from a menu item's Click event handler. The menu is part of a form on which a TextBox object, theTextBox, is defined. If the RealTimeStylus object is disabled, the event handler exits. Otherwise, the event handler calls the RealTimeStylus object's GetStyluses method and displays information about each tablet pen in theTextBox. The form's helper method, StylusDataToString, returns a String object containing information about a given stylus.
using Microsoft.Ink;
using Microsoft.StylusInput;
using Microsoft.StylusInput.PluginData;
// ...
// Declare the RealTimeStylus objects, the GestureRecognizer plugin,
// and the DynamicRenderer plug-in.
private Microsoft.StylusInput.RealTimeStylus thePrimaryRealTimeStylus = null;
private Microsoft.StylusInput.RealTimeStylus theSecondaryRealTimeStylus = null;
private Microsoft.StylusInput.GestureRecognizer theGestureRecognizer = null;
private Microsoft.StylusInput.DynamicRenderer theDynamicRenderer = null;
// ...
// The GetStyluses menu item's ClickEventHandler
private void theMenuItemGetStyluses_Click(object sender, System.EventArgs e)
{
// Can not call this method while the RealTimeStylus is disabled.
if (!this.thePrimaryRealTimeStylus.Enabled)
{
MessageBox.Show("The GetStyluses method of the RealTimeStylus can only be called while the RealTimeStylus is enabled.");
return;
}
this.theTextBox.Text = "The Styluses encountered so far:" + Environment.NewLine;
foreach (Stylus theStylus in this.thePrimaryRealTimeStylus.GetStyluses())
{
this.theTextBox.Text +=
this.StylusDataToString(theStylus) + Environment.NewLine;
}
}
Platforms
Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Version Information
.NET Framework
Supported in: 3.0