永发信息网

vb控制斜上方移动

答案:1  悬赏:10  手机版
解决时间 2021-08-18 10:44
  • 提问者网友:饥饿走向夜
  • 2021-08-17 23:54


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

 

 

我想控制斜上方移动怎么办?

最佳答案
  • 五星知识达人网友:白昼之月
  • 2021-08-18 01:13
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

我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯