HitTest Method (Stroke)
Returns true if the StylusPointCollection passed intersects the Stroke object; otherwise, false.
XAML |
Cannot use methods in XAML.
|
Scripting |
retval = object.HitTest(stylusPoints)
|
Parameters
stylusPoints |
The collection of stylus points used to check for intersection with the Stroke object. |
Return Value
true if the StylusPointCollection passed intersects the Stroke object; otherwise, false
Remarks
You could hit test with arbitrary stylus point values rather than with user-generated strokes, if you first generated a StylusPointCollection with those values.
Examples
JavaScript |
---|
// Add the new points to the Stroke we're working with or // change the color of intersected strokes if the stylus is inverted. function InkPresenterMouseMove(sender,args) { if (args.GetStylusInfo().IsInverted) { // Change the color of intersected strokes // to red to indicate they are selected for (var i = 0; i < inkPresenter.Strokes.Count; i++) { var hitStroke = inkPresenter.Strokes.GetItem(i); if (hitStroke.HitTest(args.GetStylusPoints(inkPresenter))) { hitStroke.DrawingAttributes.SetValue("Color", "Red"); } } } else if (newStroke != null) { // Add points to the stroke we're currently creating newStroke.StylusPoints.AddStylusPoints(args.GetStylusPoints(inkPresenter)); } } |