StylusPoint 構造体

定義

デジタイザーとスタイラスから収集された単一のデータ ポイントを表します。

public value class StylusPoint : IEquatable<System::Windows::Input::StylusPoint>
public struct StylusPoint : IEquatable<System.Windows.Input.StylusPoint>
type StylusPoint = struct
Public Structure StylusPoint
Implements IEquatable(Of StylusPoint)
継承
StylusPoint
実装

次の例では、 内の各 StylusPoint のプロパティ名と値を StylusPointCollection取得します。 この例では、 という名前packetOutputTextBlock があることを前提としています。

private void WriteStylusPointValues(StylusPointCollection points)
{
    StylusPointDescription pointsDescription = points.Description;

    ReadOnlyCollection<StylusPointPropertyInfo> properties = 
        pointsDescription.GetStylusPointProperties();
    
    // Write the name and value of each property in
    // every stylus point.
    StringWriter packetWriter = new StringWriter();
    packetWriter.WriteLine("{0} stylus points", points.Count.ToString());
    foreach (StylusPoint stylusPoint in points)
    {
        packetWriter.WriteLine("Stylus Point info");
        packetWriter.WriteLine("X: {0}", stylusPoint.X.ToString());
        packetWriter.WriteLine("Y: {0}", stylusPoint.Y.ToString());
        packetWriter.WriteLine("Pressure: {0}", stylusPoint.PressureFactor.ToString());

        // Get the property name and value for each StylusPoint.
        // Note that this loop reports the X, Y, and pressure values differantly than 
        // getting their values above.
        for (int i = 0; i < pointsDescription.PropertyCount; ++i)
        {
            StylusPointProperty currentProperty = properties[i];

            // GetStylusPointPropertyName is defined below and returns the
            // name of the property.
            packetWriter.Write("{0}: ", GetStylusPointPropertyName(currentProperty));
            packetWriter.WriteLine(stylusPoint.GetPropertyValue(currentProperty).ToString());
        }
        packetWriter.WriteLine();
    }

    packetOutput.Text = packetWriter.ToString();
}
Private Sub WriteStylusPointValues(ByVal points As StylusPointCollection) 
    Dim pointsDescription As StylusPointDescription = points.Description
    
    Dim properties As ReadOnlyCollection(Of StylusPointPropertyInfo) = _
                            pointsDescription.GetStylusPointProperties()
    
    ' Write the name and value of each property in
    ' every stylus point.
    Dim packetWriter As New StringWriter()

    packetWriter.WriteLine("{0} stylus points", points.Count.ToString())

    For Each stylusPoint As StylusPoint In points

        packetWriter.WriteLine("Stylus Point info")
        packetWriter.WriteLine("X: {0}", stylusPoint.X.ToString())
        packetWriter.WriteLine("Y: {0}", stylusPoint.Y.ToString())
        packetWriter.WriteLine("Pressure: {0}", stylusPoint.PressureFactor.ToString())

        ' Get the property name and value for each StylusPoint.
        ' Note that this loop reports the X, Y, and pressure values differantly than 
        ' getting their values above.
        For i As Integer = 0 To pointsDescription.PropertyCount - 1

            Dim currentProperty As StylusPointProperty = properties(i)

            ' GetStylusPointPropertyName is defined below and returns the
            ' name of the property.
            packetWriter.Write("{0}: ", GetStylusPointPropertyName(currentProperty))
            packetWriter.WriteLine(stylusPoint.GetPropertyValue(currentProperty).ToString())
        Next i

        packetWriter.WriteLine()

    Next stylusPoint

    packetOutput.Text = packetWriter.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

注釈

StylusPoint 、ユーザーがデジタイザーを使用してインクを入力したときにデータを収集します。 デジタイザーが報告する情報は製造元によって異なるため、 内 StylusPoint のプロパティは異なる場合があります。 プロパティが 内にあるかどうかを確認するには、 StylusPointメソッドを HasProperty 呼び出します。 プロパティには Description 、 内の StylusPointDescription プロパティを指定する が StylusPoint含まれています。 すべての StylusPoint オブジェクトには、(x、y) 座標と圧力を指定するプロパティが含まれています。

コンストラクター

StylusPoint(Double, Double)

指定した (x, y) 座標を使用して、StylusPoint クラスの新しいインスタンスを初期化します。

StylusPoint(Double, Double, Single)

指定した (x, y) 座標と圧力を使用して、StylusPoint クラスの新しいインスタンスを初期化します。

StylusPoint(Double, Double, Single, StylusPointDescription, Int32[])

指定された (x, y) 座標、pressureFactor、および StylusPointDescription で指定された追加のパラメーターを使用して、StylusPoint クラスの新しいインスタンスを初期化します。

フィールド

MaxXY

(x,y) 座標ペアに対して有効な最大値を指定します。

MinXY

(x,y) 座標ペアに対して有効な最小値を指定します。

プロパティ

Description

StylusPointDescription に格納するプロパティを指定する StylusPoint を取得または設定します。

PressureFactor

StylusPoint が作成されたときに、スタイラスがデジタイザーのサーフェイスに適用する圧力の量を表す 0 ~ 1 の値を取得または設定します。

X

StylusPoint の x 座標の値を取得または設定します。

Y

StylusPoint の y 座標を取得または設定します。

メソッド

Equals(Object)

指定したオブジェクトが、StylusPoint に等しいかどうかを示す値を返します。

Equals(StylusPoint)

指定した StylusPoint が現在の StylusPoint に等しいかどうかを示すブール値を返します。

Equals(StylusPoint, StylusPoint)

指定した 2 つの StylusPoint オブジェクトが等しいかどうかを示すブール値を返します。

GetHashCode()

このインスタンスのハッシュ コードを返します。

GetPropertyValue(StylusPointProperty)

指定したプロパティの値を返します。

HasProperty(StylusPointProperty)

現在の StylusPoint に指定したプロパティが含まれているかどうかを返します。

SetPropertyValue(StylusPointProperty, Int32)

指定したプロパティを指定した値に設定します。

ToPoint()

StylusPointPointに変換します。

演算子

Equality(StylusPoint, StylusPoint)

指定した 2 つの StylusPoint オブジェクトを比較し、それらが等しいかどうかを確認します。

Explicit(StylusPoint to Point)

指定した StylusPointPoint にキャストします。

Inequality(StylusPoint, StylusPoint)

指定した StylusPoint オブジェクトが等しいかどうかを示すブール値を返します。

適用対象