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: Moderators, Approved
Joined: 4/23/2020(UTC)
Posts: 161
China

Thanks: 46 times
Was thanked: 23 time(s) in 17 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: 1,359
United States
Location: Tampa, FL

Thanks: 28 times
Was thanked: 419 time(s) in 356 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 2 users thanked Rob for this useful post.
soooulp on 4/16/2021(UTC), randomConstant on 12/20/2021(UTC)
Users browsing this topic
Guest
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.