Rank: Advanced Member
Groups: Approved
Joined: 3/30/2019(UTC) Posts: 74 Thanks: 8 times Was thanked: 1 time(s) in 1 post(s)
|
I want to set the window to 2/5 of the screen length and 1/4 of the screen width and move it to (1/3 of the screen length and 1/2 of the screen width). How to achieve it? Thank you
|
|
|
|
Rank: Administration
Groups: Translators, Members, Administrators Joined: 1/11/2018(UTC) Posts: 1,349 Location: Tampa, FL Thanks: 28 times Was thanked: 416 time(s) in 354 post(s)
|
Hopefully this is what you mean, but it has everything you need to change it how you would like. Note that you could use action.Window.Size and action.Window.Location separately, but this is faster. Those two methods just read/write from the Position property anyway. The parseInt wrapper calls are to ensure the value is a whole number, not a decimal, or you will get an error since Windows only supports positioning values which are whole numbers (integers). action.Window.Screen.WorkingArea represents the rectangle of the working area of the screen, for example it does not include the space occupied by the taskbar (if not auto hidden). action.Window.Screen.Bounds would give you the full dimensions of the screen. Code:var position = action.Window.Position;
position.Top = action.Window.Screen.WorkingArea.Top + parseInt(action.Window.Screen.WorkingArea.Height * 0.33);
position.Bottom = position.Top + parseInt(action.Window.Screen.WorkingArea.Height * 0.4);
position.Left = action.Window.Screen.WorkingArea.Left + parseInt(action.Window.Screen.WorkingArea.Width / 2);
position.Right = position.Left + parseInt(action.Window.Screen.WorkingArea.Width / 4);
action.Window.Position = position;
Edited by user Wednesday, June 12, 2019 5:35:44 PM(UTC)
| Reason: Corrected height calculation, was setting to 1/5
|
1 user thanked Rob for this useful post.
|
|
|
Rank: Advanced Member
Groups: Approved
Joined: 3/30/2019(UTC) Posts: 74 Thanks: 8 times Was thanked: 1 time(s) in 1 post(s)
|
Yes, that's what I want, and I know the reason for my previous mistake is that it can't recognize the score. Thank you, Rob, for helping me a lot.
|
|
|
|
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.
Important Information:
The StrokesPlus.net Forum uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close