Stylus.TabletContextId 属性

获取 Stylus 对象所属的 Tablet 设备的上下文标识符。

命名空间:  Microsoft.StylusInput
程序集:  Microsoft.Ink(在 Microsoft.Ink.dll 中)

语法

声明
Public ReadOnly Property TabletContextId As Integer
用法
Dim instance As Stylus
Dim value As Integer

value = instance.TabletContextId
public int TabletContextId { get; }
public:
property int TabletContextId {
    int get ();
}
/** @property */
public int get_TabletContextId()
public function get TabletContextId () : int

属性值

类型:System.Int32
Stylus 对象所属的 Tablet 设备的上下文标识符。

备注

此标识符特定于 Stylus 对象所属的 RealTimeStylus 对象。

示例

此 Microsoft Visual C# .NET 示例是窗体的帮助器方法 StylusDataToString 中的代码段。此帮助器方法接受一个 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;

// ...

// Returns information about a given stylus.
private string StylusDataToString(Stylus theStylus)
{
    System.Text.StringBuilder result = new System.Text.StringBuilder();

    // Add information about the tablet pen.
    result.Append(
        string.Format("  Name = {0}, Id = {1}, ContextId = {2}, Inverted = {3}, Button Count = {4}."
        + Environment.NewLine, theStylus.Name, theStylus.Id,
        theStylus.TabletContextId, theStylus.Inverted, theStylus.Buttons.Count));

    // Add information about each of the tabet pen's buttons.
    for (int i=0; i<theStylus.Buttons.Count; i++)
    {
        result.Append(
            string.Format("    Button {0}: Name = {1}, Id = {2}" + Environment.NewLine,
            i, theStylus.Buttons.GetName(i), theStylus.Buttons.GetId(i)));
    }

    return result.ToString();
}

平台

Windows Vista, Windows XP SP2, Windows Server 2003

.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求

版本信息

.NET Framework

受以下版本支持:3.0

另请参见

参考

Stylus 类

Stylus 成员

Microsoft.StylusInput 命名空间

StylusButtons

Microsoft.StylusInput.PluginData.StylusButtonDataBase

Microsoft.StylusInput.PluginData.StylusButtonDownData

Microsoft.StylusInput.PluginData.StylusButtonUpData