Jump to content

Recommended Posts

Posted

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.

  • Moderators
Posted

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. :(

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

Posted

  On 2/23/2010 at 3:37 PM, 'Melba23 said:

_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).

  • Moderators
Posted

Tankbuster,

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

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...