Edit

Share via


IncrementalStrokeHitTester Class

Definition

Dynamically hit tests a stroke with an eraser path.

C#
public class IncrementalStrokeHitTester : System.Windows.Ink.IncrementalHitTester
Inheritance
IncrementalStrokeHitTester

Examples

The following example demonstrates how to dynamically erase a portion of a Stroke. To create a control that enables a user to erase ink, see How to: Erase Ink on a Custom Control.

C#
// When the stylus intersects a stroke, erase that part of
// the stroke.  When the stylus dissects a stoke, the 
// Stroke.Erase method returns a StrokeCollection that contains
// the two new strokes.
void eraseTester_StrokeHit(object sender,
    StrokeHitEventArgs args)
{
    StrokeCollection eraseResult =
        args.GetPointEraseResults();
    StrokeCollection strokesToReplace = new StrokeCollection();
    strokesToReplace.Add(args.HitStroke);
   
    // Replace the old stroke with the new one.
    if (eraseResult.Count > 0)
    {
        presenter.Strokes.Replace(strokesToReplace, eraseResult);
    }
    else
    {
        presenter.Strokes.Remove(strokesToReplace);
    }
}

Remarks

The IncrementalStrokeHitTester hit tests strokes by determining when a eraser path intersects that stroke. Use the AddPoints method in the stylus events to add the points to the IncrementalStrokeHitTester. When the points added to the IncrementalStrokeHitTester intersect a Stroke, the IncrementalStrokeHitTester raises the StrokeHit event.

Properties

IsValid

Gets whether the IncrementalHitTester is hit testing.

(Inherited from IncrementalHitTester)

Methods

AddPoint(Point)

Adds a Point to the IncrementalHitTester.

(Inherited from IncrementalHitTester)
AddPoints(IEnumerable<Point>)

Adds points to the IncrementalHitTester.

(Inherited from IncrementalHitTester)
AddPoints(StylusPointCollection)

Adds the specified StylusPoint objects to the IncrementalHitTester.

(Inherited from IncrementalHitTester)
AddPointsCore(IEnumerable<Point>)

Adds points to the IncrementalHitTester.

EndHitTesting()

Releases resources used by the IncrementalHitTester.

(Inherited from IncrementalHitTester)
Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
OnStrokeHit(StrokeHitEventArgs)

Raises the StrokeHit event.

ToString()

Returns a string that represents the current object.

(Inherited from Object)

Events

StrokeHit

Occurs when the IncrementalStrokeHitTester intersects an ink Stroke.

Applies to

Product Versions
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10