是否有可能让我的C#WPF程序知道用户是否有触摸屏或不? [英] Is it possible to let my c# wpf program know if the user has a touchscreen or not?

查看:560
本文介绍了是否有可能让我的C#WPF程序知道用户是否有触摸屏或不?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经得到了具有人,当他们有一个触摸屏只能使用刷卡系统的登录应用程序。他们可以通过滑动他们的个人模式刷卡code登录。

I've got an login application that has a swipe system that people only can use when they have a touchscreen. They can login by swiping their personal pattern swipe code.

是否可以为您在C#或WPF如果用户有触摸屏?即使他不使用它的触摸那个时候?

Is it possible to check in C# or WPF if the user has a touchscreen? Even when he isn't using touch on it at that time?

推荐答案

在C#code,以找出是否存在触摸屏(如果它虽然不检查单或多点触摸设备)的使用 System.Windows.Input 命名空间 presentationCore

Within C# code to find out if a touch screen exists (doesn't check if its a single or multi-touch device though) by the using System.Windows.Input namespace in 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;
    }

这篇关于是否有可能让我的C#WPF程序知道用户是否有触摸屏或不?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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