Snob
Snob

Reputation: 71

Using C#, how do I lock a mouse inside a window for gaming purposes

I wanted to add this feature to my program but I don't know what to google or the functions needed to do this. Its for Wacraft3 on window mode. I want the mouse to get locked inside the window when the window is active. thanks.

Upvotes: 2

Views: 2254

Answers (1)

Frédéric Hamidi
Frédéric Hamidi

Reputation: 263047

Use Cursor.Clip:

Cursor.Clip = yourForm.RectangleToScreen(yourForm.ClientRectangle);

Upvotes: 4

Related Questions