英語で読む

次の方法で共有


StylusPoint 構造体

定義

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

C#
public struct StylusPoint : IEquatable<System.Windows.Input.StylusPoint>
継承
StylusPoint
実装

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

C#
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();
}
C#
// 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";
}

注釈

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 オブジェクトが等しいかどうかを示すブール値を返します。

適用対象

製品 バージョン
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9