StylusPointDescription 类

定义

指定 StylusPoint 中的属性。

public ref class StylusPointDescription
public class StylusPointDescription
type StylusPointDescription = class
Public Class StylusPointDescription
继承
StylusPointDescription

示例

以下示例获取 StylusPointDescription 的 ,StylusPointCollection并获取 中StylusPointDescription每个StylusPointPropertyInfo的信息。

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

注解

指定 StylusPointDescription 与 关联的 StylusPoint属性。 对于 中的每个 StylusPoint属性,都包含 StylusPointDescription 一个 StylusPointPropertyInfo 对象,该对象指定属性的最小值和最大值等约束。 HasProperty使用 和 GetPropertyInfo 方法为 中的StylusPointDescription这些属性检查。

中的所有StylusPointStylusPointCollection对象必须共享同一个 StylusPointDescription。 如果尝试将 添加到StylusPointStylusPointCollection具有不同 StylusPointDescription的 ,则会引发异常。

构造函数

StylusPointDescription()

初始化 StylusPointDescription 类的新实例。

StylusPointDescription(IEnumerable<StylusPointPropertyInfo>)

使用指定的 StylusPointDescription 对象初始化 StylusPointPropertyInfo 类的新实例。

属性

PropertyCount

获取 StylusPointDescription 中属性的数目。

方法

AreCompatible(StylusPointDescription, StylusPointDescription)

返回一个值,该值指示指定的 StylusPointDescription 对象是否相同。

Equals(Object)

确定指定对象是否等于当前对象。

(继承自 Object)
GetCommonDescription(StylusPointDescription, StylusPointDescription)

返回指定的 StylusPointDescription 对象的交集。

GetHashCode()

作为默认哈希函数。

(继承自 Object)
GetPropertyInfo(StylusPointProperty)

获取指定属性的 StylusPointPropertyInfo

GetStylusPointProperties()

获取 StylusPointDescription 的所有属性。

GetType()

获取当前实例的 Type

(继承自 Object)
HasProperty(StylusPointProperty)

返回一个指示当前 StylusPointDescription 是否具有指定属性的值。

IsSubsetOf(StylusPointDescription)

返回一个值,该值指示当前 StylusPointDescription 是否为指定 StylusPointDescription 的子集。

MemberwiseClone()

创建当前 Object 的浅表副本。

(继承自 Object)
ToString()

返回表示当前对象的字符串。

(继承自 Object)

适用于