0
"i"(i As Integer = 0)が90に達するとタイマーが止まるようにします。しかし、テストすると "i"が100に達するとタイマーが止まります。 「i」が90のときに停止しましたが、「i」は100に変更されました。問題を解決するにはどうすればよいですか? あなたは私のexplaination、HERESにコード私が望むようにタイマが正しく停止しない
Dim i As Integer = 0
Private Sub PictureBox1_MouseHover(sender As Object, e As EventArgs) Handles PictureBox1.MouseHover
Form3.Show() '<<You can ignore this
Timer2.Start() '<<You can ignore this
Timer4.Start()
End Sub
Private Sub PictureBox1_MouseLeave(sender As Object, e As EventArgs) Handles PictureBox1.MouseLeave
Timer2.Stop() '<<You can ignore this
Timer3.Start() '<<You can ignore this
Timer4.Stop()
Timer5.Start()
End Sub
Private Sub Timer4_Tick(sender As Object, e As EventArgs) Handles Timer4.Tick
If i = "90" Then
Timer4.Stop()
End If
i = i + 10
PictureBox1.Invalidate()
TextBox2.Text = i '<< I want to check the "i"
End Sub
Private Sub PictureBox1_Paint(sender As Object, e As PaintEventArgs) Handles PictureBox1.Paint
With e.Graphics
.TranslateTransform(PictureBox1.Width \ 2, PictureBox1.Height \ 2)
.RotateTransform(i)
.DrawImage(Image.FromFile("D:\Gambar Desktop\RodMerah.png"), -(PictureBox1.Width \ 2), (-PictureBox1.Height \ 2))
End With
End Sub
Private Sub Timer5_Tick(sender As Object, e As EventArgs) Handles Timer5.Tick
If i = 0 Then
Timer5.Stop()
End If
i = i - 10
PictureBox1.Invalidate()
End Sub
整数を文字列と比較しないでください!最終的には問題が発生します。 –