Page 1 of 1
Is there a way to adjust the alignment of the DropDownList item?
Posted: 15 Jun 2019, 10:18
by afe
Hello,
Is there a way to adjust the alignment of the DropDownList item?
For example, in the following example, is it possible to align the items text vertically in the center?
Thanks.
Code: Select all
Gui, Add, DropDownList, w300 hwndDDL vColorChoice, Black|White|Red|Green|Blue
PostMessage, 0x153, 0, 30,, ahk_id %DDL%
Gui, Show, h300 w400
return
Re: Is there a way to adjust the alignment of the DropDownList item?
Posted: 15 Jun 2019, 10:33
by Hellbent
If there isn't. You can always use a mono space font and pad the left side of your list.
Re: Is there a way to adjust the alignment of the DropDownList item?
Posted: 15 Jun 2019, 13:43
by Odlanir
Code: Select all
Gui, font,,Courier
Gui, Add, DropDownList, w300 hwndDDL vColorChoice, % SpaceItems("Black|White|Red|Green|Blue")
PostMessage, 0x153, 0, 30,, ahk_id %DDL%
Gui, Show, h300 w400
return
SpaceItems(items) {
for each, item in StrSplit(items, "|") {
lng := StrLen(item)
str .= Format("{:-" 17-lng/2 "}{}"," ",item) "|"
}
return Substr(str,1,-1)
}
ExitApp
Re: Is there a way to adjust the alignment of the DropDownList item?
Posted: 16 Jun 2019, 04:39
by afe
Thank you. This should be horizontal center alignment, not vertical center alignment, right?
Re: Is there a way to adjust the alignment of the DropDownList item?
Posted: 16 Jun 2019, 04:47
by Odlanir
@afe You're right! Seems I've misunderstood your request. But what you mean by vertical alignment?
Re: Is there a way to adjust the alignment of the DropDownList item?
Posted: 17 Jun 2019, 09:09
by afe
Yes, vertical alignment.