I need to fade a window's background color from white to black. (it should take afew seconds)
Thanks for any help i get!
Printable View
I need to fade a window's background color from white to black. (it should take afew seconds)
Thanks for any help i get!
Add the following code to a Form with a CommandButton.
Code:Private Sub Command1_Click()
For i = 0 To 255
'This line is necessary to create a pause so you can see the Form's
'colour fading. The Interval (50000) should vary from computer to computer.
'This works fine on my 500Mhz CPU)
For x = 1 To 50000
Next x
DoEvents
Me.BackColor = RGB(i, i, i)
Next i
End Sub
That makes it fade from black to white.
Try this instead:
Code:Private Sub Command1_Click()
For i = 255 To 0 Step -1
DoEvents
For x = 1 To 50000
Next x
Me.BackColor = RGB(i, i, i)
Next i
End Sub