Share via


StrokeCollection.GetIncrementalStrokeHitTester(StylusShape) Metodo

Definizione

Crea un oggetto IncrementalStrokeHitTester che sottopone StrokeCollection a hit testing con un tracciato di cancellazione.

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

Parametri

eraserShape
StylusShape

StylusShape, che specifica la punta dello stilo.

Restituisce

IncrementalStrokeHitTester

Oggetto IncrementalStrokeHitTester che sottopone l'insieme StrokeCollection a hit testing.

Esempio

Nell'esempio seguente viene illustrato come ottenere un oggetto IncrementalStrokeHitTester che può essere usato per cancellare parte di un oggetto Stroke. Per creare un controllo che consente a un utente di cancellare l'input penna, vedere Procedura: Cancellare l'input penna in un controllo personalizzato.

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

Commenti

Il GetIncrementalStrokeHitTester metodo restituisce un IncrementalStrokeHitTester oggetto che considera un oggetto Stroke "hit" quando il percorso della gomma lo interseca. Ciò è utile per l'implementazione di funzionalità, ad esempio la possibilità di cancellare parte di un oggetto Stroke. InkCanvas usa un oggetto IncrementalStrokeHitTester quando la EditingMode proprietà è impostata su EraseByPoint.

Si applica a