ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Post New Requests Here

IDEA: resize window from centre

(1/2) > >>

SteveJohnSteele:
Normally when you resize a window you grab the bottom+right corner and the top+left corner doesnt move.

My suggestion is ...
That the center of the window remains constant, but the window resizes around that center. All four corners moving out from the center.
- when holding down mouse + shift

OR optionally
The bottom corners moving out from centre (titlebar Y (up) position constant)
- when holding down mouse + ctrl

Of course this would also need to work on any edge.

hope you like.

MilesAhead:
Mouse drag might be a bit weird if you reposition the window while resizing.
I did this instead.  If you hold down the Left Control key while using the Mouse Wheel it should resize and center.  If you are going to resize by a large amount I recommend doing it the regular way at first, until you are close to the size you want, then hold down Left Control and move the mouse wheel up for larger and down for smaller.  It will resize the active window by increments and center it.

The only safety I have built in is it does nothing if the Desktop or Taskbar/Tray is active.  Don't want to mess with resizing those.  :)

To change to a different hotkey just change the script.  See AutoHotKey forum for compiler if you want to compile it to exe file.


--- ---#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
LControl & WheelUp::
IfWinActive,ahk_class Progman
Return
IfWinActive,ahk_class Shell_TrayWnd
Return
WinGetPos,X,Y,Width,Height,A
Width := Round(Width * 1.1)
Height := Round(Height * 1.1)
If (Width > A_ScreenWidth)
  Width = A_ScreenWidth
If (Height > A_ScreenHeight)
  Height = A_ScreenHeight
WinGetTitle,Title,A
WinMove, %Title%,, (A_ScreenWidth/2)-(Width/2), (A_ScreenHeight/2)-(Height/2),%Width%,%Height%
Return

LControl & WheelDown::
IfWinActive,ahk_class Progman
Return
IfWinActive,ahk_class Shell_TrayWnd
Return
WinGetPos,X,Y,Width,Height,A
Width := Width - 20
Height := Height - 16
WinGetTitle,Title,A
WinMove, %Title%,, (A_ScreenWidth/2)-(Width/2), (A_ScreenHeight/2)-(Height/2),%Width%,%Height%
Return

SteveJohnSteele:
Many thanks  8)

Ive hacked your code a bit ...


--- ---#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

LControl & WheelUp::
IfWinActive,ahk_class Progman
Return
IfWinActive,ahk_class Shell_TrayWnd
Return

WinGetPos,X,Y,Width,Height,A
WinGetTitle,Title,A

X := X-8
Y := Y
Width := Width+16
Height := Height+16

WinMove, %Title%,, X, Y,%Width%,%Height%
Return

LControl & WheelDown::
IfWinActive,ahk_class Progman
Return
IfWinActive,ahk_class Shell_TrayWnd
Return

WinGetPos,X,Y,Width,Height,A
WinGetTitle,Title,A

X := X+8
Y := Y
Width := Width-16
Height := Height-16

WinMove, %Title%,, X, Y,%Width%,%Height%
Return

this allows for the window to be positioned anywhere
also by not changing the Y the title bar stays still

vixay:
what you are looking for is NiftyWindows
Already done in AHK. I think you'll find it is very userful.
You can also search for WinManagement AHK script, or GridMove for some other window management programs

CleverCat:
NiftyWindows is excellent as due to my disability I sometimes struggle to grab corner of window! Works a treat using just right click.. :Thmbsup:

Navigation

[0] Message Index

[#] Next page

Go to full version