Auf Englisch lesen

Freigeben über


StylusPointProperty Klasse

Definition

Stellt eine in einem StylusPoint gespeicherte Eigenschaft dar.

C#
public class StylusPointProperty
Vererbung
StylusPointProperty
Abgeleitet

Beispiele

Im folgenden Beispiel wird das StylusPointDescription -Objekt aus einem StylusPointCollection erstellt und die Informationen für jede StylusPointPropertyInfo in abgerufen 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";
}

Hinweise

A StylusPointProperty stellt Eigenschaften in StylusPoint dar, z. B. die Koordinaten (x, y), Druck usw. Sie können von der -Klasse erben StylusPointProperty , um die für jede Eigenschaft gespeicherten Informationen anzupassen. Das Windows Presentation Framework wird mit der -Klasse geliefert, die StylusPointPropertyInfo von StylusPointProperty erbt und die minimalen und maximalen Werte, die Auflösung und die Einheit angibt, die für jede Eigenschaft verwendet werden.

Konstruktoren

StylusPointProperty(Guid, Boolean)

Initialisiert eine neue Instanz der StylusPointProperty-Klasse mit der angegebenen GUID.

StylusPointProperty(StylusPointProperty)

Initialisiert eine neue Instanz der StylusPointProperty-Klasse, indem der angegebene StylusPointProperty-Wert kopiert wird.

Eigenschaften

Id

Ruft die GUID für die aktuelle StylusPointProperty ab.

IsButton

Ruft ab, ob die StylusPointProperty eine Schaltfläche des Tablettstifts darstellt.

Methoden

Equals(Object)

Bestimmt, ob das angegebene Objekt gleich dem aktuellen Objekt ist.

(Geerbt von Object)
GetHashCode()

Fungiert als Standardhashfunktion.

(Geerbt von Object)
GetType()

Ruft den Type der aktuellen Instanz ab.

(Geerbt von Object)
MemberwiseClone()

Erstellt eine flache Kopie des aktuellen Object.

(Geerbt von Object)
ToString()

Gibt eine Zeichenfolge zurück, die das aktuelle Objekt darstellt.

Gilt für:

Produkt Versionen
.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