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

admin2013-01-23  27

问题 有如下事件过程:    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_Mouse Up(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在程序运行过程中并没有得到任何信息,所以无论按什么键都不显示任何内容。
转载请注明原文地址:https://kaotiyun.com/show/bghp777K
0

随机试题
最新回复(0)