dasiuss Posted November 19, 2009 Share Posted November 19, 2009 hi i'm trying to do gui with all buttons and labels black, and with white text color. but some buttons have img. When i used GUICtrlSetDefBkColor nad/or GUICtrlSetDefColor buttons with img are black and with no icon. in this situation must i use GUICtrlSetColor for each control? or maybe there is some other solution? Link to comment Share on other sites More sharing options...
funkey Posted November 19, 2009 Share Posted November 19, 2009 I think this is a known bug with the buttons. You could use a function instead to make the buttons, so you don't have to set the color to every button. expandcollapse popupGUICreate("Black") ;~ GUICtrlSetDefBkColor(0) ;~ GUICtrlSetDefColor(0xFFFFFF) GUICtrlCreateButton("Button1", 20, 20) GUICtrlCreateButton("Button2", 20, 50) GUICtrlCreateButton("Button3", 20, 80) GUICtrlCreateButton("Button4", 20, 110) GUICtrlCreateButton("Button1", 120, 20, -1, -1, 0x0040) GUICtrlSetImage(-1, "shell32.dll", Random(1, 22, 1)) GUICtrlCreateButton("Button2", 120, 50, -1, -1, 0x0040) GUICtrlSetImage(-1, "shell32.dll", Random(1, 22, 1)) GUICtrlCreateButton("Button3", 120, 80, -1, -1, 0x0040) GUICtrlSetImage(-1, "shell32.dll", Random(1, 22, 1)) GUICtrlCreateButton("Button4", 120, 110, -1, -1, 0x0040) GUICtrlSetImage(-1, "shell32.dll", Random(1, 22, 1)) _MakeBlackButton("Button1", 220, 20) _MakeBlackButton("Button2", 220, 50) _MakeBlackButton("Button3", 220, 80) _MakeBlackButton("Button4", 220, 110) _MakeIconButton("Button1", 320, 20, "shell32.dll", Random(1, 22, 1)) _MakeIconButton("Button2", 320, 50, "shell32.dll", Random(1, 22, 1)) _MakeIconButton("Button3", 320, 80, "shell32.dll", Random(1, 22, 1)) _MakeIconButton("Button4", 320, 110, "shell32.dll", Random(1, 22, 1)) GUISetState() Do Until GUIGetMsg() = -3 Func _MakeBlackButton($sText, $left, $top, $width = Default, $height = Default, $style = -1, $exstyle = -1) GUICtrlCreateButton($sText, $left, $top, $width, $height, $style, $exstyle) GUICtrlSetBkColor(-1, 0) GUICtrlSetColor(-1, 0xFFFFFF) EndFunc Func _MakeIconButton($sText, $left, $top, $filename , $iconname = -1, $width = Default, $height = Default) GUICtrlCreateButton($sText, $left, $top, $width, $height, 0x0040) GUICtrlSetImage(-1, $filename, $iconname) EndFunc Programming today is a race between software engineers striving tobuild bigger and better idiot-proof programs, and the Universetrying to produce bigger and better idiots.So far, the Universe is winning. Link to comment Share on other sites More sharing options...
CodyBarrett Posted November 21, 2009 Share Posted November 21, 2009 Yes Button colors are a bug. but that is why i use a Label/multilabels to make my custom buttons.. because its so much more customizable haha and because i'm bored right now.. i will make a UDF for this lol [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size] Link to comment Share on other sites More sharing options...
dasiuss Posted November 21, 2009 Author Share Posted November 21, 2009 thx a lot. it will be very helpful Link to comment Share on other sites More sharing options...
CodyBarrett Posted November 21, 2009 Share Posted November 21, 2009 (edited) well... it may not be what your looking for but it might help. $gui = Guicreate (':o',200,50,-1,-1,-1,-1,Wingethandle ('[CLASS:Progman]','')) $Button = _lButton ('BUTTON',20,20,100,20) GUICtrlSetBkColor ($Button[1],0x414141) GUICtrlSetBkColor ($Button[2],0x313131) GUICtrlSetColor ($Button[3],0xFFFFFF) GUisetstate () While GUIGetMsg () <> -3 wend ;===================================================================================== ;=========$Text = the text that the user has used===================================== ;=========$x = the X position on the current GUI form================================= ;=========$y = the Y position on the current GUI form================================= ;=========$w = how wide the "Button" is to be========================================= ;=========$h = how tall the "Button" is to be========================================= ;===================================================================================== ;=========RETURN value = an array consisting of the 1st 2nd and 3rd Labels============ ;=========1st label has the TOP color================================================= ;=========2nd label has the BOTTOM color============================================== ;=========3rd label is transparent and is the one that has to have the Styles on it=== ;===================================================================================== ;===================================================================================== ;===================================================================================== Func _lButton ($Text,$x,$y,$w,$h) Local $CtrlID1, $CtrlID2, $CtrlID3 $CtrlID1 = GUICtrlCreateLabel ('',$x,$y,$w,$h / 2) GUICtrlSetState (-1,128) $CtrlID2 = GUICtrlCreateLabel ('',$x,$y + $h / 2,$w,$h / 2) GUICtrlSetState (-1,128) $CtrlID3 = GUICtrlCreateLabel ('Text',$x,$y,$w,$h,BitOR (1, 0x0200),0x00000001) GUICtrlSetBkColor (-1,-2) GUICtrlSetCursor (-1,0) Return StringSplit ($CtrlID1 & ',' & $CtrlID2 & ',' & $CtrlID3,',') EndFunc Edited November 21, 2009 by CodyBarrett [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size] Link to comment Share on other sites More sharing options...
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