Export (0) Print
Expand All

StrokeCollection.GetIncrementalStrokeHitTester Method

Creates an IncrementalStrokeHitTester that hit tests the StrokeCollection with an erasing path.

Namespace:  System.Windows.Ink
Assembly:  PresentationCore (in PresentationCore.dll)

public IncrementalStrokeHitTester GetIncrementalStrokeHitTester(
	StylusShape eraserShape
)

Parameters

eraserShape
Type: System.Windows.Ink.StylusShape

A StylusShape that specifies the tip of the stylus.

The GetIncrementalStrokeHitTester method returns an IncrementalStrokeHitTester that considers a Stroke to be "hit" when the eraser path intersects it. This is useful for implementing features, such as the ability to erase part of a Stroke. The InkCanvas uses an IncrementalStrokeHitTester when the EditingMode property is set to EraseByPoint.

The following example demonstrates how to get an IncrementalStrokeHitTester that can be used to erase part of a Stroke. To create a control that enables a user to erase ink, see 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));

}

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft