jmosley708 Posted June 3, 2008 Posted June 3, 2008 I'm building a keno game and I'm using 80 buttons to select the numbers. I would like to know of a way to randomly select and change the buttons color from a function. Thanks
monoceres Posted June 3, 2008 Posted June 3, 2008 Maby something like this: GUICreate("Sample",610,500) Dim $controls[180] Dim $x=10, $y=10 For $i=0 To Ubound($controls)-1 $controls[$i]=GUICtrlCreateButton($i,$x,$y,30,30) $x+=40 If $x>=600 Then $x=10 $y+=40 EndIf Next GUISetSTate() _RandomizeControlColor($controls) Do $msg=GUIGetMsg() Until $msg=-3 Func _RandomizeControlColor($array) For $i=0 To UBound($array)-1 GUICtrlSetBkColor($array[$i],Random(0x000000,0xFFFFFF,1)) Next EndFunc Broken link? PM me and I'll send you the file!
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