WEB开发网
开发学院手机开发Windows Mobile 开发 Windows Mobile 6.5 Gesture API 介绍 阅读

Windows Mobile 6.5 Gesture API 介绍

 2010-06-01 22:53:00 来源:WEB开发网   
核心提示:gestureRecognizer1.Hold += new EventHandler(gestureRecognizer1_Hold);gestureRecognizer1.Select += new EventHandler(gestureRecognizer1_Select);gestureRecognizer1

gestureRecognizer1.Hold += new EventHandler(gestureRecognizer1_Hold);

gestureRecognizer1.Select += new EventHandler(gestureRecognizer1_Select);

gestureRecognizer1.DoubleSelect += new EventHandler(gestureRecognizer1_DoubleSelect);

gestureRecognizer1.Pan += new EventHandler(gestureRecognizer1_Pan);

gestureRecognizer1.Scroll += new EventHandler(gestureRecognizer1_Scroll);

}

void gestureRecognizer1_Scroll(object sender, GestureScrollEventArgs e)

{

label1.Text = e.Kind.ToString() + ": " + e.State + ", (" + e.X + ", " + e.Y + "), d=" + e.ScrollDirection + ", a=" + e.Angle + ", v=" + e.Velocity;

}

void gestureRecognizer1_Pan(object sender, GestureEventArgs e)

{

label1.Text = e.Kind.ToString() + ": " + e.State + ", (" + e.X + ", " + e.Y + ")";

}

void gestureRecognizer1_DoubleSelect(object sender, GestureEventArgs e)

{

label1.Text = e.Kind.ToString() + ": " + e.State + ", (" + e.X + ", " + e.Y + ")";

}

void gestureRecognizer1_Select(object sender, GestureEventArgs e)

{

label1.Text = e.Kind.ToString() + ": " + e.State + ", (" + e.X + ", " + e.Y + ")";

}

void gestureRecognizer1_Hold(object sender, GestureEventArgs e)

{

label1.Text = e.Kind.ToString() + ": " + e.State + ", (" + e.X + ", " + e.Y + ")";

}

该示例代码是在窗体上放了两个控件: Panel1用来捕获手势事件;label1用来显示当前手势的一些参数。 运行状况如下图所示:

Windows Mobile 6.5 Gesture API 1

最后一部分,是demo程序的源代码:GestureDemo2.zip (58.05 kb)

看到了吧,在Windows Mobile 6.5中,我们要给我们的程序加上手势的支持是如此的简单方便。好了,本小节就到这里,在下一节中我们将讨论手势和动画。

上一页  1 2 3 4 5  下一页

Tags:Windows Mobile Gesture

编辑录入:coldstar [复制链接] [打 印]
赞助商链接