StylusPointDescription.HasProperty(StylusPointProperty) Método

Definição

Retorna um valor que indica se o StylusPointDescription atual tem a propriedade especificada.Returns a value that indicates whether the current StylusPointDescription has the specified property.

public:
 bool HasProperty(System::Windows::Input::StylusPointProperty ^ stylusPointProperty);
public bool HasProperty (System.Windows.Input.StylusPointProperty stylusPointProperty);
member this.HasProperty : System.Windows.Input.StylusPointProperty -> bool

Parâmetros

stylusPointProperty
StylusPointProperty

O StylusPointProperty a ser verificado no StylusPointDescription.The StylusPointProperty to check for in the StylusPointDescription.

Retornos

true se o StylusPointDescription tiver o StylusPointProperty especificado; caso contrário, false.true if the StylusPointDescription has the specified StylusPointProperty; otherwise, false.

Exemplos

O exemplo a seguir demonstra como obter as informações sobre uma propriedade de um StylusPointDescription.The following example demonstrates how to get the information about a property from a StylusPointDescription. Este exemplo pressupõe que o StylusMove evento foi conectado ao manipulador de eventos.This example assumes that the StylusMove event has been connected to the event handler.

void inkCanvas1_StylusMove(object sender, StylusEventArgs e)
{
    StylusPointCollection points = e.GetStylusPoints(inkCanvas1);
    StylusPointDescription description = points.Description;
    StringWriter normalPressureInfo = new StringWriter();

    if (description.HasProperty(StylusPointProperties.NormalPressure))
    {
        StylusPointPropertyInfo propertyInfo = 
            description.GetPropertyInfo(StylusPointProperties.NormalPressure);

        normalPressureInfo.WriteLine("  Guid = {0}", propertyInfo.Id.ToString());
        normalPressureInfo.Write("  Min = {0}", propertyInfo.Minimum.ToString());
        normalPressureInfo.Write("  Max = {0}", propertyInfo.Maximum.ToString());
        normalPressureInfo.Write("  Unit = {0}", propertyInfo.Unit.ToString());
        normalPressureInfo.WriteLine("  Res = {0}", propertyInfo.Resolution.ToString());
    }
}
Private Sub inkCanvas1_StylusMove(ByVal sender As Object, ByVal e As StylusEventArgs)
    Dim points As StylusPointCollection = e.GetStylusPoints(inkCanvas1)
    Dim description As StylusPointDescription = points.Description
    Dim normalPressureInfo As New StringWriter()

    If description.HasProperty(StylusPointProperties.NormalPressure) Then

        Dim propertyInfo As StylusPointPropertyInfo = _
            description.GetPropertyInfo(StylusPointProperties.NormalPressure)

        normalPressureInfo.WriteLine("  Guid = {0}", propertyInfo.Id.ToString())
        normalPressureInfo.Write("  Min = {0}", propertyInfo.Minimum.ToString())
        normalPressureInfo.Write("  Max = {0}", propertyInfo.Maximum.ToString())
        normalPressureInfo.Write("  Unit = {0}", propertyInfo.Unit.ToString())
        normalPressureInfo.WriteLine("  Res = {0}", propertyInfo.Resolution.ToString())
    End If

End Sub

Aplica-se a