Поделиться через


RealTimeStylus.GetTabletContextIdFromTablet - метод

Обновлен: Ноябрь 2007

Returns the tablet context identifer that is associated with a given Tablet object.

Пространство имен:  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
The tablet context identifer that is associated with the given Tablet object.

Заметки

ms585095.alert_note(ru-ru,VS.90).gifПримечание.

A tablet context identifier is specific to RealTimeStylus object; however two RealTimeStylus objects may have a different context identifiers for the same Tablet object. In addition, a tablet context identifier is only valid while a RealTimeStylus object is enabled. If a RealTimeStylus object is disabled and then re-enabled, the tablet context identifier for each Tablet object may have a different value from when the RealTimeStylus object was first enabled.

This method throws an exception when the RealTimeStylus is disabled or disposed or when the tablet parameter is null (Nothing in Visual Basic).

ms585095.alert_note(ru-ru,VS.90).gifПримечание.

This function can be re-entered when called within certain message handlers, causing unexpected results. Take care to avoid a reentrant call when handling any of the following messages: WM_ACTIVATE, WM_ACTIVATEAPP, WM_NCACTIVATE, WM_PAINT; WM_SYSCOMMAND if wParam is set to SC_HOTKEY or SC_TASKLIST; and WM_SYSKEYDOWN (when processing Alt-Tab or Alt-Esc key combinations). This is an issue with single-threaded apartment model applications.

Примеры

This C# example is a snippet from the implementation of the IStylusAsyncPlugin interface's TabletAdded method. The form which implements the IStylusAsyncPlugin interface contains a TextBox object, theTextBox. The TabletAdded method displays information about the tablet that was added, calls the GetTabletContextIdFromTablet method to get the tablet's context identifier, and calls the GetTabletPropertyDescriptionCollection method to get the list of packet properties supported by the tablet.

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 с пакетом обновления 2 (SP2), Windows Server 2003

Среды .NET Framework и .NET Compact Framework поддерживают не все версии каждой платформы. Поддерживаемые версии перечислены в разделе Требования к системе для .NET Framework.

Сведения о версии

.NET Framework

Поддерживается в версии: 3.0

См. также

Ссылки

RealTimeStylus Класс

RealTimeStylus - члены

Microsoft.StylusInput - пространство имен

Stylus.TabletContextId

RealTimeStylus.GetTabletFromTabletContextId