- Yasaklandı
- #1
[DllImport("user32.dll")]
private static extern short GetAsyncKeyState(System.Windows.Forms.Keys vKey);
// O Tuşa Tıkladığında true döner.
public static bool IsPressed(System.Windows.Forms.Keys Key)
{
return (GetAsynKeyState(Key) != 0) ? true : false;
}
// O Tuşa Basılı ise true döner.
public static bool IsHolding(System.Windows.Forms.Keys Key)
{
return ((GetAsyncKeyState(Key) & 0x8000) > 0) ? true : false;
}
GetAsyncKeyState'i Import et programa ordan basılan tuş LButton ise işlemi gerçekleştirmesini sağla
Kod:[DllImport("user32.dll")] private static extern short GetAsyncKeyState(System.Windows.Forms.Keys vKey); // O Tuşa Tıkladığında true döner. public static bool IsPressed(System.Windows.Forms.Keys Key) { return (GetAsynKeyState != 0) ? true : false; } // O Tuşa Basılı ise true döner. public static bool IsHolding(System.Windows.Forms.Keys Key) { return ((GetAsyncKeyState(Key) & 0x8000) > 0) ? true : false; }
if(IsHolding(Keys.LButton) == true)
{
}