我用键盘来控制一个图片的移动.但如何做个边界限制呢?就是碰到边限时提示?
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer) Select Case KeyCode Case vbKeyLeft Picture1.Left = Picture1.Left - 100 Case vbKeyUp Picture1.Top = Picture1.Top - 100 Case vbKeyDown Picture1.Top = Picture1.Top + 100 Case vbKeyRight Picture1.Left = Picture1.Left + 100 End Select End Sub
Private Sub Form_Load() Me.KeyPreview = True End Sub
[此贴子已经被作者于2004-06-22 22:40:03编辑过]