Автор:
Леонид | добавлено: 04.12.2014, 14:10 | просмотров: 7046 (5+) | комментариев:
0 | рейтинг:
x6
' 1 способ:
Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer1.Tick
Static A1
A1 = A1 + 10
If A1 > 510 Then A1 = 0
Button1.BackColor = System.Drawing.Color.FromArgb(Math.Abs(A1 - 255), 0, 0)
' Button1.BackColor = Color.FromArgb(Math.Abs(A1 - 255), 0, 0)' так тоже работает
Label1.BackColor = System.Drawing.Color.FromArgb(Math.Abs(A1 - 255), 0, 0)
End Sub
'2 способ:
Dim Mig As Boolean
Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer1.Tick
If Mig = True Then
Me.Button1.BackColor = Color.Red
Mig = False
Application.DoEvents()
Else
Me.Button1.BackColor = Color.Orange
Mig = True
Application.DoEvents()
End If