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

Notification

Icon
Error

Options
Go to last post Go to first unread
cathay  
#1 Posted : Friday, April 26, 2019 1:10:22 AM(UTC)
cathay

Rank: Newbie

Reputation:

Groups: Approved
Joined: 7/12/2018(UTC)
Posts: 4
China

I am a student. How to set the window starting with the mouse gesture to a fixed size, such as the upper left corner in (0, 0), the lower right corner (1000, maximum screen)?
Thank you very much.
Rob  
#2 Posted : Friday, April 26, 2019 1:27:47 PM(UTC)
Rob

Rank: Administration

Reputation:

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

Thanks: 28 times
Was thanked: 418 time(s) in 356 post(s)
This should handle what you're looking for.
Code:
//Restore the window if it's maximized, so it can be moved/resized
if(action.Window.Maximized) action.Window.Restore();
//Move to starting location of screen, usually would be 0,0 for a normal setup with a single screen
action.Window.Location = action.Window.Screen.WorkingArea.Location;
//Then resize to 1000 px wide and the height of the screen
action.Window.Size = new Size(1000, action.Window.Screen.WorkingArea.Bottom);


You can change the last line to this if you wanted it to be 1000px tall and the maximum width of the screen.
Code:
//Then resize to 1000 px tall and the width of the screen
action.Window.Size = new Size(action.Window.Screen.WorkingArea.Right, 1000);


Note that there are hidden window settings which set various buffer areas, so depending on your system, this could be off by some pixels on either dimension. You can just perform some extra math on the values like "+ 10" for example.
For the action.Window.Location property, you can create a new point instead of using the screen's location if you need to adjust, for example:
Code:
//Move to starting location of screen, except to the left by 10 pixels and from the top 10 pixels
action.Window.Location = new Point(action.Window.Screen.WorkingArea.Location.X - 10, action.Window.Screen.WorkingArea.Location.Y + 10);


Or assign a specific coordinate:
Code:
action.Window.Location = new Point(0,0);
cathay  
#3 Posted : Sunday, April 28, 2019 12:55:02 AM(UTC)
cathay

Rank: Newbie

Reputation:

Groups: Approved
Joined: 7/12/2018(UTC)
Posts: 4
China

Thank you very much for BOb. But my problem is still unsolved. My original code is as follows:

--Get Current Screen Position
local hScreen = acGetMonitorFromPoint(gsx, gsy) --获取鼠标手势起始位置屏幕句柄
local iScreenTop = acGetMonitorTop(hScreen, 1) --获取屏幕顶坐标
local iScreenBottom = acGetMonitorBottom(hScreen, 1) --获取屏幕底坐标
local iScreenRight = acGetMonitorRight(hScreen, 1) --获取屏幕右坐标
local iScreenLeft = acGetMonitorLeft(hScreen, 1) --获取屏幕左坐标
local iScreenHeight = iScreenBottom - iScreenTop --计算屏幕高度
local iScreenWidth = iScreenRight - iScreenLeft --计算屏幕宽度
mywidth = 1392
acSetWindowSize(nil, gsx, gsy, mywidth, iScreenHeight) --设置鼠标手势起始位置窗口大小为屏幕半宽度和高度
acMoveWindow(nil, gsx, gsy, 0, 0) --移动窗口


Can you give me some more guidance?
Rob  
#4 Posted : Sunday, April 28, 2019 1:22:16 PM(UTC)
Rob

Rank: Administration

Reputation:

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

Thanks: 28 times
Was thanked: 418 time(s) in 356 post(s)
Below is the exact translation of your S+ script to a S+.net script.
I copied your script and ran it in S+, then my new script in S+.net and they both have the exact same result.
Code:
//Resize to 1392 px wide and the height of the screen
action.Window.Size = new Size(1392, action.Window.Screen.WorkingArea.Height);
//Move window to 0,0 
action.Window.Location = new Point(0,0);

cathay  
#5 Posted : Tuesday, April 30, 2019 3:53:40 AM(UTC)
cathay

Rank: Newbie

Reputation:

Groups: Approved
Joined: 7/12/2018(UTC)
Posts: 4
China

Originally Posted by: Rob Go to Quoted Post
Below is the exact translation of your S+ script to a S+.net script.
I copied your script and ran it in S+, then my new script in S+.net and they both have the exact same result.
Code:
//Resize to 1392 px wide and the height of the screen
action.Window.Size = new Size(1392, action.Window.Screen.WorkingArea.Height);
//Move window to 0,0 
action.Window.Location = new Point(0,0);



The left and bottom will be empty for some distance. Is it going to have anything to do with my double screen?
Rob  
#6 Posted : Wednesday, May 8, 2019 1:00:18 AM(UTC)
Rob

Rank: Administration

Reputation:

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

Thanks: 28 times
Was thanked: 418 time(s) in 356 post(s)
There are hidden boundaries defined by Windows, so you may have to adjust the coordinates.
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.