我注意到Surface Pro和我相信索尼Vaio Duo 11报告的最大触摸坐标是1366x768,这对我来说是惊人的,因为它们的原生显示分辨率是1920x1080。 有谁知道在运行时找出最大触摸坐标是什么的方法?我在XAML下运行了一个DirectX应用程序,因此我必须将触摸坐标缩放到我自己的世界坐标中,如果不知道缩放因子是什么,我无法做到这一点。为什么Surface Pro上的最大X和Y触摸坐标不同于原生显示分辨率?
这是我参加竞选,看起来在触摸坐标代码:
从DirectXPage.xaml
<Grid PointerPressed="OnPointerPressed"></Grid>
从DirectXPage.xaml.cpp
void DirectXPage::OnPointerPressed(Platform::Object^ sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs^ args)
{
auto pointerPoint = args->GetCurrentPoint(nullptr);
// the x value ranges between 0 and 1366
auto x = pointerPoint->Position.X;
// the y value ranges between 0 and 768
auto y = pointerPoint->Position.Y;
}
而且,这里是一个示例项目设置,如果在Surface Pro上运行,可以演示此问题: http://andrewgarrison.com/files/TouchTester.zip
谢谢,那正是我正在寻找的。 – 2013-02-28 22:48:14