StrokeCollection.GetIncrementalStrokeHitTester(StylusShape) 方法

定义

创建一个通过擦除路径对 IncrementalStrokeHitTester 进行命中测试的 StrokeCollection

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,用于指定触笔的笔尖。

返回

IncrementalStrokeHitTester 进行命中测试的 StrokeCollection

示例

以下示例演示如何获取 IncrementalStrokeHitTester 可用于擦除 部分 的 Stroke。 若要创建允许用户擦除墨迹的控件,请参阅 如何:擦除自定义控件上的墨迹

// 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

注解

方法 GetIncrementalStrokeHitTester 返回一个 , IncrementalStrokeHitTester 当橡皮擦路径与橡皮擦路径相交时,它会将其视为 Stroke “命中”。 这对于实现功能非常有用,例如擦除 部分的功能 StrokeInkCanvas当 属性设置为 EraseByPoint时, EditingMode 使用 IncrementalStrokeHitTester

适用于