Lire en anglais

Partager via


StylusPointProperty Classe

Définition

Représente une propriété stockée dans un StylusPoint.

C#
public class StylusPointProperty
Héritage
StylusPointProperty
Dérivé

Exemples

L’exemple suivant crée l’objet StylusPointDescription à partir d’un StylusPointCollection et obtient les informations pour chaque StylusPointPropertyInfo dans le StylusPointDescription.

C#
private void WriteDescriptionInfo(StylusPointCollection points)
{
    StylusPointDescription pointsDescription = points.Description;
    ReadOnlyCollection<StylusPointPropertyInfo> properties = 
        pointsDescription.GetStylusPointProperties();

    StringWriter descriptionStringWriter = new StringWriter();
    descriptionStringWriter.Write("Property Count:{0}", pointsDescription.PropertyCount.ToString());
    
    foreach (StylusPointPropertyInfo property in properties)
    {
        // GetStylusPointPropertyName is defined below and returns the
        // name of the property.
        descriptionStringWriter.Write("name = {0}", GetStylusPointPropertyName(property).ToString());
        descriptionStringWriter.WriteLine("  Guid = {0}", property.Id.ToString());
        descriptionStringWriter.Write("  IsButton = {0}", property.IsButton.ToString());
        descriptionStringWriter.Write("  Min = {0}", property.Minimum.ToString());
        descriptionStringWriter.Write("  Max = {0}", property.Maximum.ToString());
        descriptionStringWriter.Write("  Unit = {0}", property.Unit.ToString());
        descriptionStringWriter.WriteLine("  Res {0}", property.Resolution.ToString());
    }

    descriptionOutput.Text = descriptionStringWriter.ToString();
}
C#
// Use reflection to get the name of currentProperty.
private string GetStylusPointPropertyName(StylusPointProperty currentProperty)
{
    Guid guid = currentProperty.Id;

    // Iterate through the StylusPointProperties to find the StylusPointProperty
    // that matches currentProperty, then return the name.
    foreach (FieldInfo theFieldInfo
        in typeof(StylusPointProperties).GetFields())
    {
        StylusPointProperty property = (StylusPointProperty) theFieldInfo.GetValue(currentProperty);
        if (property.Id == guid)
        {
            return theFieldInfo.Name;
        }
    }
    return "Not found";
}

Remarques

Un StylusPointProperty représente des propriétés dans StylusPoint telles que les coordonnées (x, y), la pression, etc. Vous pouvez hériter de la StylusPointProperty classe pour personnaliser les informations stockées pour chaque propriété. L’infrastructure de présentation Windows est fournie avec la StylusPointPropertyInfo classe qui hérite de StylusPointProperty et spécifie les valeurs minimales et maximales, la résolution et l’unité utilisées pour chaque propriété.

Constructeurs

StylusPointProperty(Guid, Boolean)

Initialise une nouvelle instance de la classe StylusPointProperty à l'aide du GUID spécifié.

StylusPointProperty(StylusPointProperty)

Initialise une nouvelle instance de la classe StylusPointProperty en copiant le StylusPointProperty spécifié.

Propriétés

Id

Obtient le GUID du StylusPointProperty en cours.

IsButton

Obtient si le StylusPointProperty représente un bouton sur le stylet.

Méthodes

Equals(Object)

Détermine si l'objet spécifié est égal à l'objet actuel.

(Hérité de Object)
GetHashCode()

Fait office de fonction de hachage par défaut.

(Hérité de Object)
GetType()

Obtient le Type de l'instance actuelle.

(Hérité de Object)
MemberwiseClone()

Crée une copie superficielle du Object actuel.

(Hérité de Object)
ToString()

Retourne une chaîne qui représente l'objet actuel.

S’applique à

Produit Versions
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10