共用方式為


StylusPointDescription 類別

定義

指定 StylusPoint 中的屬性。

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

範例

下列範例會取得 StylusPointDescriptionStylusPointCollection ,並取得 中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屬性,會StylusPointDescriptionStylusPointPropertyInfo包含 對象,這個物件會指定條件約束,例如屬性的最小值和最大值。 HasProperty使用和 GetPropertyInfo 方法來檢查 中的StylusPointDescription這些屬性。

StylusPoint中的所有StylusPointCollection物件都必須分享相同的 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)

適用於