共用方式為


StrokeCollection.GetIncrementalStrokeHitTester(StylusShape) 方法

定義

建立使用清除路徑點擊測試 IncrementalStrokeHitTesterStrokeCollection

public:
 System::Windows::Ink::IncrementalStrokeHitTester ^ GetIncrementalStrokeHitTester(System::Windows::Ink::StylusShape ^ eraserShape);
public System.Windows.Ink.IncrementalStrokeHitTester GetIncrementalStrokeHitTester (System.Windows.Ink.StylusShape eraserShape);
member this.GetIncrementalStrokeHitTester : System.Windows.Ink.StylusShape -> System.Windows.Ink.IncrementalStrokeHitTester
Public Function GetIncrementalStrokeHitTester (eraserShape As StylusShape) As IncrementalStrokeHitTester

參數

eraserShape
StylusShape

指定手寫筆筆尖的 StylusShape

傳回

點擊測試 IncrementalStrokeHitTesterStrokeCollection

範例

下列範例示範如何取得 IncrementalStrokeHitTester 可用來清除 部分 的 Stroke 。 若要建立可讓使用者清除筆跡的控制項,請參閱 How to: Erase Ink on a Custom Control

// Prepare to collect stylus packets. Get the 
// IncrementalHitTester from the InkPresenter's 
// StrokeCollection and subscribe to its StrokeHitChanged event.
protected override void OnStylusDown(StylusDownEventArgs e)
{
    base.OnStylusDown(e);

    EllipseStylusShape eraserTip = new EllipseStylusShape(3, 3, 0);
    eraseTester = 
        presenter.Strokes.GetIncrementalStrokeHitTester(eraserTip);
    eraseTester.StrokeHit += new StrokeHitEventHandler(eraseTester_StrokeHit);
    eraseTester.AddPoints(e.GetStylusPoints(this));
}
' Prepare to collect stylus packets. Get the 
' IncrementalHitTester from the InkPresenter's 
' StrokeCollection and subscribe to its StrokeHitChanged event.
Protected Overrides Sub OnStylusDown(ByVal e As StylusDownEventArgs)

    MyBase.OnStylusDown(e)

    Dim eraserTip As New EllipseStylusShape(3, 3, 0)
    eraseTester = presenter.Strokes.GetIncrementalStrokeHitTester(eraserTip)
    AddHandler eraseTester.StrokeHit, _
        AddressOf eraseTester_StrokeHit
    eraseTester.AddPoints(e.GetStylusPoints(Me))

End Sub

備註

方法 GetIncrementalStrokeHitTesterIncrementalStrokeHitTester 傳回 ,當橡皮擦路徑與清除路徑交集時,會將 視為 Stroke 「點擊」。 這適用于實作功能,例如清除 部分 Stroke 的功能。 當 InkCanvas 屬性設定為 EraseByPoint 時, EditingMode 會使用 IncrementalStrokeHitTester

適用於