Condividi tramite


Metodo Tablet.GetPropertyMetrics

Aggiornamento: novembre 2007

Restituisce i dati di metrica per un oggetto PacketProperty noto.

Spazio dei nomi:  Microsoft.Ink
Assembly:  Microsoft.Ink (in Microsoft.Ink.dll)

Sintassi

'Dichiarazione
Public Function GetPropertyMetrics ( _
    id As Guid _
) As TabletPropertyMetrics
'Utilizzo
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

Parametri

Valore restituito

Tipo: Microsoft.Ink.TabletPropertyMetrics
Questo metodo restituisce un oggetto TabletPropertyMetrics per la proprietà richiesta supportata dalla tavoletta.

Note

Le proprietà per le quali si recupera la metrica possono includere l'ora in cui è stato generato un pacchetto o la pressione verso il basso della punta della penna sulla superficie della tavoletta.

Nota

Se chiamata all'interno di alcuni gestori di messaggi è possibile che questa funzione venga reimmessa, provocando risultati imprevisti. Prestare attenzione per evitare una chiamata rientrante durante la gestione di uno dei messaggi seguenti: WM_ACTIVATE, WM_ACTIVATEAPP, WM_NCACTIVATE, WM_PAINT, WM_SYSCOMMAND se il parametro wParam è impostato su SC_HOTKEY o SC_TASKLIST e WM_SYSKEYDOWN (durante l'elaborazione delle combinazioni di tasti ALT-TAB o ALT-ESC). Questo problema è relativo alle applicazioni con modello di apartment a thread singolo.

Esempi

In questo esempio viene segnalata la metrica di ogni proprietà supportata dell'oggetto Tablet predefinito dell'insieme 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();
}

Piattaforme

Windows Vista

.NET Framework e .NET Compact Framework non supportano tutte le versioni di ciascuna piattaforma. Per un elenco delle versioni supportate, vedere Requisiti di sistema di .NET Framework.

Informazioni sulla versione

.NET Framework

Supportato in: 3.0

Vedere anche

Riferimenti

Tablet Classe

Membri Tablet

Spazio dei nomi Microsoft.Ink

TabletPropertyMetricUnit

Stroke.GetPacketValuesByProperty

Stroke.SetPacketValuesByProperty

Stroke.GetPacketDescriptionPropertyMetrics