12

我有一个登录应用程序,它有一个刷卡系统,人们只有在他们有触摸屏时才能使用。他们可以通过刷他们的个人模式刷卡代码登录。

如果用户有触摸屏,是否可以签入 C# 或 WPF?即使他当时没有使用触摸?

4

3 回答 3

21

在 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;
    }
于 2011-06-15T03:49:38.493 回答
1

我认为托管代码中没有任何可用的东西,但您可以使用 P/Invoke on Win32_DesktopMonitor。有关详细信息,请参阅msdn

我发现这篇博客文章即使在 Windows CE 上也可能会有所帮助:http: //blog.nerdbank.net/2006/10/platform-detection-iii-how-to-detect.html

于 2011-04-15T07:26:38.060 回答
0

Windows XP Tablet PC Edition 中有IInkTablet2 COM 接口或用于非 WPF 应用程序的托管包装Microsoft.Ink.Tablet类。但是大多数触摸屏驱动程序都是“鼠标”驱动程序,无法通过这种方式检测到。

于 2012-07-03T11:27:11.067 回答