次の方法で共有


RealTimeStylus.GetTabletContextIdFromTablet メソッド

指定された Tablet オブジェクトと関連付けられたタブレット コンテキスト識別子を返します。

名前空間 :  Microsoft.StylusInput
アセンブリ :  Microsoft.Ink (Microsoft.Ink.dll 内)

構文

'宣言
Public Function GetTabletContextIdFromTablet ( _
    tablet As Tablet _
) As Integer
'使用
Dim instance As RealTimeStylus
Dim tablet As Tablet
Dim returnValue As Integer

returnValue = instance.GetTabletContextIdFromTablet(tablet)
public int GetTabletContextIdFromTablet(
    Tablet tablet
)
public:
int GetTabletContextIdFromTablet(
    Tablet^ tablet
)
public int GetTabletContextIdFromTablet(
    Tablet tablet
)
public function GetTabletContextIdFromTablet(
    tablet : Tablet
) : int

パラメータ

戻り値

型 : System.Int32
指定された Tablet オブジェクトと関連付けられたタブレット コンテキスト識別子。

解説

ms585095.alert_note(ja-jp,VS.90).gifメモ :

タブレット コンテキスト識別子は RealTimeStylus オブジェクトに固有ですが、2 つの RealTimeStylus オブジェクトが同じ Tablet オブジェクトに対して異なるコンテキスト識別子を持つ場合があります。さらに、タブレット コンテキスト識別子は、RealTimeStylus オブジェクトが有効な場合のみ有効です。RealTimeStylus オブジェクトを無効にしてから有効にすると、各 Tablet オブジェクトのタブレット コンテキスト識別子は、RealTimeStylus オブジェクトが最初に有効であったときとは異なる値を持つ場合があります。

RealTimeStylus が無効化または破棄されている場合、あるいは tablet パラメータが null (Visual Basic では Nothing) の場合、このメソッドは例外をスローします。

ms585095.alert_note(ja-jp,VS.90).gifメモ :

この関数は、特定のメッセージ ハンドラ内で呼び出された場合に再入力されることがあり、予期しない結果が生じる可能性があります。WM_ACTIVATEWM_ACTIVATEAPPWM_NCACTIVATEWM_PAINT、wParam が SC_HOTKEY または SC_TASKLIST に設定されている場合のWM_SYSCOMMAND および WM_SYSKEYDOWN (Alt-Tab キーまたは Alt-Esc キーの組み合わせで処理される場合) のいずれかのメッセージを処理するときは、再入呼び出しを回避するように注意してください。これはシングル スレッド アパートメント モデル アプリケーションに関する問題です。

この C# の例は、IStylusAsyncPlugin インターフェイスの TabletAdded メソッドの実装のスニペットです。IStylusAsyncPlugin インターフェイスを実装するフォームには、TextBox オブジェクト theTextBox が含まれます。TabletAdded メソッドは、追加されたタブレットに関する情報を表示し、GetTabletContextIdFromTablet メソッドを呼び出してタブレットのコンテキスト識別子を取得します。また、GetTabletPropertyDescriptionCollection メソッドを呼び出して、タブレットによってサポートされるパケット プロパティの一覧を取得します。

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;

// ...

// Called when a tablet is added while the RealTimeStylus is enabled.
public void TabletAdded(RealTimeStylus sender, TabletAddedData data)
{
    // Display information about the tablet that was added.
    int theContextId =
        this.thePrimaryRealTimeStylus.GetTabletContextIdFromTablet(data.Tablet);

    this.theTextBox.Text = string.Format(
        "Tablet added, Name = {0}, ContextId={1}, available packet properties:"
        + Environment.NewLine, data.Tablet.Name, theContextId);

    TabletPropertyDescriptionCollection theTabletProperties =
        this.thePrimaryRealTimeStylus.GetTabletPropertyDescriptionCollection(theContextId);

    foreach(TabletPropertyDescription theTabletPropertyDescription in theTabletProperties)
    {
        // ...
    }
}

プラットフォーム

Windows Vista, Windows XP SP2, Windows Server 2003

.NET Framework および .NET Compact Framework では、各プラットフォームのすべてのバージョンはサポートしていません。サポートされているバージョンについては、「.NET Framework システム要件」を参照してください。

バージョン情報

.NET Framework

サポート対象 : 3.0

参照

参照

RealTimeStylus クラス

RealTimeStylus メンバ

Microsoft.StylusInput 名前空間

Stylus.TabletContextId

RealTimeStylus.GetTabletFromTabletContextId