2009/09/03(Thu) 20:10:28 編集(投稿者)
2009/09/03(Thu) 20:02:37 編集(投稿者)
■No40786 (Azulean さん) に返信
力技で解決しました。(こういうのはよろしくないと思うのですが)
こういったワザではプログラミングは上達しないでしょうか?もといプログラミングの素養に欠けるのかな?
Public Class Form1
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Timer2.Enabled = True
If PictureBox1.Left > 600 Then
Timer2.Enabled = False
PictureBox1.Top = PictureBox1.Top + 5
End If
If PictureBox1.Top > 300 Then
Timer2.Enabled = False
PictureBox1.Left = PictureBox1.Left - 5
End If
If PictureBox1.Left < 0 Then
Timer2.Enabled = False
PictureBox1.Top = PictureBox1.Top - 5
End If
If PictureBox1.Top < 0 Then
Timer2.Enabled = True
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Timer1.Enabled = Not Timer1.Enabled
If Timer1.Enabled = True Then
Button1.Text = "止まれ "
Else
Button1.Text = "スタート "
End If
End Sub
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
PictureBox1.Left += 5
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
PictureBox1.Left = 0
PictureBox1.Top = 0
End Sub
End Class