Sign in to follow this  
Followers 0
jmosley708

Changing button properties

2 posts in this topic

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

Share this post


Link to post
Share on other sites



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!

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0