Eklenecek nesneler; timer1, shape1
(timer1'in interval özelliğini 10 yapıyoruz)
(shape1'in shape özelliğini circle seçiyoruz)
(timer1'in interval özelliğini 10 yapıyoruz)
(shape1'in shape özelliğini circle seçiyoruz)
Kod:
Private Sub Timer1_Timer()
Static ax, ay
If IsEmpty(ax) Then
ax = 50
ay = 50
End If
If Shape1.Top <= 0 Or Shape1.Top >= Form1.ScaleHeight - Shape1.Height Then
ay = -ay
Beep
End If
If Shape1.Left <= 0 Or Shape1.Left >= Form1.ScaleWidth - Shape1.Width Then
ax = -ax
Beep
End If
Shape1.Left = Shape1.Left + ax
Shape1.Top = Shape1.Top + ay
End Sub