Friday, August 27, 2010

VB6.0 Changing Random Color

Private Sub Timer2_Timer()

Static A
A = A + 10: If A > 510 Then A = 0
//To change the effect, put other numbers insted of the 0 below.
//You can also replace places between the 'Abs(A - 256)' and one of thezeros below.
//To decrease the pace of the animation, increase the Timer intervalproperty.
cmdadditem.BackColor = RGB(Abs(A - 256), 100, 100)
cmdaddch.BackColor = RGB(Abs(A - 256), 50, 200)
cmdaddtocurrent.BackColor = RGB(Abs(A - 256), 150, 50)

End Sub

No comments: