StylusPoint Struct
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Rappresenta un solo punto dati raccolto dal digitalizzatore e dallo stilo.
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)
- Ereditarietà
- Implementazioni
L'esempio seguente ottiene i nomi delle proprietà e i valori per ognuno StylusPoint in un StylusPointCollectionoggetto . In questo esempio si presuppone che sia presente un TextBlock oggetto denominato 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
Un StylusPoint oggetto raccoglie i dati quando un utente inserisce l'input penna usando il digitalizzatore. Poiché le informazioni che un digitalizzatore segnala differisce a seconda del produttore, le proprietà all'interno di un StylusPoint oggetto possono variare. Per determinare se una proprietà si trova nel StylusPointmetodo , chiamare il HasProperty metodo . La Description proprietà contiene un StylusPointDescription oggetto che specifica quali proprietà si trovano nell'oggetto StylusPoint. Tutti gli StylusPoint oggetti contengono proprietà che specificano le coordinate (x, y), nonché la pressione.
Stylus |
Inizializza una nuova istanza della classe StylusPoint usando le coordinate (x, y) specificate. |
Stylus |
Inizializza una nuova istanza della classe StylusPoint utilizzando le coordinate specificate (x, y) e la pressione. |
Stylus |
Inizializza una nuova istanza della classe StylusPoint usando le coordinate specificate (X, Y), un elemento |
MaxXY |
Specifica il valore maggiore valido per una coppia di coordinate (x, y). |
MinXY |
Specifica il valore minore valido per una coppia di coordinate (x, y). |
Description |
Ottiene o imposta l'oggetto StylusPointDescription che specifica le proprietà archiviate nell'oggetto StylusPoint. |
Pressure |
Ottiene o imposta un valore tra 0 e 1 che riflette la quantità di pressione che lo stilo applica alla superficie del digitalizzatore quando viene creato l'oggetto StylusPoint. |
X |
Ottiene o imposta il valore della coordinata X dell'oggetto StylusPoint. |
Y |
Ottiene o imposta la coordinata Y dell'oggetto StylusPoint. |
Equals(Object) |
Restituisce un valore che indica se l'oggetto specificato equivale all'oggetto StylusPoint. |
Equals(Stylus |
Restituisce un valore booleano che indica se l'oggetto StylusPoint equivale all'oggetto StylusPoint corrente. |
Equals(Stylus |
Restituisce un valore booleano che indica se i due oggetti StylusPoint specificati sono uguali. |
Get |
Restituisce il codice hash per l'istanza. |
Get |
Restituisce il valore della proprietà specificata. |
Has |
Restituisce se l'oggetto StylusPoint corrente contiene la proprietà specificata. |
Set |
Imposta la proprietà specificata sul valore specificato. |
To |
Converte StylusPoint in Point. |
Equality(Stylus |
Confronta due oggetti StylusPoint specificati per determinarne l'uguaglianza. |
Explicit(Stylus |
Esegue il cast dell'oggetto StylusPoint su un oggetto Point specificato. |
Inequality(Stylus |
Restituisce un valore booleano che indica se gli oggetti StylusPoint specificati non sono uguali. |
Prodotto | Versioni |
---|---|
.NET Framework | 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9 |
Feedback su .NET
.NET è un progetto di open source. Selezionare un collegamento per fornire feedback: