DynamicRenderer.Reset(StylusDevice, StylusPointCollection) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
清除當前筆劃的渲染並重新繪製。
public:
virtual void Reset(System::Windows::Input::StylusDevice ^ stylusDevice, System::Windows::Input::StylusPointCollection ^ stylusPoints);
public virtual void Reset(System.Windows.Input.StylusDevice stylusDevice, System.Windows.Input.StylusPointCollection stylusPoints);
abstract member Reset : System.Windows.Input.StylusDevice * System.Windows.Input.StylusPointCollection -> unit
override this.Reset : System.Windows.Input.StylusDevice * System.Windows.Input.StylusPointCollection -> unit
Public Overridable Sub Reset (stylusDevice As StylusDevice, stylusPoints As StylusPointCollection)
參數
- stylusDevice
- StylusDevice
目前的觸控筆裝置。
- stylusPoints
- StylusPointCollection
觸控筆指向要重新繪製。
例外狀況
觸控筆和滑鼠都沒有處於下墜狀態。
範例
以下範例在繪製時會改變當前筆劃的顏色。
bool selectionMode = false;
public void ToggleSelect()
{
StylusDevice currentStylus = Stylus.CurrentStylusDevice;
// Check if the stylus is down or the mouse is pressed.
if (Mouse.LeftButton != MouseButtonState.Pressed &&
(currentStylus == null || currentStylus.InAir))
{
return;
}
selectionMode = !selectionMode;
// If the control is in selection mode, change the color of
// the current stroke dark gray.
if (selectionMode)
{
dynamicRenderer1.DrawingAttributes.Color = Colors.DarkGray;
}
else
{
dynamicRenderer1.DrawingAttributes.Color = Colors.Purple;
}
dynamicRenderer1.Reset(currentStylus, stylusPoints);
}
Private selectionMode As Boolean = False
Public Sub ToggleSelect()
Dim currentStylus As StylusDevice = Stylus.CurrentStylusDevice
' Check if the stylus is down or the mouse is pressed.
If Mouse.LeftButton <> MouseButtonState.Pressed AndAlso _
(currentStylus Is Nothing OrElse currentStylus.InAir) Then
Return
End If
selectionMode = Not selectionMode
' If the control is in selection mode, change the color of
' the current stroke dark gray.
If selectionMode Then
dynamicRenderer1.DrawingAttributes.Color = Colors.DarkGray
Else
dynamicRenderer1.DrawingAttributes.Color = Colors.Purple
End If
dynamicRenderer1.Reset(currentStylus, stylusPoints)
End Sub
備註
它 DynamicRenderer 會重新繪製當前筆劃以及任何輸入 Reset 方法的觸控筆點。 這種方法允許你在使用者仍在創作筆劃時重新繪製筆劃。 繪圖板筆必須觸碰數位筆,或在呼叫時 Reset 按下左鍵。
給繼承者的注意事項
在導出類別中覆 Reset(StylusDevice, StylusPointCollection) 寫時,務必呼叫基底類別的方法 Reset(StylusDevice, StylusPointCollection) 。