The 1 I am working on now is a Windows Manager GUI app
One of the features I am working on is to use a AHK Slide GUI control to:
- resize a window from the left edge of windo, right edge, top, and bottom edge
- Move a window right, left, up, down using Slider GUI controls
- Show a Picture GUI representing the size and shape of the desktop resized down but in proportion
- On top of the Desktop GUI picture, show a Picture GUI control representing a Window on the Desktop scaled down to the same scale as desktop picture and positioned on the GUI to also represent the correct scaled down Xpos and Ypos that the real window is on the desktop so the GUI shows a preview of the window how it is sized and positioned on the desktop
- With the preview Picture GUI controls I can then resize and move the window picture GUI on top of the desktop Picture GUI as the Sliders are moved
What I need help with:
1) Figure out what scale/percent a 200px width picture GUI control is compared to the selected desktop screens Width and Height
2) Using the above scale/percent, Get the selected Windows width/height and Xpos/Ypos and use that scale to resize the Window Picture GUI to be at the same scale as the desktop picture GUI and position it X/Y on the image at the correct location to reflect the real window on desktop
I am not sure how to do the Math to determine these, any help appreciated.
Any help aprreciated
Here is the basic starter demo for playing with the slider to resize/move the picture controls
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
Gui, Add, Slider, gshow_result w500 vMySlider Range1-100 TickInterval1, 50
Gui Add, Picture, x1 y100 w455 h355 vMyEdit, F:\My Photos\Web_Dev_Photos\Inspiration\draft_biogrify_mockups.png
gui, show
GuiControlGet, MyEdit, Pos
return
show_result:
global MyEdit
GuiControlGet, result , , MySlider,
final_result:=result
tooltip % final_result
MsgBox The X coordinate is %MyEditX%. The Y coordinate is %MyEditY%. The width is %MyEditW%. The height is %MyEditH%.
picWidthPercent := MyEditW/100
newPicWidth := picWidthPercent * final_result
MsgBox, %newPicWidth%
GuiControl, MoveDraw, MyEdit, % "x" MyEditX "y" MyEditY "w"newPicWidth "h220" ; Uses an expression via "% " prefix.
return