问题描述
在Windows Phone 8(在Lumia 920上测试)中,我使用System.Windows.Input。 Touch.FrameReported事件处理触摸事件。当用户用单个手指触摸屏幕时,事件被提升。完善。但是,当用户用
两个手指同时触摸屏幕时,该事件根本不会被提升。完全没有。 如果用户错开了他们的两次触摸(不同时但几乎同时),则会引发事件并在单个事件中报告两个点。
In Windows Phone 8 (testing on a Lumia 920) I use the System.Windows.Input.Touch.FrameReported event to handle touch events. When the user touches the screen with a single finger the event is raised. Perfect. However, when the user touches the screen with two fingers at EXACTLY the same time, the event is not raised at all. Not at all. If the user staggers their two touches (not simultaneous but almost simultaneous) the event is raised and both points are reported in the single event.
问题显然是同时接触是"丢失"。
The problem, obviously, is that the simultaneous touches are "lost".
如何检测到两个(或更多)同时接触?
Jerry Nixon
Jerry Nixon
推荐答案
void Touch_FrameReported(object sender, TouchFrameEventArgs e)
{
TouchPointCollection points = e.GetTouchPoints(this);
int numPoints =(from p in points where p.Action != TouchAction.Up select p).Count();
//Show numbers of touches, simultaneously too
MessageBox.Show(numPoints.ToString());
}
希望有所帮助。
这篇关于检测多个同时触摸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!