Hey everyone,
I want to restrict cursor movement outside of a picture box when the user clicks a button. Here's what my code looks like so far:
private void btnX_Click(object sender, EventArgs e)
{
if (remote == false)
{
remote = true;
Cursor.Position = pctRemote.PointToScreen(gridCenter); //centers the cursor on the grid
}
else
{
remote = false;
Cursor = Cursors.Default;
}
}
PictureBox = pctRemote
I've tried a lot of cursor.clip functions but I can't seem to get it working.