◆VB初心者質問スレ Part5
■ このスレッドは過去ログ倉庫に格納されています
0849ぱるぷんて
NGNGフォームの左端にきたら右方向へ移動しなさいという問題なのですが,
Dim ax As Integer
Private Sub Form_Load()
ax = 100
End Sub
Private Sub Timer1_Timer()
Image1.Left = Image1.Left + ax
If Image1.Left >= Form1.ScaleWidth - Image1.Width Or Image1.Left <=0 Then
ax = -ax
End If
End Sub
では、うまくいくのですが、
Private Sub Timer1_Timer()
dim ax as integer
ax = 100
Image1.Left = Image1.Left + ax
If Image1.Left >= Form1.ScaleWidth - Image1.Width Or Image1.Left < 0 Then
ax = -ax
End If
End Sub
だとうまくいきません。これはなぜですか?タイマーイベントだと宣言はgeneral declarationsでしなければならい
とか、この場合axなどの初期値はform loadに書かなければならないという決まりがあるのでしょうか?
■ このスレッドは過去ログ倉庫に格納されています