StrokesPlus.net
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
soooulp  
#1 Posted : Friday, April 16, 2021 2:32:15 PM(UTC)
soooulp

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 4/23/2020(UTC)
Posts: 74
China

Thanks: 21 times
Was thanked: 3 time(s) in 2 post(s)
I want to restrict the mouse at a specific point, like (0,0) or action end, and forbid it to move to the corner of the screen when moving the computer.

I try the following code and it can restrict the mouse at the rectangle with an action.

sp.MouseRestrictToRectangle(action.Window.Rectangle);
Rob  
#2 Posted : Friday, April 16, 2021 3:47:19 PM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 926
United States
Location: Tampa, FL

Thanks: 21 times
Was thanked: 265 time(s) in 231 post(s)
Code:
if(sp.MouseRestrictActive()) {
    // Remove mouse restriction
    sp.MouseRestrictClear();
} else {
    // Create empty rectangle, confines mouse to 0,0
    sp.MouseRestrictToRectangle(new Rectangle());
}

Note that if you press the ignore key, the mouse restriction is stopped until the ignore key is released

Edited by user Friday, April 16, 2021 3:48:35 PM(UTC)  | Reason: Not specified

thanks 1 user thanked Rob for this useful post.
soooulp on 4/16/2021(UTC)
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.