StylusPoint Yapı
Tanım
Çizim tablasının ve ekran kaleminden toplanan tek bir veri noktasını temsil eder.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)
- Devralma
- Uygulamalar
Örnekler
Aşağıdaki örnek, her bir için özellik adlarını ve değerlerini alır StylusPoint StylusPointCollection .The following example gets property names and values for each StylusPoint in a StylusPointCollection. Bu örnek, aranan olduğunu varsayar TextBlock packetOutput
.This 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
Açıklamalar
Bir StylusPoint Kullanıcı, çizim tablası kullanarak mürekkep girişi yaparken, verileri toplar.A StylusPoint collects data when a user inputs ink using the digitizer. Bir çizim tablası raporlarının, üreticiye bağlı olarak farklı olduğu için, bir içindeki Özellikler StylusPoint farklılık gösterebilir.Because the information that a digitizer reports differs depending on the manufacturer, the properties within a StylusPoint can vary. Bir özelliğin içinde olup olmadığını anlamak için StylusPoint HasProperty yöntemini çağırın.To determine whether a property is in the StylusPoint, call the HasProperty method. DescriptionÖzelliği StylusPointDescription , içinde hangi özelliklerin olduğunu belirten bir içerir StylusPoint .The Description property contains a StylusPointDescription that specifies which properties are in the StylusPoint. Tüm StylusPoint nesneler (x, y) koordinatlarını ve basınç ' ı belirten özellikler içerir.All StylusPoint objects contain properties that specify the (x, y) coordinates, as well as the pressure.
Oluşturucular
StylusPoint(Double, Double) |
StylusPointBelirtilen (x, y) koordinatlarını kullanarak sınıfın yeni bir örneğini başlatır.Initializes a new instance of the StylusPoint class using specified (x, y) coordinates. |
StylusPoint(Double, Double, Single) |
StylusPointBelirtilen (x, y) koordinatları ve basınç kullanarak sınıfının yeni bir örneğini başlatır.Initializes a new instance of the StylusPoint class using specified (x, y) coordinates and pressure. |
StylusPoint(Double, Double, Single, StylusPointDescription, Int32[]) |
StylusPointBelirtilen (x, y) koordinatları, a |
Alanlar
MaxXY |
Bir çift (x, y) koordinat için en büyük geçerli değeri belirtir.Specifies the largest valid value for a pair of (x, y) coordinates. |
MinXY |
Bir çift (x, y) koordinat için geçerli en küçük değeri belirtir.Specifies the smallest valid value for a pair of (x, y) coordinates. |
Özellikler
Description |
StylusPointDescriptionİçinde depolanan özellikleri belirten öğesini alır veya ayarlar StylusPoint .Gets or sets the StylusPointDescription that specifies the properties stored in the StylusPoint. |
PressureFactor |
0 ile 1 arasında bir değer alır veya ayarlar, ekran kalemi, oluşturulduğunda çizim tablası yüzeyi için geçerli olan basınç miktarını yansıtır StylusPoint .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 koordinatı için değeri alır veya ayarlar StylusPoint .Gets or sets the value for the x-coordinate of the StylusPoint. |
Y |
Öğesinin y koordinatını alır veya ayarlar StylusPoint .Gets or sets the y-coordinate of the StylusPoint. |
Yöntemler
Equals(Object) |
Belirtilen nesnenin öğesine eşit olup olmadığını gösteren bir değer döndürür StylusPoint .Returns a value indicating whether the specified object is equal to the StylusPoint. |
Equals(StylusPoint) |
Belirtilen değerin geçerli değere eşit olup olmadığını gösteren bir Boole değeri döndürür StylusPoint StylusPoint .Returns a Boolean value that indicates whether the specified StylusPoint is equal to the current StylusPoint. |
Equals(StylusPoint, StylusPoint) |
Belirtilen iki nesnenin eşit olup olmadığını gösteren bir Boole değeri döndürür StylusPoint .Returns a Boolean value that indicates whether the two specified StylusPoint objects are equal. |
GetHashCode() |
Bu örneğe ilişkin karma kodu döndürür.Returns the hash code for this instance. |
GetPropertyValue(StylusPointProperty) |
Belirtilen özelliğin değerini döndürür.Returns the value of the specified property. |
HasProperty(StylusPointProperty) |
Geçerli StylusPoint özelliğin belirtilen özelliği içerip içermediğini döndürür.Returns whether the current StylusPoint contains the specified property. |
SetPropertyValue(StylusPointProperty, Int32) |
Belirtilen özelliği belirtilen değere ayarlar.Sets the specified property to the specified value. |
ToPoint() |
Bir StylusPoint öğesine dönüştürür Point .Converts a StylusPoint to a Point. |
İşleçler
Equality(StylusPoint, StylusPoint) |
Belirtilen iki StylusPoint nesneyi karşılaştırır ve eşit olup olmadığını belirler.Compares two specified StylusPoint objects and determines whether they are equal. |
Explicit(StylusPoint to Point) |
Belirtilen öğesine yayınlar StylusPoint Point .Casts the specified StylusPoint to a Point. |
Inequality(StylusPoint, StylusPoint) |
Belirtilen nesnelerin eşit olup olmadığını gösteren bir Boole değeri döndürür StylusPoint .Returns a Boolean value which indicates whether the specified StylusPoint objects are unequal. |