简体   繁体   English

如何在C#中访问我的触控板?

[英]How can I access my trackpad in 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 :d

Is there some defacto way to access a trackpad in C#? 是否有一些事实上的方式来访问C#中的触控板? I mean using pressure graphs. 我的意思是使用压力图。 Thanks! 谢谢!

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. 你至少可以在windows中做几件事。 When you tap with your finger you are actually sending "click" events to the windows runtime. 当您用手指敲击时,实际上是向Windows运行时发送“单击”事件。 If you hold 如果你持有

In .NET any object (Forms/UserControls) that inherits from System.Windows.Forms.Control can subscribe to the following events: 在.NET中,从System.Windows.Forms.Control继承的任何对象(Forms / UserControls)都可以订阅以下事件:

  • MouseDown 的MouseDown
  • MouseUp 的MouseUp
  • MouseEnter 的MouseEnter
  • MouseLeave 鼠标离开
  • MouseClick 鼠标点击
  • MouseDoubleClick MouseDoubleClick

You can time the Difference in time between MouseUp and MouseDown events and react to the resulting timespan ranges. 您可以计算MouseUp和MouseDown事件之间的时间差异,并对产生的时间跨度范围做出反应。 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. 例如,如果你按住鼠标20毫秒,那么这是一些莫尔斯码字符,而按住鼠标40毫秒是另一个字符。

In the case of the mousepad/trackpad this would be the equivalent of holding your finger on the pad itself. 在鼠标垫/触控板的情况下,这相当于将手指放在垫本身上。

Some tabs drivers use the mouse input message extra info to send, well, extra information. 一些选项卡驱动程序使用鼠标输入消息额外信息发送,以及额外的信息。 I think WACOM does this for sending pen pression. 我认为WACOM这样做是为了发送压力。

This information can be queried using the GetMessageExtraInfo Function 可以使用GetMessageExtraInfo函数查询此信息

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. 也许你应该检查一下你的垫子是否有一些有趣的东西,但它可能是供应商特定的,如果有任何可用甚至是不确定的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用C#访问SQLite? - How can I access SQLite with C#? 如何在C#中访问它? - How can I access this in C#? 如何在我的视图中访问C#数组? - How do I access my C# Array in my View? C#如何访问主目录中包含foreach循环的方法? - C# How can I access a method that contains a foreach loop in my main? 如何在需要MDW文件时将Access DB添加到我的C#项目中? - How can I add an Access DB to my C# project when it requires an MDW file too? 如何从c#应用程序访问另一个应用程序上的菜单栏和子菜单? - How I can access to menubar and sub ment on another application from my c# application? 如何从C#代码中捕获Microsoft Access VBA调试错误? - How can I capture a Microsoft Access VBA debug error from my C# code? 如何改善C#代码以将数据从MS Access读取到二维数组中? - How can I improve my C# code to read data from MS Access into a 2d-array? C#如何在使用getLastError方法的全局错误处理程序中访问DbEntityValidationException? - C# how can I access a DbEntityValidationException in my global error handler which uses getLastError method? Unity C#-如何做到这一点,以便可以通过一个类访问所有其他类,变量和方法? - Unity c# - How can I make it so that I can access all my other classes, variables and methods via a single class?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM