如何在 C# 中访问我的触控板?
这个周末我很无聊。
我决定构建一个莫尔斯电码应用程序,我可以使用触控板输入莫尔斯电码并让我的应用程序发出声音。
我告诉过你我很无聊! :D
有一些事实上的方法可以在 C# 中访问触控板吗?我的意思是使用压力图。谢谢!
I'm pretty bored this weekend.
I've decided to build a morse code application where I can use my trackpad to tap morse code in and have my app sound it out.
I told you I was bored! :D
Is there some defacto way to access a trackpad in C#? I mean using pressure graphs. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我并不是 100% 熟悉触控板的概念,但我假设您正在使用的机器是笔记本电脑,并且您所指的是其他称为“鼠标板”的东西。
您至少可以在 Windows 中做一些事情。当您用手指点击时,您实际上是在向 Windows 运行时发送“单击”事件。如果您在.NET中持有
从System.Windows.Forms.Control继承的任何对象(Forms/UserControls),则可以订阅以下事件:
您可以对MouseUp和MouseDown事件之间的时间差进行计时并做出反应到结果的时间跨度范围。例如,如果您按住鼠标 20 毫秒,那么这是某个莫尔斯电码字符,而按住鼠标 40 毫秒则是其他字符。
对于鼠标垫/触控板,这相当于将手指放在触控板本身上。
I am not familiar 100% with the idea of the trackpad, but I am assuming that the machine you are working with is a laptop, and what you are referring to is something otherwise known as "mousepad".
You can do a couple of things at least in windows. When you tap with your finger you are actually sending "click" events to the windows runtime. If you hold
In .NET any object (Forms/UserControls) that inherits from System.Windows.Forms.Control can subscribe to the following events:
You can time the Difference in time between MouseUp and MouseDown events and react to the resulting timespan ranges. For instance if you hold the mouse for 20 milliseconds then this is some morse-code character, while holding the mouse for 40 milliseconds is some other character.
In the case of the mousepad/trackpad this would be the equivalent of holding your finger on the pad itself.
一些选项卡驱动程序使用鼠标输入消息额外信息来发送额外信息。我认为 WACOM 这样做是为了发送笔压力。
可以使用 GetMessageExtraInfo 函数查询此信息
也许你应该检查一下你的pad是否有一些有趣的东西,但这可能是供应商特定的,如果有什么东西可用但不确定。
Some tabs drivers use the mouse input message extra info to send, well, extra information. I think WACOM does this for sending pen pression.
This information can be queried using the GetMessageExtraInfo Function
Maybe you should check if there's something interesting with your pad, but it's probably vendor specific, if anything is even available which is not certain.