已知在菜单编辑器中设计了窗体的快捷菜单,其主菜单为a1,且取消其“可见”属性,如图2所示。运行时,以下( )事件过程可以使快捷菜单的菜单项响应鼠标右键单击。

admin2018-12-20  34

问题 已知在菜单编辑器中设计了窗体的快捷菜单,其主菜单为a1,且取消其“可见”属性,如图2所示。运行时,以下(    )事件过程可以使快捷菜单的菜单项响应鼠标右键单击。

选项 A、Private Sub Form MouseDown(Button As Integer,
    Shift As Integer,X As Single,Y As Single)
    If Button=2 Then PopupMenu a1.2
  End Sub
B、Private Sub Form MouseDown(Button As Integer,
    Shift As Integer,X As Single,Y As Single)
    PopupMenu a1,0
  End Sub
C、Private Sub Form MouseDown(Button As Integer,
    Shift As Integer,X As Single,Y As Single)
    PopupMenu a1
  End Sub
D、Private Sub Form_MouseDown(Button As Integer,Shift As_
    Integer,X As Single,Y As Single)
    If(Button=vbLetfButton)Or(Button=vbRightButton)Then PopupMenu a1
    End Sub

答案A

解析 本题考查弹出菜单的显示。PopupMenu为弹出菜单方法,使用格式为:[对象.]PopupMenu 菜单名,标志,x,y:其中,标志表示弹出的位置和触发的键,取值为0表示弹出菜单的左端在x处且识别左键单击,取值为04表示位于x的中心,取值为08表示在x的右边,一般判断是否单击右键,可通过判断Button是否为2来实现。
转载请注明原文地址:https://jikaoti.com/ti/cwm0FFFM
0

最新回复(0)