mouse

Distinguish between touch only and mouse-and-touch devices

谁说我不能喝 提交于 2020-08-09 09:04:25
问题 Right now, I am working on a part of a project which supports drag and drop. Look at the picture for clarification: Even though it is German, I guess it is straightforward: The User can drag the blue boxes from the top saying "Verfügbare Empfänger" on the gray areas below. This works just fine. On mobile devices, I just removed the drag and drop and the gray areas and can add the blue boxes by clicking on them. Now for the actual problem: in order to detect touch, I used the following

How to use GetAsyncKeyState to see key was pressed for x seconds

时光毁灭记忆、已成空白 提交于 2020-07-20 03:51:21
问题 I am trying to create a code which will detect if the mouse button has been pressed. So far i have a code which will detect if the button has been pressed once. But it isn't letting me check if the button was continuously pressed. For e.g left mouse button pressed, this will start a timer, after 0.5 seconds it will check again and if it is still down output something. I want to set it up like this while (true) { if (GetAsyncKeyState(VK_LBUTTON) & (0x8000 != 0)) { cout << ("left button pressed

c# Detect mouse clicks anywhere (Inside and Outside the Form)

三世轮回 提交于 2020-06-24 15:57:06
问题 Is this possible to detect a mouse click (Left/Right) anywhere (Inside and Outside the Form) in an if statement? And ff it's possible, how? if(MouseButtons.LeftButton == MouseButtonState.Pressed){ ... } 回答1: Here is a starter, if I understood your needs of "clicking from outside the window" and Hans Passant's suggestion doesn't fit your needs. You might need to add an event handler for Form1_Click . public partial class Form1 : Form { private Mutex checking = new Mutex(false); private

SystemParametersInfoA with SPI_GETMOUSE returns 0's

本秂侑毒 提交于 2020-06-01 07:36:05
问题 Go to the answer of the question I'm trying to get my mouse speed, but when I call the function SystemParametersInfoA with parameter SPI_GETMOUSE it sets the target array to {0,0,0} which I think its not supposed to happen. Example code: int IntArr[3]; SystemParametersInfoA(SPI_GETMOUSE, 0, &IntArr, 0); I tried changing my mouse sensitivity (from the control panel) but that didn't work either. Does this function is supposed to return those zeros or thats my fault? 回答1: The documentation says:

How to make a sprite rotate to face the mouse? [duplicate]

ぃ、小莉子 提交于 2020-05-31 03:06:07
问题 This question already has answers here : How do I make my player rotate towards mouse position? (1 answer) How to rotate a triangle to a certain angle in pygame? (1 answer) How do I rotate an image around its center using Pygame? (4 answers) Closed 11 days ago . After several hours of complete utter chaos, I still haven't found a solution to rotating a sprite to face the mouse position. I've implemented several examples from other post, the links are below, but none of them seem to be

Get Mouse State without access to MouseEventArgs?

丶灬走出姿态 提交于 2020-05-28 12:47:28
问题 I have a form with many, many controls. I need to detect if the mouse is down or if it's up. Most of the time, I don't have MouseEventArgs . Is there a quick and easy way to tell if the mouse is down without mouseEventArgs? Is there an alternative, or is something like this the only way?: foreach (Control c in this.Controls) { c.MouseUp += new MouseEventHandler(globalMouseUp); c.MouseDown += new MouseEventHandler(globalMouseDown); } bool isMouseUp = true; private void globalMouseDown(object