Sign in to follow this  
Followers 0
Tankbuster

ComboBox - Border Color (style)

4 posts in this topic

I searched the forum and the doc but somehow I was unable to get an idea if there is an option (or workarround) to set the color of the border of a combobox?

With GUICtrlSetColor and GUICtrlSetBkColor I'm able to set the font color and background inside the control but there is a small border around the control.

It looks like this color is under control by the OS.

#include <GuiComboBoxEx.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)


_Main()

Func _Main()
    Local $hGUI, $hImage, $hCombo
    
    ; Create GUI
    $hGUI = GUICreate("ComboBoxEx color test", 200, 200)
    GUISetBkColor(0x000000)
    $hCombo = GUICtrlCreateCombo("text", 2, 2, 150, 190)
    GUICtrlSetColor($hCombo,0xFFFFFF)
    GUICtrlSetBkColor($hCombo, 0x000000)
    
    GUISetState()

    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc   ;==>_

Did I missed something on the docu?

If this is somewhere else already solved please post the link to the thread. Thank you very much.

Share this post


Link to post
Share on other sites



Tankbuster,

Those colours are, to the best of my knowledge, set by the system and can therefore only be changed on a systemwide basis. You can find out what they are currently by using _WinAPI_GetSysColor and you can change them by using _WinAPI_SetSysColors. You would probably need to change these elements:

$COLOR_3DHILIGHT - Highlight color for three-dimensional display elements (for edges facing the light source.)
$COLOR_3DLIGHT - Light color for three-dimensional display elements (for edges facing the light source.)
$COLOR_3DSHADOW - Shadow color for three-dimensional display elements (for edges facing away from the light source).

However, you would also change them for every other GUI on the machine, which might not be what you want. :mellow:

M23

P.S. I have found that on my Vista machine they reset to the default colours on reboot, by the way, so if it all gets out of hand you can (probably) recover the original colours at the cost of a few minutes wait. :(


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

_WinAPI_GetSysColor and you can change them by using _WinAPI_SetSysColors.

....

However, you would also change them for every other GUI on the machine, which might not be what you want. :mellow:

With your hint I search the docu and there is an example but this does not work on my XP PC. I will try it on my Win7 PC....

But as you stated I will change all other GUIs too, so I will ruin a lot :-(

But thx for the first idea.

Question:

I ran in the docu sometimes over the phrase " painted if the "Windows XP/Vista style" is used.

" - Is it somehow related to the GUI "basic" look and feel and somehow attached to this question?

See GUICtrlSetColor in the docu (on the remarks).

Share this post


Link to post
Share on other sites

Tankbuster,

Take a look here - I answered a similar question recently. :mellow:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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
Sign in to follow this  
Followers 0