Daniel W. Posted May 26, 2006 Posted May 26, 2006 Hi, how do i change the background color of a Menu and the menuitems? Regards Daniel W. --------------------------------------------------------------------------------------------------------------------------------Scripts : _Encrypt UDF_UniquePCCode UDF MS like calculatorInstall programm *UPDATED* --------------------------------------------------------------------------------------------------------------------------------[quote name='Helge' post='213117' date='Jul 26 2006, 10:22 AM']Have you ever tried surfing the internet with a milk-carton ?This is similar to what you're trying to do.[/quote]
jpm Posted May 29, 2006 Posted May 29, 2006 just use GUICrlSetBkColor or GUICtrlSetColor on the specify item. The doc was not updated on the subject until .125. It was working since .72 ...
meetrix Posted May 29, 2006 Posted May 29, 2006 This may also help you get an idea. [code $Title = GuiCreate("Good Night Everyone", 700, 440,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) WinSetTrans($Title, "", 250) GUISetBkColor(0x0080FF) just use GUICrlSetBkColor or GUICtrlSetColor on the specify item. The doc was not updated on the subject until .125. It was working since .72 ...
Helge Posted May 29, 2006 Posted May 29, 2006 (edited) just use GUICrlSetBkColor or GUICtrlSetColor on the specify item.The doc was not updated on the subject until .125. It was working since .72 ... Just wondering... I believe it's mentioned in the example for GUICtrlGetHandle,which do some menu-coloring, that's coloring of menus and items doesn't workon Windows 98 (and another OS; NT4 ?).Do you know if that's also the case when using SetColor and SetBkColor ? Edited May 29, 2006 by Helge
jpm Posted May 29, 2006 Posted May 29, 2006 Just wondering... I believe it's mentioned in the example for GUICtrlGetHandle,which do some menu-coloring, that's coloring of menus and items doesn't workon Windows 98 (and another OS; NT4 ?).Do you know if that's also the case when using SetColor and SetBkColor ?No IdeaJust PM to Holger to see what he say
Rick Posted May 29, 2006 Posted May 29, 2006 just wondering, is it possible to change the background colour of a listbox instead of white? Who needs puzzles when we have AutoIt!!
jpm Posted May 29, 2006 Posted May 29, 2006 just wondering, is it possible to change the background colour of a listbox instead of white?No as stated in the doc. Certainly Holger can do it with some DLLcall ...
Holger Posted May 30, 2006 Posted May 30, 2006 For coloring menus in Win95/NT you have to use ownerdrawn menus - see my signature. For coloring a listbox here a small sample (beta-version needed)... expandcollapse popup#include <GUIConstants.au3> Global Const $WM_CTLCOLORLISTBOX = 0x0134 Dim $nTextClr1 = 0x00FF80 ; BGR-value Dim $nBkClr1 = 0xDD5566 ; BGR-value Dim $hBrush1 = 0 Dim $nTextClr2 = 0x8844FF ; BGR-value Dim $nBkClr2 = 0xC0F0F0 ; BGR-value Dim $hBrush2 = 0 Dim $hGUI = GUICreate("Test") GUISetState() GUIRegisterMsg($WM_CTLCOLORLISTBOX, "WM_CTLCOLORLISTBOX") $nList1 = GUICtrlCreateList("", 10, 10, 185, 200) GUICtrlSetData(-1, "Item1|Item2|Item3") $nList2 = GUICtrlCreateList("", 205, 10, 185, 200) GUICtrlSetData(-1, "Item1|Item2|Item3") While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd DeleteObject($hBrush1) DeleteObject($hBrush2) Exit Func WM_CTLCOLORLISTBOX($hWnd, $Msg, $wParam, $lParam) If $lParam = GUICtrlGetHandle($nList1) Then Return SetListBoxColor($wParam, $nTextClr1, $nBkClr1, $hBrush1) ElseIf $lParam = GUICtrlGetHandle($nList2) Then Return SetListBoxColor($wParam, $nTextClr2, $nBkClr2, $hBrush2) EndIf EndFunc Func SetListBoxColor($hDC, $nTextClr, $nBkColor, ByRef $hBrush) SetTextColor($hDC, $nTextClr) SetBkColor($hDC, $nBkColor) If $hBrush = 0 Then $hBrush = CreateSolidBrush($nBkColor) Return $hBrush EndFunc Func SetTextColor($hDC, $nColor) Local $nLastColor = DllCall("gdi32.dll", "int", "SetTextColor", "hwnd", $hDC, "int", $nColor) Return $nLastColor[0] EndFunc Func SetBkColor($hDC, $nColor) Local $nLastColor = DllCall("gdi32.dll", "int", "SetBkColor", "hwnd", $hDC, "int", $nColor) Return $nLastColor[0] EndFunc Func CreateSolidBrush($nColor) Local $hBrush = DllCall("gdi32.dll", "hwnd", "CreateSolidBrush", "int", $nColor) Return $hBrush[0] EndFunc Func DeleteObject($hObj) DllCall("gdi32.dll", "int", "DeleteObject", "hwnd", $hObj) EndFunc So long...so less time... Old project:GUI/Tray menu with icons and colors Other old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView
Rick Posted May 30, 2006 Posted May 30, 2006 Great stuff thanks Holger Who needs puzzles when we have AutoIt!!
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now