# 请问个问题...

Posted by 小T on August 27, 1999 at 18:15:32:

1.我写了以下程式测试,让表单绕着萤幕四周跑:
'宣告
Dim x, y, xdir, ydir As Integer

Private Sub Form_Load()
Me.Move -1, 0
Timer1.Interval = 1
Timer1.Enabled = True
End Sub

Private Sub Timer1_Timer()
x = Form1.Left
y = Form1.Top
x = x + xdir
y = y + ydir

If x + Form1.Width > Screen.Width Then xdir = 0: ydir = 20
If y + Form1.Height > Screen.Height Then xdir = -20: ydir = 0
If x < 0 Then xdir = 0: ydir = -20
If y < 0 Then xdir = 20: ydir = 0

Me.Move x, y
End Sub

请问为什么当表单在靠着上方向右移动到右边的边界时,并没有向下移动
而移出了萤幕外(看不到了),请问是否那有写错了呢?

Follow Ups:

- 试试这个! 大汉堡 01:35:58 8/28/99 (0)