有如下事件过程: Private Sub Form_KeyDown(KeyCode As Integer,Shift As Integer) If (Button And 3) =3 Then Print "OK" End If End Sub 程序运行后,为了在窗体上输出“OK”,应当按下的鼠标键是 A) 左键 B) 右键 C) 同时按下左键和右键 D) 按什么键都不显示
参考答案:D
解析: 此题考查的是有关鼠标事件的问题。从题目要求来看,上述事件应是鼠标事件过程,下面来看看有关鼠标事件的具体事件。 按下鼠标键事件过程: Private Sub Form_MouseDown(Button As Integer,Shift As Integer,X As Single,Y As Single) End Sub 松开鼠标键事件过程: Private Sub Form_MouseUp(Button As Integer,Shift As Integer,X As Single,Y As Single) End Sub 移动鼠标光标事件过程: Privme Sub Form_MouseMove(Button As Interger,Shift As Integer,X As Single,Y As Single) End Sub 以上3个鼠标事件过程具有相同的参数,含义如下: Button表示被按下的鼠标键; Shift表示Shift、Ctrl、Alt键状态; X,Y表示鼠标光标的当前位置。 现在再来看一下事件过程,可知此事件过程并非鼠标事件过程,并且Button也不是事件过程的参数,即此事件过程的两个参数KeyCode和Shift在程序运行过程中并没有得到任何信息,所以无论按什么键都不显示任何内容。