Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 37 Then
plane.Left = plane.Left - 100
End If
If KeyCode = 38 Then
plane.Top = plane.Top - 100
End If
If KeyCode = 39 Then
plane.Left = plane.Left + 100
End If
If KeyCode = 40 Then
plane.Top = plane.Top + 100
End If
End Sub
我想控制斜上方移动怎么办?
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 37 Then
plane.Left = plane.Left - 100
End If
定义按Ctrl+左 为斜上方
If KeyCode = 37 and (Shift and vbctrlmask >0) Then
plane.Left = plane.Left - 100
plane.Top = plane.Top - 100
End If
If KeyCode = 38 Then
plane.Top = plane.Top - 100
End If
If KeyCode = 39 Then
plane.Left = plane.Left + 100
End If
If KeyCode = 40 Then
plane.Top = plane.Top + 100
End If
End Sub
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息