StylusPoint Struktur

Definisi

Mewakili satu titik data yang dikumpulkan dari digitizer dan stylus.

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)
Warisan
StylusPoint
Penerapan

Contoh

Contoh berikut mendapatkan nama dan nilai properti untuk masing-masing StylusPoint dalam StylusPointCollection. Contoh ini mengasumsikan bahwa ada yang TextBlock disebut packetOutput.

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

Keterangan

mengumpulkan StylusPoint data saat pengguna memasukkan tinta menggunakan digitizer. Karena informasi yang dilaporkan digitizer berbeda tergantung pada produsen, properti dalam StylusPoint dapat bervariasi. Untuk menentukan apakah properti berada di StylusPoint, panggil HasProperty metode . Properti Description berisi StylusPointDescription yang menentukan properti mana yang berada di StylusPoint. Semua StylusPoint objek berisi properti yang menentukan koordinat (x, y), serta tekanan.

Konstruktor

StylusPoint(Double, Double)

Menginisialisasi instans StylusPoint baru kelas menggunakan koordinat (x, y) yang ditentukan.

StylusPoint(Double, Double, Single)

Menginisialisasi instans StylusPoint baru kelas menggunakan koordinat dan tekanan yang ditentukan (x, y).

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

Menginisialisasi instans StylusPoint baru kelas menggunakan koordinat (x, y) tertentu, pressureFactorparameter , dan tambahan yang ditentukan dalam StylusPointDescription.

Bidang

MaxXY

Menentukan nilai valid terbesar untuk sepasang koordinat (x, y).

MinXY

Menentukan nilai terkecil yang valid untuk sepasang koordinat (x, y).

Properti

Description

Mendapatkan atau mengatur StylusPointDescription yang menentukan properti yang disimpan di StylusPoint.

PressureFactor

Mendapatkan atau menetapkan nilai antara 0 dan 1 yang mencerminkan jumlah tekanan yang diterapkan stylus ke permukaan digitizer saat StylusPoint dibuat.

X

Mendapatkan atau menetapkan nilai untuk koordinat x dari StylusPoint.

Y

Mendapatkan atau mengatur koordinat y dari StylusPoint.

Metode

Equals(Object)

Mengembalikan nilai yang menunjukkan apakah objek yang ditentukan sama dengan StylusPoint.

Equals(StylusPoint)

Mengembalikan nilai Boolean yang menunjukkan apakah yang ditentukan StylusPoint sama dengan saat ini StylusPoint.

Equals(StylusPoint, StylusPoint)

Mengembalikan nilai Boolean yang menunjukkan apakah dua objek yang ditentukan StylusPoint sama.

GetHashCode()

Mengembalikan kode hash untuk instans ini.

GetPropertyValue(StylusPointProperty)

Mengembalikan nilai properti yang ditentukan.

HasProperty(StylusPointProperty)

Mengembalikan apakah saat ini StylusPoint berisi properti yang ditentukan.

SetPropertyValue(StylusPointProperty, Int32)

Mengatur properti yang ditentukan ke nilai yang ditentukan.

ToPoint()

Mengonversi menjadi StylusPointPoint.

Operator

Equality(StylusPoint, StylusPoint)

Membandingkan dua objek yang ditentukan StylusPoint dan menentukan apakah objek tersebut sama.

Explicit(StylusPoint to Point)

Mentransmisikan yang ditentukan StylusPoint ke Point.

Inequality(StylusPoint, StylusPoint)

Mengembalikan nilai Boolean yang menunjukkan apakah objek yang ditentukan StylusPoint tidak sama.

Berlaku untuk