本文整理匯總了C#中System.Windows.Ink.IncrementalHitTester.AddPoint方法的典型用法代碼示例。如果您正苦於以下問題:C# IncrementalHitTester.AddPoint方法的具體用法?C# IncrementalHitTester.AddPoint怎麽用?C# IncrementalHitTester.AddPoint使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Windows.Ink.IncrementalHitTester
的用法示例。
在下文中一共展示了IncrementalHitTester.AddPoint方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: OnMouseLeftButtonDown
protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
{
base.OnMouseLeftButtonDown(e);
if (e.StylusDevice != null)
{
return;
}
EllipseStylusShape eraserTip = new EllipseStylusShape(3, 3, 0);
eraseTester =
presenter.Strokes.GetIncrementalStrokeHitTester(eraserTip);
eraseTester.StrokeHit += new StrokeHitEventHandler(eraseTester_StrokeHit);
eraseTester.AddPoint(e.GetPosition(this));
}
protected override void OnMouseMove(MouseEventArgs e)
{
base.OnMouseMove(e);
if (e.StylusDevice != null || eraseTester == null)
{
return;
}
if (eraseTester.IsValid)
{
eraseTester.AddPoint(e.GetPosition(this));
}
}
protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e)
{
base.OnMouseLeftButtonUp(e);
if (e.StylusDevice != null)
{
return;
}
eraseTester.AddPoint(e.GetPosition(this));
eraseTester.StrokeHit -= new
StrokeHitEventHandler(eraseTester_StrokeHit);
eraseTester.EndHitTesting();
}
示例2: eraseTester_StrokeHit
// 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);
}
}