GUI center text Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
marc873a
Posts: 37
Joined: 23 Jun 2020, 10:49

GUI center text

Post by marc873a » 27 Jun 2022, 12:55

Hi.

I want to center some text in a GUI window.
I have this code so far:

Code: Select all

Gui, New
Gui, Font, s22, Arial
Gui, Add, Text, x0 w1920 +Center, woop

Gui, Submit
Gui, Show,  maximize
return
It gives me this
image.png
image.png (44.5 KiB) Viewed 521 times
I wouldn't say it's centered.

Is AutoHotkey drunk or something?

Thx in advance
Marcus :)

User avatar
boiler
Posts: 16951
Joined: 21 Dec 2014, 02:44

Re: GUI center text  Topic is solved

Post by boiler » 27 Jun 2022, 12:58

Are you sure your screen width is 1920? Are you using a Windows scaling factor other than 100%?

marc873a
Posts: 37
Joined: 23 Jun 2020, 10:49

Re: GUI center text

Post by marc873a » 27 Jun 2022, 13:03

I have used windows for at least 12 years now, and this is the first time I hear about Windows scaling factor. Bruh.

This is what causes the problem.
I don't want to set it to 100% as everything seems so small, so is there any way to center the text without changing the wsf?
My current scaling factor is 125%

Thanks for the help

marc873a
Posts: 37
Joined: 23 Jun 2020, 10:49

Re: GUI center text

Post by marc873a » 27 Jun 2022, 13:22

Okay, so I just read about the option "-DPIScale" and that seems to do the job.
I feel like the Ahk documentation could need a little update, to make it a bit more easy to read.
Anyway, thanks for help!

Post Reply

Return to “Ask for Help (v1)”