[单项选择题] 假定已经在菜单编辑器中建立了窗体的d出式菜单,其顶级菜单项的名称为a1,其“可见”属性为False。程序运行后,单击鼠标左键或右键都能d出菜单的事件过程是( )。
A.Private Sub Form_MouseDown(Button AS Intege, _Shift As Integer, X As Single, Y As Single)
If Button=1 And Button=2 Then
PopupMenu a1
End If
End Sub
B.Private Sub Form MouseDown(Button As Integeg_Shift As Integer, X As Single, Y As Single)
PopupMenu a1
End Sub
C.Private Sub Form MouseDown(Button As Intege_Shift As Integeg, X As Single, Y As Single)
If Button=1 Then
PopupMenu a1
End If
End Sub
D.Private Sub Form_MouseDown(Button As Integer, _Shift As Integer, X As Single, Y As Single)
If Button=2 Then
PopupMenu a1
End If
End sub
正确答案:B
参考解析:鼠标事件分点击事件和状态事件:点击事件有单击(Click)和双击(Db1Click),不区分左键和右键;状态事件有按下(MouseDown)、移动(MouseMove)和d起(MouseUp),能够通过Button区分出鼠标的左键和右键,如果Button取值为1代表按下鼠标左键,Button取值为2代表按下鼠标右键,杳然无论单击左键还是右键都能d出菜单,应该不判断Button的值。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)