IncrementalStrokeHitTester Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
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
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. |