Compartir a través de


Tablet.GetPropertyMetrics (Método)

Actualización: noviembre 2007

Devuelve los datos de las métricas de un objeto PacketProperty conocido.

Espacio de nombres:  Microsoft.Ink
Ensamblado:  Microsoft.Ink (en Microsoft.Ink.dll)

Sintaxis

'Declaración
Public Function GetPropertyMetrics ( _
    id As Guid _
) As TabletPropertyMetrics
'Uso
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

Parámetros

Valor devuelto

Tipo: Microsoft.Ink.TabletPropertyMetrics
Este método devuelve un objeto TabletPropertyMetrics de la propiedad solicitada que admite el Tablet PC.

Comentarios

Las propiedades para las que se recogen métricas pueden incluir la hora en que se generó un paquete o la presión de la punta de la pluma sobre la superficie del Tablet PC.

Nota

Esta función puede introducirse de nuevo si se llama en determinados controladores de mensajes, lo cual causa resultados inesperados. Procure evitar que se produzca una llamada reentrante al controlar alguno de los siguientes mensajes WM_ACTIVATE, WM_ACTIVATEAPP, WM_NCACTIVATE, WM_PAINT; WM_SYSCOMMAND si wParam se establece en SC_HOTKEY o SC_TASKLIST y WM_SYSKEYDOWN (al procesar las combinaciones de teclas Alt-Tab o Alt-Esc). Este problema se produce con las aplicaciones del modelo de subprocesamiento controlado simple.

Ejemplos

En este ejemplo se informa sobre las métricas de cada propiedad admitida del objeto Tablet predeterminado de la colección Tablets.

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();
}

Plataformas

Windows Vista

.NET Framework y .NET Compact Framework no admiten todas las versiones de cada plataforma. Para obtener una lista de las versiones compatibles, vea Requisitos de sistema de .NET Framework.

Información de versión

.NET Framework

Compatible con: 3.0

Vea también

Referencia

Tablet (Clase)

Tablet (Miembros)

Microsoft.Ink (Espacio de nombres)

TabletPropertyMetricUnit

Stroke.GetPacketValuesByProperty

Stroke.SetPacketValuesByProperty

Stroke.GetPacketDescriptionPropertyMetrics