Lord Maim Posted December 14, 2006 Posted December 14, 2006 I'm trying to use the GUICtrlCreateGroup command for visual effect, and the text label doesn't display in the correct color. The help file says that I can use the GUICtrlSetColor command for groups, but it doesn't seem to work. Here's some sample code to look at. Any suggestions? expandcollapse popup#include<GUIConstants.au3> Global $GuiTest = GUICreate("Color Test", 330, 220, -1, -1, BitOR($WS_SYSMENU,$WS_CAPTION,$WS_MINIMIZEBOX,$WS_POPUPWINDOW,$WS_BORDER,$WS_CLIPSIBLINGS), BitOR($WS_EX_TOPMOST,$WS_EX_WINDOWEDGE)) GUISetBkColor(0x585768) Global $GuiLabel = GUICtrlCreateLabel("A bunch of buttons in a test GUI",0,20,330,15,$SS_CENTER) GUICtrlSetColor(-1,0xffffff) Global $Section1 = GUICtrlCreateGroup("This Text Should Be White",10,40,310,170) GUICtrlSetColor(-1,0xffffff) Global $ButtonLabel1 = GUICtrlCreateLabel("Item Label 1",20,60,130,15) GUICtrlSetColor(-1,0xffffff) Global $Button1 = GUICtrlCreateButton("Button 1",140,55,170,25) Global $ButtonLabel2 = GUICtrlCreateLabel("Item Label 2",20,90,130,15) GUICtrlSetColor(-1,0xffffff) Global $Button2 = GUICtrlCreateButton("Button 2",140,85,170,25) Global $ButtonLabel3 = GUICtrlCreateLabel("Item Label 3",20,120,130,15) GUICtrlSetColor(-1,0xffffff) Global $Button3 = GUICtrlCreateButton("Button 3",140,115,170,25) Global $ButtonLabel4 = GUICtrlCreateLabel("Item Label 4",20,150,130,15) GUICtrlSetColor(-1,0xffffff) Global $Button4 = GUICtrlCreateButton("Button 4",140,145,170,25) Global $ButtonLabel5 = GUICtrlCreateLabel("Item Label 5",20,180,130,15) GUICtrlSetColor(-1,0xffffff) Global $Button5 = GUICtrlCreateButton("Button 5",140,175,170,25) GUISetState(@SW_SHOW,$GuiTest) While 1 $msg = GUIGetMsg(1) Select Case $msg[0] = $GUI_EVENT_CLOSE Exit EndSelect WEnd
Schlumpf Posted December 14, 2006 Posted December 14, 2006 it only works in the "Classic Windows Theme". [CENTER]Sorry for my bad English... ;)[/CENTER]
Valuater Posted December 14, 2006 Posted December 14, 2006 This will do the trick expandcollapse popup#include<GUIConstants.au3> Global $GuiTest = GUICreate("Color Test", 330, 220, -1, -1, BitOR($WS_SYSMENU, $WS_CAPTION, $WS_MINIMIZEBOX, $WS_POPUPWINDOW, $WS_BORDER, $WS_CLIPSIBLINGS), BitOR($WS_EX_TOPMOST, $WS_EX_WINDOWEDGE)) GUISetBkColor(0x585768) Global $GuiLabel = GUICtrlCreateLabel("A bunch of buttons in a test GUI", 0, 20, 330, 15, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) Global $Section1 = XSkinGroup("This Text Should Be White", 10, 40, 310, 170, 0xffffff) ; GUICtrlSetColor(-1,0xffffff) Global $ButtonLabel1 = GUICtrlCreateLabel("Item Label 1", 20, 60, 130, 15) GUICtrlSetColor(-1, 0xffffff) Global $Button1 = GUICtrlCreateButton("Button 1", 140, 55, 170, 25) Global $ButtonLabel2 = GUICtrlCreateLabel("Item Label 2", 20, 90, 130, 15) GUICtrlSetColor(-1, 0xffffff) Global $Button2 = GUICtrlCreateButton("Button 2", 140, 85, 170, 25) Global $ButtonLabel3 = GUICtrlCreateLabel("Item Label 3", 20, 120, 130, 15) GUICtrlSetColor(-1, 0xffffff) Global $Button3 = GUICtrlCreateButton("Button 3", 140, 115, 170, 25) Global $ButtonLabel4 = GUICtrlCreateLabel("Item Label 4", 20, 150, 130, 15) GUICtrlSetColor(-1, 0xffffff) Global $Button4 = GUICtrlCreateButton("Button 4", 140, 145, 170, 25) Global $ButtonLabel5 = GUICtrlCreateLabel("Item Label 5", 20, 180, 130, 15) GUICtrlSetColor(-1, 0xffffff) Global $Button5 = GUICtrlCreateButton("Button 5", 140, 175, 170, 25) GUISetState(@SW_SHOW, $GuiTest) While 1 $msg = GUIGetMsg(1) Select Case $msg[0] = $GUI_EVENT_CLOSE Exit EndSelect WEnd Func XSkinGroup($text, $Pleft, $Ptop, $Pwidth, $Pheight, $color) Local $XS_n, $PControl If StringInStr(@OSTYPE, "WIN32_NT") Then $XS_n = DllCall("uxtheme.dll", "int", "GetThemeAppProperties") DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", 0) EndIf $PControl = GUICtrlCreateGroup($text, $Pleft, $Ptop, $Pwidth, $Pheight) ;GUICtrlSetBkColor($PControl, $color) GUICtrlSetColor($PControl, $color) If StringInStr(@OSTYPE, "WIN32_NT") And IsArray($XS_n) Then DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", $XS_n[0]) EndIf Return $PControl EndFunc ;==>XSkinGroup 8)
Lord Maim Posted December 14, 2006 Author Posted December 14, 2006 Valuater said: This will do the trick8)Thanks a lot Valuater, that solves the problem nicely. I was about to complain that for some reason it made my text light blue instead of white until I realized that I was short an 'f'. One of those days...Thanks again!
Valuater Posted November 6, 2007 Posted November 6, 2007 toothyXdip said: I used this in my script and it works fine but i have a couple questions on the XSkinGroup. What exactly is this func doing, can you explain to me? Cause i dont like using things that do something that i want to do if i dont do it myself or at least understand what is happing. So if you could do that that would be much appreciated Thanks expandcollapse popup#include<GUIConstants.au3> Global $GuiTest = GUICreate("Color Test", 330, 220, -1, -1, BitOR($WS_SYSMENU, $WS_CAPTION, $WS_MINIMIZEBOX, $WS_POPUPWINDOW, $WS_BORDER, $WS_CLIPSIBLINGS), BitOR($WS_EX_TOPMOST, $WS_EX_WINDOWEDGE)) GUISetBkColor(0x585768) Global $GuiLabel = GUICtrlCreateLabel("A bunch of buttons in a test GUI", 0, 20, 330, 15, $SS_CENTER) GUICtrlSetColor(-1, 0xffffff) Global $Section1 = XSkinGroup("This Text Should Be White", 10, 40, 310, 170, 0xffffff) ; GUICtrlSetColor(-1,0xffffff) Global $ButtonLabel1 = GUICtrlCreateLabel("Item Label 1", 20, 60, 130, 15) GUICtrlSetColor(-1, 0xffffff) Global $Button1 = GUICtrlCreateButton("Button 1", 140, 55, 170, 25) Global $ButtonLabel2 = GUICtrlCreateLabel("Item Label 2", 20, 90, 130, 15) GUICtrlSetColor(-1, 0xffffff) Global $Button2 = GUICtrlCreateButton("Button 2", 140, 85, 170, 25) Global $ButtonLabel3 = GUICtrlCreateLabel("Item Label 3", 20, 120, 130, 15) GUICtrlSetColor(-1, 0xffffff) Global $Button3 = GUICtrlCreateButton("Button 3", 140, 115, 170, 25) Global $ButtonLabel4 = GUICtrlCreateLabel("Item Label 4", 20, 150, 130, 15) GUICtrlSetColor(-1, 0xffffff) Global $Button4 = GUICtrlCreateButton("Button 4", 140, 145, 170, 25) Global $ButtonLabel5 = GUICtrlCreateLabel("Item Label 5", 20, 180, 130, 15) GUICtrlSetColor(-1, 0xffffff) Global $Button5 = GUICtrlCreateButton("Button 5", 140, 175, 170, 25) GUISetState(@SW_SHOW, $GuiTest) While 1 $msg = GUIGetMsg(1) Select Case $msg[0] = $GUI_EVENT_CLOSE Exit EndSelect WEnd [color="#0000FF"][b]Func XSkinGroup($text, $Pleft, $Ptop, $Pwidth, $Pheight, $color) Local $XS_n, $PControl If StringInStr(@OSTYPE, "WIN32_NT") Then $XS_n = DllCall("uxtheme.dll", "int", "GetThemeAppProperties") DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", 0) EndIf $PControl = GUICtrlCreateGroup($text, $Pleft, $Ptop, $Pwidth, $Pheight) ;GUICtrlSetBkColor($PControl, $color) GUICtrlSetColor($PControl, $color) If StringInStr(@OSTYPE, "WIN32_NT") And IsArray($XS_n) Then DllCall("uxtheme.dll", "none", "SetThemeAppProperties", "int", $XS_n[0]) EndIf Return $PControl EndFunc ;==>XSkinGroup[/b][/color] This thread ( where you got this info ) explains that classic theme is set so "color" functions can be utilized on Win Xp and then Win Xp is re-set to the orginal theme .... if you dont want to use it then dont use it... period! 8)
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