本文整理汇总了C#中System.Windows.Input.TouchFrameEventArgs.GetTouchPoints方法的典型用法代码示例。如果您正苦于以下问题:C# TouchFrameEventArgs.GetTouchPoints方法的具体用法?C# TouchFrameEventArgs.GetTouchPoints怎么用?C# TouchFrameEventArgs.GetTouchPoints使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Input.TouchFrameEventArgs
的用法示例。
在下文中一共展示了TouchFrameEventArgs.GetTouchPoints方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: foreach
foreach (TouchPoint _touchPoint in e.GetTouchPoints(this.canvas1))
{
if (_touchPoint.Action == TouchAction.Down)
{
// Clear the canvas and capture the touch to it.
this.canvas1.Children.Clear();
_touchPoint.TouchDevice.Capture(this.canvas1);
}
else if (_touchPoint.Action == TouchAction.Move && e.GetPrimaryTouchPoint(this.canvas1) != null)
{
// This is the first (primary) touch point. Just record its position.
if (_touchPoint.TouchDevice.Id == e.GetPrimaryTouchPoint(this.canvas1).TouchDevice.Id)
{
pt1.X = _touchPoint.Position.X;
pt1.Y = _touchPoint.Position.Y;
}
// This is not the first touch point. Draw a line from the first point to this one.
else if (_touchPoint.TouchDevice.Id != e.GetPrimaryTouchPoint(this.canvas1).TouchDevice.Id)
{
pt2.X = _touchPoint.Position.X;
pt2.Y = _touchPoint.Position.Y;
Line _line = new Line();
_line.Stroke = new RadialGradientBrush(Colors.White, Colors.Black);
_line.X1 = pt1.X;
_line.X2 = pt2.X;
_line.Y1 = pt1.Y;
_line.Y2 = pt2.Y;
_line.StrokeThickness = 2;
this.canvas1.Children.Add(_line);
}
}
else if (_touchPoint.Action == TouchAction.Up)
{
// If this touch is captured to the canvas, release it.
if (_touchPoint.TouchDevice.Captured == this.canvas1)
{
this.canvas1.ReleaseTouchCapture(_touchPoint.TouchDevice);
}
}
}