RawStylusInput.StylusDeviceId Eigenschaft
Definition
Wichtig
Einige Informationen beziehen sich auf Vorabversionen, die vor dem Release ggf. grundlegend überarbeitet werden. Microsoft übernimmt hinsichtlich der hier bereitgestellten Informationen keine Gewährleistungen, seien sie ausdrücklich oder konkludent.
Ruft den Bezeichner des aktuellen Tablettstiftgeräts ab.
public:
property int StylusDeviceId { int get(); };
public int StylusDeviceId { get; }
member this.StylusDeviceId : int
Public ReadOnly Property StylusDeviceId As Integer
Eigenschaftswert
Der Bezeichner des aktuellen StylusDevice.
Beispiele
Im folgenden Beispiel wird sichergestellt, dass die gesammelten Eingabestiftpunkte aus demselben StylusDevicestammen. Dieses Beispiel ist Teil des größeren Beispiels in der RawStylusInput Klassenübersicht.
// Collect the points as the user draws the stroke.
protected override void OnStylusDown(RawStylusInput rawStylusInput)
{
// If points is not null, there is already a stroke taking place
// on the digitizer, so don't create a new StylusPointsCollection.
if (points == null)
{
points = new StylusPointCollection(rawStylusInput.GetStylusPoints().Description);
points.Add(rawStylusInput.GetStylusPoints());
currentStylus = rawStylusInput.StylusDeviceId;
}
}
// Collect the points as the user draws the stroke.
protected override void OnStylusMove(RawStylusInput rawStylusInput)
{
// Check whether the stylus that started the stroke is the same, and
// that the element hasn't lost focus since the stroke began.
if (points != null && currentStylus == rawStylusInput.StylusDeviceId)
{
points.Add(rawStylusInput.GetStylusPoints());
}
}
// Collect the points as the user draws the stroke.
protected override void OnStylusUp(RawStylusInput rawStylusInput)
{
// Check whether the stylus that started the stroke is the same, and
// that the element hasn't lost focus since the stroke began.
if (points != null && currentStylus == rawStylusInput.StylusDeviceId)
{
points.Add(rawStylusInput.GetStylusPoints());
// Subscribe to the OnStylusUpProcessed method.
rawStylusInput.NotifyWhenProcessed(points);
}
points = null;
currentStylus = 0;
}
' Collect the points as the user draws the stroke.
Protected Overrides Sub OnStylusDown(ByVal rawStylusInput As RawStylusInput)
' If points is not null, there is already a stroke taking place
' on the digitizer, so don't create a new StylusPointsCollection.
If points Is Nothing Then
points = New StylusPointCollection(rawStylusInput.GetStylusPoints().Description)
points.Add(rawStylusInput.GetStylusPoints())
currentStylus = rawStylusInput.StylusDeviceId
End If
End Sub
' Collect the points as the user draws the stroke.
Protected Overrides Sub OnStylusMove(ByVal rawStylusInput As RawStylusInput)
' Check whether the stylus that started the stroke is the same, and
' that the element hasn't lost focus since the stroke began.
If Not (points Is Nothing) AndAlso currentStylus = rawStylusInput.StylusDeviceId Then
points.Add(rawStylusInput.GetStylusPoints())
End If
End Sub
' Collect the points as the user draws the stroke.
Protected Overrides Sub OnStylusUp(ByVal rawStylusInput As RawStylusInput)
' Check whether the stylus that started the stroke is the same, and
' that the element hasn't lost focus since the stroke began.
If Not (points Is Nothing) AndAlso currentStylus = rawStylusInput.StylusDeviceId Then
points.Add(rawStylusInput.GetStylusPoints())
' Subscribe to the OnStylusUpProcessed method.
rawStylusInput.NotifyWhenProcessed(points)
End If
points = Nothing
currentStylus = 0
End Sub