共用方式為


DynamicRenderer.Reset(StylusDevice, StylusPointCollection) 方法

定義

清除目前筆劃的呈現並重新繪製。

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) 方法。

適用於