itgle.com

窗体的 MouseDown 事件过程 Form_MouseDown(ButtonAsInteger,ShiftAsInteger, XAsSingle,YAsSingle)有4今参数,关于这些参数,正确的描述是_________。A.通过Button参数判定当前按下的是哪一个鼠标键B.Shift参数只能用来确定是否按下Shift键C.Shift参数只能用来确定是否按下Alt和Ctrl键D.参数X,Y用来设置鼠标当前位置的坐标

题目

窗体的 MouseDown 事件过程 Form_MouseDown(ButtonAsInteger,ShiftAsInteger, XAsSingle,YAsSingle)有4今参数,关于这些参数,正确的描述是_________。

A.通过Button参数判定当前按下的是哪一个鼠标键

B.Shift参数只能用来确定是否按下Shift键

C.Shift参数只能用来确定是否按下Alt和Ctrl键

D.参数X,Y用来设置鼠标当前位置的坐标


相似考题
更多“窗体的MouseDown 事件过程 Form_MouseDown(ButtonAsInteger,ShiftAsInteger, XAsSingle,YAsSingl ”相关问题
  • 第1题:

    对窗体编写如下事件过程: Private Sub Form_ Mouse Down(Button As Integer,Shift As Integer,X AS Single,Y As Single) If Button=2 Then Print "AAAAA" End if End Sub Private Sub Form. _ MouseUp(Button As Integer,Shift As Integer,X As Single,Y As Single) Print "BBBBB" End Sub 程序运行后,如果单击鼠标右键,则输出结果为 ______。

    A.AAAAA BBBBB

    B.BBBBB AAAAA

    C.AAAAA

    D.BBBBB


    正确答案:A
    解析:在窗体上单击鼠标右键时,实际上先后触发了两个事件,即先触发MouseDown事件,执行Print方法输出AAAAA;当释放鼠标键时,触发MouseUp事件,再次执行Print方法,输出BBBBB。其实在Visual Basic中类似的还有DblCtick事件,也是先后触发了两个事件,即当双击鼠标时,先触发Click事件,再触发 DblClick事件。

  • 第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。

  • 第6题:

    对窗体编写如下事件过程: Private Sub Form. MouseDown(Button As Integer,Shift As Integer, _ x As Single, Y As Single) If Button=2 Then Print "AAA" End If End Sub Private Sub Form. MouseUp (Button As Integer,Shift As Integer,_ x As Single,Y As Single) Print "BBB" End Sub 程序运行后,如果单击鼠标右键,则输出结果为 ______。

    A.AAA BBB

    B.BBB

    C.AAA AAA

    D.BBB


    正确答案:A
    解析:窗体的MouseDown和MouseUp中,Button参数是具有相应于左按钮(位0)、右按钮(位1),以及中间按钮(位2)的一个位字段。这些位的值分别等于1、2和4。其中仅有一位被设置,指示出引起该事件的那个按钮。本题中MouseDown事件会首先判断按下的是哪个鼠标键,如果是右键则输出AAA。然后在MouseUp事件中输出BBB。