开发者

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 hav开发者_开发百科e 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!


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:

  • MouseDown
  • MouseUp
  • MouseEnter
  • MouseLeave
  • MouseClick
  • MouseDoubleClick

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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜