Rainbow colors in vb6

  • Thread starter Thread starter HiImAPerson
  • Start date Start date
H

HiImAPerson

Guest
Hello, I would just like to ask how you would be able to create a button or option box that when clicked, will change the background color of the form to flashing rainbow colors.

I've created this but it's too long and not compact so I wanted to know how you can do it more shortly.

I used 7 timers, each change the background color of the form by one color. Like this:


Private Sub Timer1_Timer()
Form1.BackColor = RGB (255, 0, 0)
Timer2.Enabled = True
Timer1.Enabled = False
End Sub

Private Sub Timer2_Timer()
Form1.BackColor = RGB (255, 130, 0)
Timer3.Enabled = True
Timer2.Enabled = False
End Sub

Private Sub Timer3_Timer()
Form1.BackColor = RGB (0, 255, 130)
Timer4.Enabled = True
Timer3.Enabled = False
End Sub

Private Sub Timer4_Timer()
Form1.BackColor = RGB (0, 255, 0)
Timer5.Enabled = True
Timer4.Enabled = False
End Sub

Private Sub Timer5_Timer()
Form1.BackColor = RGB (0, 0, 255)
Timer6.Enabled = True
Timer5.Enabled = False
End Sub




and so on...



Please tell me how I can make this code shorter. All help would be appreciated. Thanks.

Stephen

Continue reading...
 
Back
Top