wp8和wp7之间的触摸坐标值不同

wp8和wp7之间的触摸坐标值不同

本文介绍了wp8和wp7之间的触摸坐标值不同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我为WP 7.5开发了一个应用程序,我使用了一个带有XNA和应用程序栏的页面。对于新版本的WP,我在触摸坐标方面遇到了一些问题。例如,对于以下代码:

I developed an application for WP 7.5, and I used a page with XNA and application bar. For the new version of WP, I'm having some problems with touch coordinates. For example for the follow code:

(肖像模式)

Windows Phone 7.5

Windows Phone 7.5

var touches = TouchPanel.GetState();

var touches = TouchPanel.GetState();

var tempA = touches [0] .Position.X;

var tempA = touches[0].Position.X;

var tempB =  touches [0] .Position

var tempB = touches[0].Position

tempA = 400

tempA = 400

tempB = 699

tempB = 699

Windows Phone 8

Windows Phone 8

var touches = TouchPanel.GetState();

var touches = TouchPanel.GetState();

var tempA = touches [0] .Position.X;

var tempA = touches[0].Position.X;

var tempB =  touches [0] .Position

var tempB = touches[0].Position

推荐答案

如果您还没有我建议您查看此内容:

If you haven't already I recommend reviewing this:

然后检查实际的高度和宽度;例如,根网格元素的宽度和高度。将这些测量值用作触摸范围。

Then obtain the actual height and width by inspecting the actual width and height of the root grid element for example. Use those measurements as the touch range.

从理论上讲,它可以适应所有形状因素。

In theory, this way it accommodates all the form factors.

希望这会有所帮助,

Mark

Hope this helps,
Mark


这篇关于wp8和wp7之间的触摸坐标值不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-06 04:38