StylusPointPropertyInfo 類別

定義

指定 StylusPoint 中屬性的條件約束 (Constraint)。

public ref class StylusPointPropertyInfo : System::Windows::Input::StylusPointProperty
public class StylusPointPropertyInfo : System.Windows.Input.StylusPointProperty
type StylusPointPropertyInfo = class
    inherit StylusPointProperty
Public Class StylusPointPropertyInfo
Inherits StylusPointProperty
繼承
StylusPointPropertyInfo

範例

下列範例會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

備註

類別StylusPointPropertyInfo繼承自 StylusPointProperty 類別,併產生MaximumMinimum、、 ResolutionUnit 值,用來定義 的屬性StylusPoint。 每個屬性值的有效性會根據數位板和手寫筆的製造而有所不同。

建構函式

StylusPointPropertyInfo(StylusPointProperty)

初始化 StylusPointPropertyInfo 類別的新執行個體。

StylusPointPropertyInfo(StylusPointProperty, Int32, Int32, StylusPointPropertyUnit, Single)

使用指定的值,初始化 StylusPointPropertyInfo 類別的新執行個體。

屬性

Id

取得目前 StylusPointProperty 的 GUID。

(繼承來源 StylusPointProperty)
IsButton

取得 StylusPointProperty 是否表示手寫筆上的按鈕。

(繼承來源 StylusPointProperty)
Maximum

取得 StylusPoint 屬性接受的最大值。

Minimum

取得 StylusPoint 屬性接受的最小值。

Resolution

取得將 StylusPoint 屬性值轉換為單位的縮放。

Unit

取得 StylusPoint 屬性所使用的度量型別。

方法

Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetHashCode()

做為預設雜湊函式。

(繼承來源 Object)
GetType()

取得目前執行個體的 Type

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。

(繼承來源 Object)
ToString()

傳回代表目前物件的字串。

(繼承來源 StylusPointProperty)

適用於