StylusPointDescription Classe

Définition

Spécifie les propriétés qui se trouvent dans un StylusPoint.

public ref class StylusPointDescription
public class StylusPointDescription
type StylusPointDescription = class
Public Class StylusPointDescription
Héritage
StylusPointDescription

Exemples

L’exemple suivant obtient la StylusPointDescription valeur d’un StylusPointCollection et obtient les informations de chacun StylusPointPropertyInfo dans le StylusPointDescription.

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();
}
Private Sub WriteDescriptionInfo(ByVal points As StylusPointCollection) 

    Dim pointsDescription As StylusPointDescription = points.Description

    Dim properties As ReadOnlyCollection(Of StylusPointPropertyInfo) = _
        pointsDescription.GetStylusPointProperties()

    Dim descriptionStringWriter As New StringWriter
    descriptionStringWriter.Write("Property Count:{0}", pointsDescription.PropertyCount.ToString())
    
    Dim pointProperty As StylusPointPropertyInfo
    For Each pointProperty In properties

        ' GetStylusPointPropertyName is defined below and returns the
        ' name of the property.
        descriptionStringWriter.Write("name = {0}", GetStylusPointPropertyName(pointProperty).ToString())
        descriptionStringWriter.WriteLine("  Guid = {0}", pointProperty.Id.ToString())
        descriptionStringWriter.Write("  IsButton = {0}", pointProperty.IsButton.ToString())
        descriptionStringWriter.Write("  Min = {0}", pointProperty.Minimum.ToString())
        descriptionStringWriter.Write("  Max = {0}", pointProperty.Maximum.ToString())
        descriptionStringWriter.Write("  Unit = {0}", pointProperty.Unit.ToString())
        descriptionStringWriter.WriteLine("  Res {0}", pointProperty.Resolution.ToString())

    Next pointProperty

    descriptionOutput.Text = descriptionStringWriter.ToString()

End Sub
// 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";
}
' Use reflection to get the name of currentProperty.
Private Function GetStylusPointPropertyName(ByVal currentProperty As StylusPointProperty) As String 
    Dim guid As Guid = currentProperty.Id
    
    ' Iterate through the StylusPointProperties to find the StylusPointProperty
    ' that matches currentProperty, then return the name.
    Dim theFieldInfo As FieldInfo

    For Each theFieldInfo In GetType(StylusPointProperties).GetFields()

        Dim pointProperty As StylusPointProperty = _
            CType(theFieldInfo.GetValue(currentProperty), StylusPointProperty)

        If pointProperty.Id = guid Then
            Return theFieldInfo.Name
        End If

    Next theFieldInfo

    Return "Not found"

End Function 'GetStylusPointPropertyName

Remarques

Spécifie StylusPointDescription les propriétés associées à un StylusPoint. Pour chaque propriété d’un StylusPoint, contient StylusPointDescription un StylusPointPropertyInfo objet qui spécifie des contraintes telles que les valeurs minimales et maximales de la propriété. Utilisez les méthodes et GetPropertyInfo les HasProperty méthodes pour rechercher ces propriétés dans le StylusPointDescription.

Tous les StylusPoint objets d’un StylusPointCollection doit partager le même StylusPointDescription. Si vous essayez d’ajouter un StylusPoint à un StylusPointCollection autre qui a une autre StylusPointDescriptionexception, une exception est levée.

Constructeurs

Nom Description
StylusPointDescription()

Initialise une nouvelle instance de la classe StylusPointDescription.

StylusPointDescription(IEnumerable<StylusPointPropertyInfo>)

Initialise une nouvelle instance de la StylusPointDescription classe avec les objets spécifiés StylusPointPropertyInfo .

Propriétés

Nom Description
PropertyCount

Obtient le nombre de propriétés dans le StylusPointDescription.

Méthodes

Nom Description
AreCompatible(StylusPointDescription, StylusPointDescription)

Retourne une valeur qui indique si les objets spécifiés sont identiques StylusPointDescription .

Equals(Object)

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

(Hérité de Object)
GetCommonDescription(StylusPointDescription, StylusPointDescription)

Retourne l’intersection des objets spécifiés StylusPointDescription .

GetHashCode()

Sert de fonction de hachage par défaut.

(Hérité de Object)
GetPropertyInfo(StylusPointProperty)

Obtient la StylusPointPropertyInfo propriété spécifiée.

GetStylusPointProperties()

Obtient toutes les propriétés du StylusPointDescription.

GetType()

Obtient la Type de l’instance actuelle.

(Hérité de Object)
HasProperty(StylusPointProperty)

Retourne une valeur qui indique si le courant StylusPointDescription a la propriété spécifiée.

IsSubsetOf(StylusPointDescription)

Retourne une valeur qui indique si le courant StylusPointDescription est un sous-ensemble du fichier spécifié StylusPointDescription.

MemberwiseClone()

Crée une copie superficielle du Objectactuel.

(Hérité de Object)
ToString()

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

(Hérité de Object)

S’applique à