开发者

Silver/WPF remove mouse events, but allow touch events

开发者 https://www.devze.com 2023-01-10 13:13 出处:网络
Do any1 know how to remove mouse event, but allow only touch events. In brief, I have 2 monitors. 1 is the primary display, another is a touch screen.

Do any1 know how to remove mouse event, but allow only touch events.

In brief, I have 2 monitors. 1 is the primary display, another is a touch screen.

I don't want the mouse cursor to move over to the second display. For the dis开发者_运维技巧play, it will only accept touch events, so hopefully, when the 2nd screen is touched, the mouse should stay at the primary screen w/o moving.

Any idea how to do that?


Not with Windows, because all mouse-like device inputs get combined to one virtual device. So if your touchscreen is registered as and acts like a regular mouse, I know of no way to find out where the input came from. Only solution here would be getting the input data at driver level. (See the several results for c# multiple mice.)
Because of this the mouse cursor will always (shortly) move to where the touchscreen is "clicked".

Preventing the mouse cursor to enter the second screen will be quite difficult, because that also happens at Windows level.

I suggest a workaround, although this depends on your touchscreen:
Usually touchscreen inputs (though not stylus inputs) have a very short / fast mouse move before the click. So one possible solution would be to listen to mouse move events and separate the input's origin using that information.

0

精彩评论

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