IncrementalStrokeHitTester.StrokeHit Event
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.
Occurs when the IncrementalStrokeHitTester intersects an ink Stroke.
public:
event System::Windows::Ink::StrokeHitEventHandler ^ StrokeHit;
public event System.Windows.Ink.StrokeHitEventHandler StrokeHit;
member this.StrokeHit : System.Windows.Ink.StrokeHitEventHandler
Public Custom Event StrokeHit As StrokeHitEventHandler
Public Event StrokeHit As StrokeHitEventHandler
Event Type
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
Applies to
Sodelujte z nami v storitvi GitHub
Vir za to vsebino najdete v storitvi GitHub, kjer lahko tudi ustvarite in pregledate težave in zahtevke za uveljavitev sprememb. Če želite več informacij, glejte naš vodnik za sodelavce.