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


Tablet.GetPropertyMetrics - метод

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

Returns the metrics data for a known PacketProperty object.

Пространство имен:  Microsoft.Ink
Сборка:  Microsoft.Ink (в Microsoft.Ink.dll)

Синтаксис

'Декларация
Public Function GetPropertyMetrics ( _
    id As Guid _
) As TabletPropertyMetrics
'Применение
Dim instance As Tablet
Dim id As Guid
Dim returnValue As TabletPropertyMetrics

returnValue = instance.GetPropertyMetrics(id)
public TabletPropertyMetrics GetPropertyMetrics(
    Guid id
)
public:
TabletPropertyMetrics GetPropertyMetrics(
    Guid id
)
public TabletPropertyMetrics GetPropertyMetrics(
    Guid id
)
public function GetPropertyMetrics(
    id : Guid
) : TabletPropertyMetrics

Параметры

Возвращаемое значение

Тип: Microsoft.Ink.TabletPropertyMetrics
This method returns a TabletPropertyMetrics object for the requested property that is supported by the tablet.

Заметки

The properties for which you retrieve metrics may include the time that a packet was generated or the downward pressure of the pen tip on the tablet surface.

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

This function can be re-entered if 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 example reports on the property metrics of each supported property of the default Tablet object of the Tablets collection.

Public Function Report_PropertyMetrics_DefaultTablet() As String

    Dim SB As StringBuilder = New StringBuilder(1024)
    Dim defTablet As Tablet = New Tablets().DefaultTablet


    ' Report on each of the property metrics for the default tablet
    SB.AppendLine("Propert metrics of the default tablet: " + defTablet.Name)
    SB.Append(GetPropertyMetrics(defTablet, PacketProperty.AltitudeOrientation, "AltitudeOrientation"))
    SB.Append(GetPropertyMetrics(defTablet, PacketProperty.AzimuthOrientation, "AzimuthOrientation"))
    SB.Append(GetPropertyMetrics(defTablet, PacketProperty.ButtonPressure, "ButtonPressure"))
    SB.Append(GetPropertyMetrics(defTablet, PacketProperty.NormalPressure, "NormalPressure"))
    SB.Append(GetPropertyMetrics(defTablet, PacketProperty.PacketStatus, "PacketStatus"))
    SB.Append(GetPropertyMetrics(defTablet, PacketProperty.PitchRotation, "PitchRotation"))
    SB.Append(GetPropertyMetrics(defTablet, PacketProperty.RollRotation, "RollRotation"))
    SB.Append(GetPropertyMetrics(defTablet, PacketProperty.SerialNumber, "SerialNumber"))
    SB.Append(GetPropertyMetrics(defTablet, PacketProperty.TangentPressure, "TangentPressure"))
    SB.Append(GetPropertyMetrics(defTablet, PacketProperty.TimerTick, "TimerTick"))
    SB.Append(GetPropertyMetrics(defTablet, PacketProperty.TwistOrientation, "TwistOrientation"))
    SB.Append(GetPropertyMetrics(defTablet, PacketProperty.X, "X"))
    SB.Append(GetPropertyMetrics(defTablet, PacketProperty.XTiltOrientation, "XTiltOrientation"))
    SB.Append(GetPropertyMetrics(defTablet, PacketProperty.Y, "Y"))
    SB.Append(GetPropertyMetrics(defTablet, PacketProperty.YawRotation, "YawRotation"))
    SB.Append(GetPropertyMetrics(defTablet, PacketProperty.YTiltOrientation, "YTiltOrientation"))
    SB.Append(GetPropertyMetrics(defTablet, PacketProperty.Z, "Z"))

    Return SB.ToString()

End Function


Public Function GetPropertyMetrics( _
    ByVal theTablet As Tablet, _
    ByVal PropertyID As Guid, _
    ByVal PropertyName As String) As String

    Dim SB As StringBuilder = New StringBuilder(1024)

    ' If this particular property is supported,
    ' report the name and property metrics information.
    If theTablet.IsPacketPropertySupported(PropertyID) Then
        SB.AppendLine(PropertyName)
        Dim theMetrics As TabletPropertyMetrics = theTablet.GetPropertyMetrics(PropertyID)
        SB.AppendLine(" Max: " + theMetrics.Maximum.ToString())
        SB.AppendLine(" Min: " + theMetrics.Minimum.ToString())
        SB.AppendLine(" Resolution: " + theMetrics.Resolution.ToString())
        SB.AppendLine(" Units: " + theMetrics.Units.ToString())

    Else
        SB.AppendLine(PropertyName + " [not supported]")
    End If

    Return SB.ToString()
End Function
public string Report_PropertyMetrics_DefaultTablet()
{
    StringBuilder SB = new StringBuilder(1024);
    Tablet defTablet = new Tablets().DefaultTablet;

    // Report on each of the property metrics for the default tablet
    SB.AppendLine("Propert metrics of the default tablet: " + defTablet.Name);
    SB.Append( GetPropertyMetrics(defTablet, PacketProperty.AltitudeOrientation, "AltitudeOrientation"));
    SB.Append( GetPropertyMetrics(defTablet, PacketProperty.AzimuthOrientation, "AzimuthOrientation"));
    SB.Append( GetPropertyMetrics(defTablet, PacketProperty.ButtonPressure, "ButtonPressure"));
    SB.Append( GetPropertyMetrics(defTablet, PacketProperty.NormalPressure, "NormalPressure"));
    SB.Append( GetPropertyMetrics(defTablet, PacketProperty.PacketStatus, "PacketStatus"));
    SB.Append( GetPropertyMetrics(defTablet, PacketProperty.PitchRotation, "PitchRotation"));
    SB.Append( GetPropertyMetrics(defTablet, PacketProperty.RollRotation, "RollRotation"));
    SB.Append( GetPropertyMetrics(defTablet, PacketProperty.SerialNumber, "SerialNumber"));
    SB.Append( GetPropertyMetrics(defTablet, PacketProperty.TangentPressure, "TangentPressure"));
    SB.Append( GetPropertyMetrics(defTablet, PacketProperty.TimerTick, "TimerTick"));
    SB.Append( GetPropertyMetrics(defTablet, PacketProperty.TwistOrientation, "TwistOrientation"));
    SB.Append( GetPropertyMetrics(defTablet, PacketProperty.X, "X"));
    SB.Append( GetPropertyMetrics(defTablet, PacketProperty.XTiltOrientation, "XTiltOrientation"));
    SB.Append( GetPropertyMetrics(defTablet, PacketProperty.Y, "Y"));
    SB.Append( GetPropertyMetrics(defTablet, PacketProperty.YawRotation, "YawRotation"));
    SB.Append( GetPropertyMetrics(defTablet, PacketProperty.YTiltOrientation, "YTiltOrientation"));
    SB.Append( GetPropertyMetrics(defTablet, PacketProperty.Z, "Z"));

    return SB.ToString();
}


public string GetPropertyMetrics(Tablet theTablet, Guid PropertyID, string PropertyName)
{
    StringBuilder SB = new StringBuilder(1024);

    // If this particular property is supported,
    // report the name and property metrics information.
    if (theTablet.IsPacketPropertySupported(PropertyID))
    {
        SB.AppendLine(PropertyName);
        TabletPropertyMetrics theMetrics = theTablet.GetPropertyMetrics(PropertyID);
        SB.AppendLine(" Max: " + theMetrics.Maximum.ToString());
        SB.AppendLine(" Min: " + theMetrics.Minimum.ToString());
        SB.AppendLine(" Resolution: " + theMetrics.Resolution.ToString());
        SB.AppendLine(" Units: " + theMetrics.Units.ToString());
    }
    else
    {
        SB.AppendLine(PropertyName + " [not supported]");
    }

    return SB.ToString();
}

Платформы

Windows Vista

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

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

.NET Framework

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

См. также

Ссылки

Tablet Класс

Tablet - члены

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

TabletPropertyMetricUnit

Stroke.GetPacketValuesByProperty

Stroke.SetPacketValuesByProperty

Stroke.GetPacketDescriptionPropertyMetrics