다음을 통해 공유


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
구현

예제

다음 예제에서는 각각에 StylusPointCollection대한 StylusPoint 속성 이름 및 값을 가져옵니다. 이 예제에서는 호출packetOutput이 있다고 가정합니다TextBlock.

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) 좌표를 지정하는 속성이 포함됩니다.

생성자

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

지정된 (x, y) 좌표, pressureFactor에 지정된 추가 매개 변수를 사용하여 클래스의 StylusPoint 새 인스턴스를 StylusPointDescription초기화합니다.

StylusPoint(Double, Double, Single)

지정된(x, y) 좌표 및 압력을 사용하여 클래스의 StylusPoint 새 인스턴스를 초기화합니다.

StylusPoint(Double, Double)

지정된(x, y) 좌표를 사용하여 클래스의 StylusPoint 새 인스턴스를 초기화합니다.

필드

Name Description
MaxXY

(x, y) 좌표 쌍에 대해 유효한 값 중 가장 큰 값을 지정합니다.

MinXY

(x, y) 좌표 쌍에 대해 유효한 가장 작은 값을 지정합니다.

속성

Name Description
Description

StylusPointDescription 저장된 StylusPoint속성을 지정하는 속성을 가져오거나 설정합니다.

PressureFactor

스타일러스가 생성될 때 StylusPoint 디지타이저의 표면에 적용되는 압력의 양을 반영하는 0에서 1 사이의 값을 가져오거나 설정합니다.

X

의 x 좌표 StylusPoint값을 가져오거나 설정합니다.

Y

의 y 좌표를 StylusPoint가져오거나 설정합니다.

메서드

Name Description
Equals(Object)

지정한 개체가 해당 개체와 같은 StylusPoint지 여부를 나타내는 값을 반환합니다.

Equals(StylusPoint, StylusPoint)

지정된 StylusPoint 두 개체가 같은지 여부를 나타내는 부울 값을 반환합니다.

Equals(StylusPoint)

지정된 StylusPoint 값이 현재 StylusPoint값과 같은지 여부를 나타내는 부울 값을 반환합니다.

GetHashCode()

이 인스턴스의 해시 코드를 반환합니다.

GetPropertyValue(StylusPointProperty)

지정된 속성의 값을 반환합니다.

HasProperty(StylusPointProperty)

현재 StylusPoint 에 지정된 속성이 포함되어 있는지 여부를 반환합니다.

SetPropertyValue(StylusPointProperty, Int32)

지정된 속성을 지정된 값으로 설정합니다.

ToPoint()

StylusPointPoint로 변환합니다.

연산자

Name Description
Equality(StylusPoint, StylusPoint)

지정된 StylusPoint 두 개체를 비교하고 같은지 여부를 확인합니다.

Explicit(StylusPoint to Point)

지정된 값을 .로 캐스팅 StylusPointPoint합니다.

Inequality(StylusPoint, StylusPoint)

지정된 StylusPoint 개체가 같지 않은지 여부를 나타내는 부울 값을 반환합니다.

적용 대상