IncrementalStrokeHitTester.StrokeHit 事件
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
當 IncrementalStrokeHitTester 與筆墨 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
事件類型
範例
下列範例示範如何動態清除 的 Stroke 一部分。 若要建立可讓使用者清除筆跡的控制項,請參閱 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