我有一个登录应用程序,它有一个swipe系统,人们只有在有触摸屏的时候才能使用。他们可以通过刷他们的个人模式刷码登录。
是否可以在C#或WPF中检查用户是否有触摸屏?即使他当时没有在上面使用触摸?
发布于 2011-06-15 11:49:38
在C#代码中,通过PresentationCore中的using System.Windows.Input名称空间来检查触摸屏是否存在(但不检查它是单点触控设备还是多点触控设备)。
public bool HasTouchInput()
{
foreach (TabletDevice tabletDevice in Tablet.TabletDevices)
{
//Only detect if it is a touch Screen not how many touches (i.e. Single touch or Multi-touch)
if(tabletDevice.Type == TabletDeviceType.Touch)
return true;
}
return false;
}发布于 2011-04-15 15:26:38
我不认为托管代码中有任何可用的东西,但您可以在Win32_DesktopMonitor上使用P/Invoke。有关详细信息,请参阅msdn。
我发现这个博客帖子可能会有帮助,即使它是在Windows CE上:http://blog.nerdbank.net/2006/10/platform-detection-iii-how-to-detect.html
发布于 2012-07-03 19:27:11
在Windows XP Tablet PC Edition或用于非IInkTablet2应用程序的托管包装Microsoft.Ink.Tablet类中有WPF接口。但大多数触摸屏驱动程序都是“鼠标”驱动程序,不能以这种方式被检测到。
https://stackoverflow.com/questions/5673556
复制相似问题