是否可以让我的c#wpf程序知道用户是否有触摸屏?

前端之家收集整理的这篇文章主要介绍了是否可以让我的c#wpf程序知道用户是否有触摸屏?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有一个登录应用程序,有一个滑动系统,人们只有在有触摸屏时才可以使用.他们可以通过刷卡他们的个人模式刷卡代码进行登录.

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

解决方法

在C#代码中,通过在PresentationCore中使用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;
    }
原文链接:https://www.f2er.com/csharp/94899.html

猜你在找的C#相关文章