Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

在Windows Phone7应用程序中检测和处理多点触摸事件

From Wiki
Jump to: navigation, search
WP Metro Icon UI.png
SignpostIcon WP7 70px.png
Article Metadata

兼容于
文章
翻译:
最后由 hamishwillee 在 16 Jul 2013 编辑

简介

在这篇文章中,我们将使用多点触摸功能在Windows Phone 7上开发一个非常简单的应用程序

源代码

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using System.Windows.Navigation;
 
namespace Multtouch
{
public partial class MainPage : PhoneApplicationPage
{
// Constructor
public MainPage()
{
InitializeComponent();
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
Touch.FrameReported += Touch_FrameReported;//touch/multi-touch event.
 
}
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();
MessageBox.Show(numPoints.ToString());
}
}
}
This page was last modified on 16 July 2013, at 07:07.
67 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×