我有一个登录应用程序,它有一个刷卡系统,人们只有在他们有触摸屏时才能使用。他们可以通过刷他们的个人模式刷卡代码登录。
如果用户有触摸屏,是否可以签入 C# 或 WPF?即使他当时没有使用触摸?
我有一个登录应用程序,它有一个刷卡系统,人们只有在他们有触摸屏时才能使用。他们可以通过刷他们的个人模式刷卡代码登录。
如果用户有触摸屏,是否可以签入 C# 或 WPF?即使他当时没有使用触摸?
在 C# 代码中System.Windows.Input通过PresentationCore.
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;
}
我认为托管代码中没有任何可用的东西,但您可以使用 P/Invoke on Win32_DesktopMonitor。有关详细信息,请参阅msdn。
我发现这篇博客文章即使在 Windows CE 上也可能会有所帮助:http: //blog.nerdbank.net/2006/10/platform-detection-iii-how-to-detect.html
Windows XP Tablet PC Edition 中有IInkTablet2 COM 接口或用于非 WPF 应用程序的托管包装Microsoft.Ink.Tablet类。但是大多数触摸屏驱动程序都是“鼠标”驱动程序,无法通过这种方式检测到。