有如下事件过程。 Private Sub Form_KeyDown(KeyCode As Integer,Shift As Integer) If(Button And 3)=3 Then Print "OK"

admin2010-03-30  28

问题 有如下事件过程。    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、按什么都不显示

答案8

解析 此题考查的是有关鼠标事件的问题。从题目要求来看,上述事件应是鼠标事件过程,下面来看看有关鼠标事件的具体事件。
   按下鼠标键事件过程:
   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
   移动鼠标光标事件过程:
   Private Sub Form_MouseMove(Button As Integer,_ Shift As Integer,X As Single,Y As Single)
   End Sub
   以上3个鼠标事件过程具有相同的参数,含义如下: Button表示被按下的鼠标键。
   Shift表示Shift、Ctrl、Alt键状态。
   X,Y鼠标光标的当前位置。
   现在再来看一下事件过程,可知此事件过程并非鼠标事件过程,并且Button也不是事件过程的参数,即此事件过程的两个参数KeyCode和Shift在程序运行过程中并没有得到任何信息,所以无论按什么键都不显示任何内容。注意: 此事件过程并非鼠标事件过程,并且 Button也不是事件过程的参数,即该事件过程中的两个参数在程序运行时没有获得任何信息,所以无论按什么键都不显示任何内容。注意:键盘事件KeyDown、KeyPress和KeyUp。
转载请注明原文地址:https://kaotiyun.com/show/C41p777K
0

最新回复(0)