×
Namespaces

Variants
Actions
Revision as of 10:07, 16 July 2013 by hamishwillee (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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

From Nokia Developer 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 10:07.
76 page views in the last 30 days.
×