Tablet.GetPropertyMetrics, méthode
Mise à jour : November 2007
Retourne les données de métrique pour un objet PacketProperty connu.
Espace de noms : Microsoft.Ink
Assembly : Microsoft.Ink (dans Microsoft.Ink.dll)
Syntaxe
'Déclaration
Public Function GetPropertyMetrics ( _
id As Guid _
) As TabletPropertyMetrics
'Utilisation
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
Paramètres
- id
Type : System.Guid
Identificateur Guid (page pouvant être en anglais) pour la PacketProperty que vous demandez.
Valeur de retour
Type : Microsoft.Ink.TabletPropertyMetrics
Cette méthode retourne un objet TabletPropertyMetrics pour la propriété demandée qui est prise en charge par le Tablet PC.
Notes
Les propriétés pour lesquelles vous récupérez des métriques peuvent inclure l'heure à laquelle un paquet a été généré ou la pression descendante de la pointe du stylet sur la surface de la tablette.
Remarque : |
---|
Cette fonction peut être exécutée à nouveau si elle est appelée dans certains gestionnaires de messages et provoquer des résultats inattendus. Prenez soin d'éviter un appel réentrant lors de la gestion de l'un des messages suivants : WM_ACTIVATE, WM_ACTIVATEAPP, WM_NCACTIVATE, WM_PAINT; WM_SYSCOMMAND si wParam a la valeur SC_HOTKEY ou SC_TASKLIST, et WM_SYSKEYDOWN (lors de l'utilisation des raccourcis clavier Alt+Tab ou Alt+Echap). Cette opération pose problème dans les applications de modèle de thread unique cloisonné. |
Exemples
Cet exemple établit un rapport sur les métriques de chaque propriété prise en charge de l'objet Tablet par défaut de la collection 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();
}
Plateformes
Windows Vista
Le .NET Framework et le .NET Compact Framework ne prennent pas en charge toutes les versions de chaque plateforme. Pour obtenir la liste des versions prises en charge, consultez Configuration requise du .NET Framework.
Informations de version
.NET Framework
Pris en charge dans : 3.0
Voir aussi
Référence
Stroke.GetPacketValuesByProperty