I write a simple code with Timer. but when I start timer and then when I try to move form with mouse dawn or when I try to click a Button response with delayed.
What I am doing Wrong ?
Code:
Public Class Form3
Dim _RGB As Integer
Dim renk As Color
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
Dim hiz As Double
hiz = -0.4
For i = 256 To 0 Step hiz
_RGB = RGB(i, 0, 0) 'VScrollBar1.Value, 0, 0) ', VScrollBar2.Value, VScrollBar3.Value)
renk = ColorTranslator.FromOle(_RGB)
'RectangleShape1.FillColor = renk
PictureBox1.BackColor = renk
PictureBox1.Refresh()
Next i
For i = 256 To 0 Step hiz
_RGB = RGB(0, i, 0) 'VScrollBar1.Value, 0, 0) ', VScrollBar2.Value, VScrollBar3.Value)
renk = ColorTranslator.FromOle(_RGB)
'RectangleShape1.FillColor = renk
PictureBox2.BackColor = renk
PictureBox2.Refresh()
Next i
For i = 256 To 0 Step hiz
_RGB = RGB(0, 0, i) 'VScrollBar1.Value, 0, 0) ', VScrollBar2.Value, VScrollBar3.Value)
renk = ColorTranslator.FromOle(_RGB)
'RectangleShape1.FillColor = renk
PictureBox3.BackColor = renk
PictureBox3.Refresh()
Next i
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If Timer1.Enabled = False Then
Timer1.Start()
Else
Timer1.Stop()
End If
End Sub
End Class