StylusPointDescription クラス

定義

StylusPoint内のプロパティを指定します。

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

次の例では、StylusPointDescriptionStylusPointCollectionを取得し、StylusPointPropertyInfo内の各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

注釈

StylusPointDescriptionは、StylusPointに関連付けられているプロパティを指定します。 StylusPointの各プロパティについて、StylusPointDescriptionには、プロパティの最小値や最大値などの制約を指定するStylusPointPropertyInfo オブジェクトが含まれています。 HasPropertyメソッドとGetPropertyInfoメソッドを使用して、StylusPointDescriptionでこれらのプロパティを確認します。

StylusPoint内のすべてのStylusPointCollection オブジェクトは、同じStylusPointDescriptionを共有する必要があります。 別のStylusPointを持つStylusPointCollectionStylusPointDescriptionを追加しようとすると、例外がスローされます。

コンストラクター

名前 説明
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)

適用対象