StylusPoint StylusPoint StylusPoint StylusPoint Struct

Definição

Representa um único ponto de dados coletado do digitalizador e da caneta.Represents a single data point collected from the digitizer and 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)
Herança
StylusPointStylusPointStylusPointStylusPoint
Implementações

Exemplos

O exemplo a seguir obtém nomes de propriedade e valores StylusPoint para cada StylusPointCollectionum em um.The following example gets property names and values for each StylusPoint in a StylusPointCollection. Este exemplo pressupõe que haja uma TextBlock chamada. packetOutputThis example assumes that there is a TextBlock called 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

Comentários

Um StylusPoint coleta dados quando um usuário insere tinta usando o digitalizador.A StylusPoint collects data when a user inputs ink using the digitizer. Como as informações que um digitalizador relata diferem dependendo do fabricante, as propriedades dentro de um StylusPoint podem variar.Because the information that a digitizer reports differs depending on the manufacturer, the properties within a StylusPoint can vary. Para determinar se uma propriedade está no StylusPoint, chame o HasProperty método.To determine whether a property is in the StylusPoint, call the HasProperty method. A Description propriedade contém um StylusPointDescription que especifica StylusPointquais propriedades estão no.The Description property contains a StylusPointDescription that specifies which properties are in the StylusPoint. Todos StylusPoint os objetos contêm propriedades que especificam as coordenadas (x, y), bem como a pressão.All StylusPoint objects contain properties that specify the (x, y) coordinates, as well as the pressure.

Construtores

StylusPoint(Double, Double) StylusPoint(Double, Double) StylusPoint(Double, Double) StylusPoint(Double, Double)

Inicializa uma nova instância da classe StylusPoint usando as coordenadas especificadas (x, y).Initializes a new instance of the StylusPoint class using specified (x, y) coordinates.

StylusPoint(Double, Double, Single) StylusPoint(Double, Double, Single) StylusPoint(Double, Double, Single) StylusPoint(Double, Double, Single)

Inicializa uma nova instância da classe StylusPoint usando as coordenadas (x, y) e a pressão especificadas.Initializes a new instance of the StylusPoint class using specified (x, y) coordinates and pressure.

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

Inicializa uma nova instância da classe StylusPoint usando as coordenadas especificadas (x, y), um pressureFactor e parâmetros adicionais especificados na StylusPointDescription.Initializes a new instance of the StylusPoint class using specified (x, y) coordinates, a pressureFactor, and additional parameters specified in the StylusPointDescription.

Campos

MaxXY MaxXY MaxXY MaxXY

Especifica o maior valor válido para um par de coordenadas (x, y).Specifies the largest valid value for a pair of (x, y) coordinates.

MinXY MinXY MinXY MinXY

Especifica o menor valor válido para um par de coordenadas (x, y).Specifies the smallest valid value for a pair of (x, y) coordinates.

Propriedades

Description Description Description Description

Obtém ou define a StylusPointDescription que especifica as propriedades armazenadas no StylusPoint.Gets or sets the StylusPointDescription that specifies the properties stored in the StylusPoint.

PressureFactor PressureFactor PressureFactor PressureFactor

Obtém ou define um valor entre 0 e 1 que reflete a quantidade de pressão que a caneta aplica à superfície do digitalizador quando o StylusPoint é criado.Gets or sets a value between 0 and 1 that reflects the amount of pressure the stylus applies to the digitizer's surface when the StylusPoint is created.

X X X X

Obtém ou define o valor da coordenada x do StylusPoint.Gets or sets the value for the x-coordinate of the StylusPoint.

Y Y Y Y

Obtém ou define a coordenada y do StylusPoint.Gets or sets the y-coordinate of the StylusPoint.

Métodos

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

Retorna um valor que indica se o objeto especificado é igual ao StylusPoint.Returns a value indicating whether the specified object is equal to the StylusPoint.

Equals(StylusPoint) Equals(StylusPoint) Equals(StylusPoint) Equals(StylusPoint)

Retorna um valor booliano que indica se o StylusPoint especificado é igual ao StylusPoint atual.Returns a Boolean value that indicates whether the specified StylusPoint is equal to the current StylusPoint.

Equals(StylusPoint, StylusPoint) Equals(StylusPoint, StylusPoint) Equals(StylusPoint, StylusPoint) Equals(StylusPoint, StylusPoint)

Retorna um valor booliano que indica se os dois objetos StylusPoint especificados são iguais.Returns a Boolean value that indicates whether the two specified StylusPoint objects are equal.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Retorna o código hash para essa instância.Returns the hash code for this instance.

GetPropertyValue(StylusPointProperty) GetPropertyValue(StylusPointProperty) GetPropertyValue(StylusPointProperty) GetPropertyValue(StylusPointProperty)

Retorna o valor da propriedade especificada.Returns the value of the specified property.

HasProperty(StylusPointProperty) HasProperty(StylusPointProperty) HasProperty(StylusPointProperty) HasProperty(StylusPointProperty)

Retorna se o StylusPoint atual contém a propriedade especificada.Returns whether the current StylusPoint contains the specified property.

SetPropertyValue(StylusPointProperty, Int32) SetPropertyValue(StylusPointProperty, Int32) SetPropertyValue(StylusPointProperty, Int32) SetPropertyValue(StylusPointProperty, Int32)

Define a propriedade especificada com o valor especificado.Sets the specified property to the specified value.

ToPoint() ToPoint() ToPoint() ToPoint()

Converte uma StylusPoint em uma Point.Converts a StylusPoint to a Point.

Operadores

Equality(StylusPoint, StylusPoint) Equality(StylusPoint, StylusPoint) Equality(StylusPoint, StylusPoint) Equality(StylusPoint, StylusPoint)

Compara dois objetos StylusPoint especificados e determina se eles são iguais.Compares two specified StylusPoint objects and determines whether they are equal.

Explicit(StylusPoint to Point) Explicit(StylusPoint to Point) Explicit(StylusPoint to Point) Explicit(StylusPoint to Point)

Converte o StylusPoint especificado em um Point.Casts the specified StylusPoint to a Point.

Inequality(StylusPoint, StylusPoint) Inequality(StylusPoint, StylusPoint) Inequality(StylusPoint, StylusPoint) Inequality(StylusPoint, StylusPoint)

Retorna um valor booliano que indica se os objetos StylusPoint especificados são diferentes.Returns a Boolean value which indicates whether the specified StylusPoint objects are unequal.

Aplica-se a