为什么我不能检测到触摸屏? [英] Why I can't detect touch screen?

查看:365
本文介绍了为什么我不能检测到触摸屏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用这个$ C $下检测C#的触摸屏(WPF)

 返回Tablet.TabletDevices.OfType< TabletDevice>。()任何(DEV => dev.Type == TabletDeviceType.Touch)
 

但它不能正常工作。 Tablet.TabletDevices计数始终为0。 而且我用的延伸触摸显示器(使用USB和AVG连接PC)

有没有更好的办法来检查当前电脑具有触摸屏或不?

感谢。

  

UPDATE1:

     

我不知道为什么,但即使我删除了触摸屏USB和显示器,   但 GetSystemMetrics的(SM_MAXIMUMTOUCHES)还是回到1。

     

UPDATE2:

     

看起来这不是工作,我的意思是使用:

 返回GetSystemMetrics的(SM_MAXIMUMTOUCHES)> 0
 

由于它总是返回1,即使我重启电脑(Win7操作系统,   笔记本电脑)

解决方案

我想<一href="http://stackoverflow.com/questions/5957751/is-there-a-way-to-programmatically-tell-if-a-system-is-touch-enabled">this和<一href="http://msdn.microsoft.com/en-us/library/windows/apps/windows.devices.input.touchcapabilities.touch$p$psent.aspx"相对=nofollow>这个会帮助你。

I'm use this code for detect touch screen on C#(wpf)

return Tablet.TabletDevices.OfType<TabletDevice>().Any(dev => dev.Type == TabletDeviceType.Touch)

But it can't work. Tablet.TabletDevices Count always be 0. and I'm use extension touch monitor(use USB and AVG connect PC)

Is there any better way to check current PC is has touch screen or not?

Thanks.

Update1:

I don't know why but even I'm remove the touch screen USB and monitor, but GetSystemMetrics(SM_MAXIMUMTOUCHES) still return 1.

Update2:

looks like that's not work, I mean use :

return GetSystemMetrics(SM_MAXIMUMTOUCHES) > 0

Because it's always return 1, even I'm restart computer(win7 OS, laptop computer)

解决方案

I guess this and this will help you.

这篇关于为什么我不能检测到触摸屏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆