So, how to do it?
- If you use e.g. Gui, Color, 808080 or a picture for the Gui background:
- Create a variable (e.g. CtrlColorBtnsBrush) containing a brush using a proper color:
Note: The color has to be specified in BGR (reversed order).
Code: Select all
CtlColorBtnsBrush := DllCall("Gdi32.dll\CreateSolidBrush", "UInt", 0x808080, "UPtr")
- Create a function (e.g. CtrlColorBtns()) which returnes right this brush:
Code: Select all
CtlColorBtns() { Global CtlColorBtnsBrush Return CtlColorBtnsBrush }
- Register the function as handler for WM_CTLCOLORBTN messages:
Code: Select all
OnMessage(0x0135, "CtlColorBtns") ; WM_CTLCOLORBTN = 0x0135
- Create the Gui and the buttons and redraw the Gui once after the first Gui, Show, ... with WinSet, Redraw, ....
- Done!
There's one disadvantage you will notice, the buttons don't seem to be proper aligned with other controls any more. As a workaround, you can adjust the position and size.
Code: Select all
#NoEnv
; MsgBox, PSPad Workaround!
CtlColorBtnsBrush := DllCall("Gdi32.dll\CreateSolidBrush", "UInt", 0x808080, "UPtr") ; BGR!!!
OnMessage(0x0135, "CtlColorBtns") ; WM_CTLCOLORBTN = 0x0135
Gui, +LastFound ; sets the last found window
Gui, Margin, 100, 50
Gui, Color, 808080
Gui, Add, Radio, w100 vRB1, Radio1
Gui, Add, Radio, xm y+10 w100 vRB2, Radio2
Gui, Add, CheckBox, w100 vCB, CheckBox
Gui, Add, Edit, xm w100 h30
Gui, Add, Button, xm y+2 w100 vPB, Button
Gui, Show, , Test
WinSet, Redraw ; uses th last found window
Return
GuiClose:
GuiEscape:
ExitApp
CtlColorBtns() {
Global CtlColorBtnsBrush
Return CtlColorBtnsBrush
}