Jump to content

Recommended Posts

Quando crio uma ComboBox não tenho a opção de escolher a posição que o texto vai ficar e por padrão só fica à esquerda, tem como colocar prá mostrar centralizado?

Share this post


Link to post
Share on other sites

Imaginei o mesmo que você mutleey

 

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Array.au3>

Global $st = "fulano, beltrano, sicrano"


#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("", 184, 116, 192, 124)
$Button1 = GUICtrlCreateButton("Centralizar", 16, 24, 147, 25)
$Combo1 = GUICtrlCreateCombo("Combo1", 16, 56, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            LS()

    EndSwitch
WEnd

Func LS()
    GUICtrlSetData($Combo1,'')
    Local $sts = StringSplit($st,',')
    For $i = 1 to $sts[0]
        Local $stl = StringLen($sts[$i])
        Local $N = 22 - $stl; 22 e a quantidade de caracteres visíveis neste combobox
        Local $ar[$N]
        For $x = 1 to $N
            _ArrayAdd($ar,  Chr(32))
        Next
        $fst = _ArrayToString($ar)
        $w = StringReplace($fst,'|','')
        ConsoleWrite($w&$stl&@CRLF)
        GUICtrlSetData($Combo1, $w&$sts[$i]& $w& "|")
    Next
EndFunc
Edited by Orve

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×