IncrementalStrokeHitTester IncrementalStrokeHitTester IncrementalStrokeHitTester IncrementalStrokeHitTester Class

Definition

Dynamically hit tests a stroke with an eraser path.

public ref class IncrementalStrokeHitTester : System::Windows::Ink::IncrementalHitTester
public class IncrementalStrokeHitTester : System.Windows.Ink.IncrementalHitTester
type IncrementalStrokeHitTester = class
    inherit IncrementalHitTester
Public Class IncrementalStrokeHitTester
Inherits IncrementalHitTester
Inheritance
IncrementalStrokeHitTesterIncrementalStrokeHitTesterIncrementalStrokeHitTesterIncrementalStrokeHitTester

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.

// 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);
    }

    
}
' 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.
Private Sub eraseTester_StrokeHit(ByVal sender As Object, _
        ByVal args As StrokeHitEventArgs)

    Dim eraseResult As StrokeCollection = _
        args.GetPointEraseResults()
    Dim strokesToReplace As New StrokeCollection()
    strokesToReplace.Add(args.HitStroke)

    ' Replace the old stroke with the new one.
    If eraseResult.Count > 0 Then
        presenter.Strokes.Replace(strokesToReplace, eraseResult)
    Else
        presenter.Strokes.Remove(strokesToReplace)
    End If

End Sub 'eraseTester_StrokeHit 

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.

Methods

AddPoint(Point) AddPoint(Point) AddPoint(Point) AddPoint(Point)

Adds a Point to the IncrementalHitTester.

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

Adds points to the IncrementalHitTester.

(Inherited from IncrementalHitTester)
AddPoints(StylusPointCollection) AddPoints(StylusPointCollection) AddPoints(StylusPointCollection) AddPoints(StylusPointCollection)

Adds the specified StylusPoint objects to the IncrementalHitTester.

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

Adds points to the IncrementalHitTester.

EndHitTesting() EndHitTesting() EndHitTesting() EndHitTesting()

Releases resources used by the IncrementalHitTester.

(Inherited from IncrementalHitTester)
Equals(Object) Equals(Object) Equals(Object) Equals(Object)

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

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
OnStrokeHit(StrokeHitEventArgs) OnStrokeHit(StrokeHitEventArgs) OnStrokeHit(StrokeHitEventArgs) OnStrokeHit(StrokeHitEventArgs)

Raises the StrokeHit event.

ToString() ToString() ToString() ToString()

Returns a string that represents the current object.

(Inherited from Object)

Events

StrokeHit StrokeHit StrokeHit StrokeHit

Occurs when the IncrementalStrokeHitTester intersects an ink Stroke.

Properties

IsValid IsValid IsValid IsValid

Gets whether the IncrementalHitTester is hit testing.

(Inherited from IncrementalHitTester)

Applies to