Answers for "how to detect mouse click in c#"

C#
0

how to detect mouse click in c#

[DllImport("user32.dll")]
static extern short GetAsyncKeyState(int VirtualKeyPressed);
 
public static bool GetLeftMousePressed()
    {
        if (GetAsyncKeyState(0x01) == 0)
            return false;
        else
            return true;
    }

//0x01 stands for left Mouse click
//for different Virtual-Keys view list:
// https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes

Credit: Jason Wong on Stack Overflow
Posted by: Guest on July-12-2021

Code answers related to "how to detect mouse click in c#"

C# Answers by Framework

Browse Popular Code Answers by Language