设已经在菜单编辑器中设计了窗体的快捷菜单,其顶级菜单为Bt,取消其“可见”属性,运行时,在以下事件过程中,可以使快捷菜单相应鼠标右键菜单的是A.Private Sub Form_MouseDown(Button As Integer, Shift As Integer,_ X As Single, Y As Single) If Button=2 Then PopupMenu Bt, 2 End SubB.Private Sub Form_MouseDown(Button As Integer, Shif

题目

设已经在菜单编辑器中设计了窗体的快捷菜单,其顶级菜单为Bt,取消其“可见”属性,运行时,在以下事件过程中,可以使快捷菜单相应鼠标右键菜单的是

A.Private Sub Form_MouseDown(Button As Integer, Shift As Integer,_ X As Single, Y As Single) If Button=2 Then PopupMenu Bt, 2 End Sub

B.Private Sub Form_MouseDown(Button As Integer, Shift As Integer, _ X As Single, Y As Single) PopupMenu Bt End Suh

C.Private Sub Form. MouseDown(Button As Integer, Shift As Integer, _ X As Single, Y As Single) PopupMenu Bt,0 End Sub

D.Private Sub Form_MouseDown(Button As Integer, Shift As Integer, _ X As Single, Y As Single) If (Button=vbLeftButton) Or ( Button=vbRightButton) Then PopupMenu Bt End Sub


相似考题
参考答案和解析
正确答案:A
解析:在VisualBasic中,允许出现快捷菜单,对用户来说,提供了很大的方便,一般来说,菜单都在窗口的顶部,有时,用户需要执行菜单中的某一命令,就得把鼠标移动到窗口顶部,然后打开菜单选择命令,这对用户来说,会觉得麻烦。而快捷菜单并不需要到窗口的顶部来打开,只要单击鼠标右键,就会弹出菜单。设计快捷菜单仍然可以用VisualBasic中提供的菜单编辑器,只要把某个菜单设置成隐藏就可以了,实际上,不管是在窗口顶部菜单条上显示的菜单还是隐藏的菜单,都可以用PopupMenu方法把它们作为快捷菜单在运行时显示出来。PopupMenu方法的使用形式如下:[对象].PopupMenu菜单名,标志,x,y其中,x,y是提供菜单显示的位置;标志:指定快捷菜单的行为。当标志为0时,快捷菜单中的项只能对鼠标左键起反应;当标志为2时,快捷菜单中的项对鼠标右键和左键都反应;标志为2时,PopupMenu方法只能用在MouseDown事件过程中。
更多“设已经在菜单编辑器中设计了窗体的快捷菜单,其顶级菜单为Bt,取消其“可见”属性,运行时,在以下事件 ”相关问题
  • 第1题:

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


    正确答案:A
    A)    【解析】本题考查弹出菜单的显示。PopupMenu 为弹出菜单方法,使用格式为:[对象.]PopupMenu 菜单名,标志,x,y;其中,标志表示弹出的位置和触发的键,取值为0表示弹出菜单的左端在x处且识别左键单击,取值为04表示位于x的中心,取值为08表示在x的右边,一般判断是否单击右键,可通过判断Button是否为2来实现。

  • 第2题:

    设已经在"菜单编辑器"中设计了窗体的快捷菜单,其顶级菜单为Bs,取消其"可见"属性,运行时,在以下事件过程中,可以使快捷菜单响应鼠标右键菜单的是

    A.Private Sub Form_MouseDown(Button As Integer, Shift As Integer,_X As Single,Y As Single) If Button=2 Then PopupMenu Bs, 2 End Sub

    B.Private Sub Form_MouseDown(Button As Integer, Shift As Integer,_X As Single,Y As Single) PopupMenu Bs End Sub

    C.Private Sub Form_MouseDown(Button As Integer, Shift As Integer,_X As Single,Y As Single) PopupMenu Bs,0 End Sub

    D.Private Sub Form_MouseDown(Button As Integer, Shift As Integer,_X As Single,Y As Single) If (Button=vbLeftButton) Or (Button=vbRightButton) Then PopupMenu Bs End Sub


    正确答案:A
    解析:考查弹出式菜单的使用方法。实际上,不管是在窗口顶部菜单条上显示的菜单,还是隐藏的菜单,都可以用PopupMenu方法把它们作为快捷菜单在运行时显示出来。

  • 第3题:

    设已经在菜单编辑器中设计了窗体的快捷菜单,某顶级菜单为al,且取消其"可见"属性。运行时,可以使快捷菜单的菜单项响应鼠标左键单击和右健单击的事件过程是

    A.Private Sub Form_Mouse Down(Button As Integer, Shift As Integer,_X As Single,Y As Single If Button=2 Then PopupMenu al,2 End Sub

    B.Private Sub Form_Mouse Down(Button As Integer, Shift As Integer,_X As Single, Y As Single PopupMenu al,0 End Sub

    C.Private Sub Form_Mouse Down(Button As Integer, Shift As Integer,_X As Single,Y As Single PopupMenu al End Sub

    D.Private Sub Form_Mouse Down(Button As Integer, Shift As Integer,_X As Single,Y As Single If(Button=vbLetfButton) Or (Button=vbRightButton) Then PopupMenu al End Sub


    正确答案:C
    解析:MouseDown事件用来响应鼠标单击,其中Button的参数用来确认鼠标按钮(1:左键;2:右键),PopupMenu 方法用以在指定坐标位置显示弹出式菜单,语法如下:[对象].PopupMenu 菜单名,标志,x,y。其中中x,y提供菜单显示位置;标志:指定快捷菜单的行为。

  • 第4题:

    假定已经在菜单编辑器中建立了窗体的弹出式菜单,其顶级菜单的名称为a1,其“可见”属性为False,则程序运行后,可以同时响应鼠标左键单击和右键单击的事件过程是 ______。

    A.Private Sub Form_ MouseDown (Button As Integer, _ Shift As Integer, X As Single, Y As SinglE)If Button = 1 And Button = 2 Then PopupMenu al End If End Sub

    B.Private Sub Form_ MouseDown (Button As Integer, _ Shift As Integer, X As Single, Y As SinglE)PopupMenu a1 End Sub

    C.Private Sub Form_ MouseDown (Button As Integer, _ Shift As Integer, X As Single, Y As SinglE)If Button = 1 Then PopupMenu a 1 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 a 1 End If End Sub


    正确答案:B

  • 第5题:

    假定已经在菜单编辑器中建立了窗体的弹出式菜单,其顶级菜单的名称为al,其“可见”属性为False。程序运行后,单击鼠标左键或右键都能弹出菜单的事件过程是( )。

    A.Private Sub Form_MouseDown(Button As Integer,_Shift As Integer,X As Single, Y As Single) If Button=1 And Blltton=2Then PopupMenu a1 End If End Sub

    B.Private Stlb Form_MouseDown(Button As Integer,_Shift As Integer,X As Single, Y As Single) PopupMenu a1 End Sub

    C.Private Sub Form—MouseDown(Button As Integer,_Shift As Integer,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 Buttcn=2 Then PopupMenu a1 End If End Sub


    正确答案:B
    B。【解析】表示窗体的弹出式菜单使用PopupMerm,而单击鼠标的左键或者右键都能弹出菜单,使用的是MoseDown,并且使用Button控制按下的鼠标键Button=1表示的是单击左键,Button=2表示的是单击右键,所以当Button=1或者Button=2时才能实现此功能,所以答案选择B。