@ahk7
I think this is ingenious, but I'm confused about how you use it. If I'm reading your posts correctly, you use DPI() to increase the scaling that's already done by +DPIScale. Does it scale the numbers by the same amount again that +DPIScale would already scale it? So if the scale is 150%, you end up at %225?
If 150% is too small for you in AutoHotkey GUIs, wouldn't everything else be too small as well? Why have the scale set so low?
If you're using the function, I think it would be more sensible to apply -DPIScale and increase the scaling factor of DPI(), which I presume is done by supplying a second parameter. That way the coordinates returned by Gui commands and variables will be actual coordinates, instead of modified coordinates that are half-way between reality and the original coordinates since only one scaling factor is reversed (+DPIScale, not DPI()).
It would probably be trivial to extend +DPIScale to accept a value, overriding the system DPI...
DPI() - writing friendlier DPI-Aware AutoHotkey GUIs
Re: DPI() - writing friendlier DPI-Aware AutoHotkey GUIs
Most other programs I work with deal with text and they have the standard zoom in/out options for the text and decent buttonbars - of course some dialogs will remain "small" but I don't have to use these that often (the dialogs) so it is acceptable.I think this is ingenious, but I'm confused about how you use it. If I'm reading your posts correctly, you use DPI() to increase the scaling that's already done by +DPIScale.
Yes, that should be the case. (w100 -> dpi() -> w150 -> +DPIScale -> w225)Does it scale the numbers by the same amount again that +DPIScale would already scale it? So if the scale is 150%, you end up at %225?
It is the standard / recommended setting here and messing with other computers (apart from my own) by changing it "all the time" would be(come) tedious.If 150% is too small for you in AutoHotkey GUIs, wouldn't everything else be too small as well? Why have the scale set so low?
Maybe, I don't think it matters that much and I haven't run into any weird results. You can already use dpi() and set your preferred DPI so you can choose how you'd like to use it.If you're using the function, I think it would be more sensible to apply -DPIScale ...
Here are various GUIs with -/+DPIScale and various DPI("",dpisetting) including making it smaller (72dpi). Result as image below. (screenshots taken at 150%/144dpi). Gui 1 & 3 are standard AHK GUIs with -/+DPIScale the rest variations with DPI()
Code: Select all
Gui, 1:-DPIScale
Gui, 1:Font , s10
Gui, 1:Add, Text , x5 y5 , Hello
Gui, 1:Add, Edit , xp yp+20 w200 h100 vVar, -DPIScale`nA_ScreenDPI: %A_ScreenDPI%
Gui, 1:Add, Button, xp yp+110 w100 , OK
Gui, 1:Add, Button, xp+110 yp w50 , Cancel
Gui, 1:Show , w220 h200 , 1
Gui, 2:-DPIScale
Gui, 2:Font , % dpi("s10 ")
Gui, 2:Add, Text , % dpi("x5 y5 "), Hello
Gui, 2:Add, Edit , % dpi("xp yp+20 w200 h100 vVar"), DPI()`n-DPIScale`nA_ScreenDPI: %A_ScreenDPI% (150`%)
Gui, 2:Add, Button, % dpi("xp yp+110 w100 "), OK
Gui, 2:Add, Button, % dpi("xp+110 yp w50 "), Cancel
Gui, 2:Show , % dpi("w220 h200 "), 2
Gui, 3:+DPIScale
Gui, 3:Font , s10
Gui, 3:Add, Text , x5 y5 , Hello
Gui, 3:Add, Edit , xp yp+20 w200 h100 vVar, +DPIScale`nA_ScreenDPI: %A_ScreenDPI% (150`%)
Gui, 3:Add, Button, xp yp+110 w100 , OK
Gui, 3:Add, Button, xp+110 yp w50 , Cancel
Gui, 3:Show , w220 h200 , 3
Gui, 4:+DPIScale
Gui, 4:Font , % dpi("s10 ")
Gui, 4:Add, Text , % dpi("x5 y5 "), Hello
Gui, 4:Add, Edit , % dpi("xp yp+20 w200 h100 vVar"), DPI()`n+DPIScale`nA_ScreenDPI: %A_ScreenDPI% (150`%)
Gui, 4:Add, Button, % dpi("xp yp+110 w100 "), OK
Gui, 4:Add, Button, % dpi("xp+110 yp w50 "), Cancel
Gui, 4:Show , % dpi("w220 h200 "), 4
Gui, 5:-DPIScale
Gui, 5:Font , % dpi("s10 ",144)
Gui, 5:Add, Text , % dpi("x5 y5 ",144), Hello
Gui, 5:Add, Edit , % dpi("xp yp+20 w200 h100 vVar",144), DPI(,144)`n-DPIScale`nA_ScreenDPI: %A_ScreenDPI% (150`%)
Gui, 5:Add, Button, % dpi("xp yp+110 w100 ",144), OK
Gui, 5:Add, Button, % dpi("xp+110 yp w50 ",144), Cancel
Gui, 5:Show , % dpi("w220 h200 ",144), 5 (same as 2)
Gui, 6:-DPIScale
Gui, 6:Font , % dpi("s10 ",192)
Gui, 6:Add, Text , % dpi("x5 y5 ",192), Hello
Gui, 6:Add, Edit , % dpi("xp yp+20 w200 h100 vVar",192), DPI(,192)`n-DPIScale`nA_ScreenDPI: %A_ScreenDPI% (200`%)
Gui, 6:Add, Button, % dpi("xp yp+110 w100 ",192), OK
Gui, 6:Add, Button, % dpi("xp+110 yp w50 ",192), Cancel
Gui, 6:Show , % dpi("w220 h200 ",192), 6
Gui, 7:-DPIScale
Gui, 7:Font , % dpi("s10 ",216)
Gui, 7:Add, Text , % dpi("x5 y5 ",216), Hello
Gui, 7:Add, Edit , % dpi("xp yp+20 w200 h100 vVar",216), DPI(,216)`n-DPIScale`nA_ScreenDPI: %A_ScreenDPI% (225`%)
Gui, 7:Add, Button, % dpi("xp yp+110 w100 ",216), OK
Gui, 7:Add, Button, % dpi("xp+110 yp w50 ",216), Cancel
Gui, 7:Show , % dpi("w220 h200 ",216), 7
Gui, 8:+DPIScale
Gui, 8:Font , % dpi("s10 ",72)
Gui, 8:Add, Text , % dpi("x5 y5 ",72), Hello
Gui, 8:Add, Edit , % dpi("xp yp+20 w200 h100 vVar",72), DPI(,72)`n+DPIScale`nA_ScreenDPI: %A_ScreenDPI% (75`%)
Gui, 8:Add, Button, % dpi("xp yp+110 w100 ",72), OK
Gui, 8:Add, Button, % dpi("xp+110 yp w50 ",72), Cancel
Gui, 8:Show , % dpi("w220 h200 ",72), 8
Gui, 9:-DPIScale
Gui, 9:Font , % dpi("s10 ",72)
Gui, 9:Add, Text , % dpi("x5 y5 ",72), Hello
Gui, 9:Add, Edit , % dpi("xp yp+20 w200 h100 vVar",72), DPI(,72)`n+DPIScale`nA_ScreenDPI: %A_ScreenDPI% (75`%)
Gui, 9:Add, Button, % dpi("xp yp+110 w100 ",72), OK
Gui, 9:Add, Button, % dpi("xp+110 yp w50 ",72), Cancel
Gui, 9:Show , % dpi("w220 h200 ",72), 9
Return
Esc::
GuiClose:
ExitApp
Code: Select all
sizes:=[72,96,120,144,192,216]
count:=1
dpiset:=sizes[count]
Gosub, DrawGui
^k::
count++
if (count > sizes.length())
count:=1
dpiset:=sizes[count]
Gosub, DrawGui
Return
Esc::ExitApp
DrawGui:
Gui, 10:Destroy
Gui, 10:-DPIScale
Gui, 10:Font , % dpi("s10 ",dpiset)
Gui, 10:Add, Text , % dpi("x5 y5 ",dpiset), Hello
Gui, 10:Add, Edit , % dpi("xp yp+20 w200 h100 vVar",dpiset), DPI(,%dpiset%)`n-DPIScale`nA_ScreenDPI: %A_ScreenDPI%
Gui, 10:Add, Button, % dpi("xp yp+110 w100 ",dpiset), OK
Gui, 10:Add, Button, % dpi("xp+110 yp w50 ",dpiset), Cancel
Gui, 10:Show , % dpi("w220 h200 ",dpiset) " x100", DPI() test
Gui, 11:Destroy
Gui, 11:+DPIScale
Gui, 11:Font , % dpi("s10 ",dpiset)
Gui, 11:Add, Text , % dpi("x5 y5 ",dpiset), Hello
Gui, 11:Add, Edit , % dpi("xp yp+20 w200 h100 vVar",dpiset), DPI(,%dpiset%)`n+DPIScale`nA_ScreenDPI: %A_ScreenDPI%
Gui, 11:Add, Button, % dpi("xp yp+110 w100 ",dpiset), OK
Gui, 11:Add, Button, % dpi("xp+110 yp w50 ",dpiset), Cancel
Gui, 11:Show , % dpi("w220 h200 ",dpiset) " x700", DPI() test
Return
Return to “Scripts and Functions (v1)”
Who is online
Users browsing this forum: No registered users and 167 guests