itgle.com

编写如下事件过程: Private Sub Form_MouseDown(Button AS Integer,Shift AS Integer,_ X As Single,Y As Single) If Shift=6 And Button=2 Then Print,"PC" End If End Sub 程序运行后,为了在窗体上输出“PC”,应执行的操作为A.同时按下Shift键和鼠标左键B.同时按下Ctrl,Alt键和鼠标右键C.同时按下Shift键和鼠标右键D.同时按下Ctrl,Alt键和鼠标左键

题目

编写如下事件过程: Private Sub Form_MouseDown(Button AS Integer,Shift AS Integer,_ X As Single,Y As Single) If Shift=6 And Button=2 Then Print,"PC" End If End Sub 程序运行后,为了在窗体上输出“PC”,应执行的操作为

A.同时按下Shift键和鼠标左键

B.同时按下Ctrl,Alt键和鼠标右键

C.同时按下Shift键和鼠标右键

D.同时按下Ctrl,Alt键和鼠标左键


相似考题
更多“编写如下事件过程: Private Sub Form_MouseDown(Button AS Integer,Shift AS Integer,_ ”相关问题
  • 第1题:

    对窗体编写如下事件过程: Private Sub Form_ MouseDown(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

    C.AAAAA

    D.BBBBB AAAAA


    正确答案:A

  • 第2题:

    ( 25 )要求当鼠标在图片框 P1 中移动时,立即在图片框中显示鼠标的位置坐标。下面能正确实现上述功能的事件过程是

    A )

    Private Sub P1_MouseMove ( Button AS Integer,Shift As Integer,X As Single,

    Y As Single )

    Print X,Y

    End Sub

    B )

    Private Sub P1_MouseDown ( Button AS Integer,Shift As Integer,X As Single,

    Y As Single )

    Picture.Print X,Y

    End Sub

    C )

    Private Sub P1_MouseMove ( Button AS Integer,Shift As Integer,X As Single,

    Y As Single )

    P1.Print X,Y

    E n d S u b

    D )

    Private Sub Form_MouseMove ( Button AS Integer,Shift As Integer,X As Single,

    Y As Single )

    P1.Print X,Y

    End Sub


    正确答案:C

  • 第3题:

    编写如下事件过程:()Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) If (Button And 3) = 3 ThenPrint "AAAA"End IfEnd Sub程序运行后,为了在窗体输出“AAAA”,应按下的鼠标键为()

    A、左

    B、右

    C、同时按下左、右

    D、按什么键都不显示


    参考答案D

  • 第4题:

    设已经在菜单编辑器中设计了窗体的快捷菜单,其顶级菜单为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事件过程中。

  • 第5题:

    编写了如下事件过程: Private Sub Form_MouseDown(KeyCode As Integer,Shift As Integer) If (Button And 3)=3 Then Print"AAAA" End If End Sub 程序运行后,为了在窗体上输出“AAAA”,应按下的鼠标键是

    A.左

    B.右

    C.同时按下左和右

    D.按什么键都不显示


    正确答案:D
    解析:本题主要是对if语句的考查。如果if语句后的条件为真,则执行Then后边的语句,否则不执行。Button And 3是一个逻辑表达式,其结果只可能为。或1,故条件 (ButtonAnd 3)=3永远不成立,即语句print“AAAA”永远都不被执行。根据上面的分析可知选项D正确。

  • 第6题:

    执行下列程序后,鼠标单击窗体,输出结果为

    Private Sub Form_Click()

    Print "Click";

    End Sub

    Private Sub Form_MouseDown(Button As Integer,Shift As Integer,X As Single,Y As Single)

    Print "Donw"

    End Sub

    Private Sub Form_MouseUp(ButtonAs Integer,Shift As Integer,X As Single,Y As Single)

    Print "Up"

    End Sub

    A.DownUpClick

    B.ClickDownUp

    C.DownClickUp

    D.UpDownCliek


    正确答案:A
    解析:鼠标单击时,依次引发MouseDown、MouseUp和Click事件,即Click事件包含鼠标按下和放开事件。

  • 第7题:

    编写如下代码:

    Dim Flag As Boolean

    Private Sub Form. MouseDown (Button As Integer,

    Shift As Integer, X As Single, Y As Single)

    Flag = True

    End Sub

    Private Sub Form. MouseMove (Button As Integer,

    Shift As Integer, X As Single, Y As Single)

    Flag = False

    End Sub

    Private Sub Form_ MouseUp (Button As Integer,

    Shift As Integer, X As Single, Y As Single)

    If Flag = False Then

    Print "DDDD"

    End If

    End Sub

    程序运行后,如果想在窗体上输出DDDD,则应执行的操作为______。


    正确答案:按下鼠标左键或右键同时松开
    按下鼠标左键或右键同时松开

  • 第8题:

    对窗体编写如下事件过程: 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事件。

  • 第9题:

    假定已经在菜单编辑器中建立了窗体的弹出式菜单,其顶级菜单的名称为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

  • 第10题:

    假定编写了如下事件过程: Private Sub Form_MouseDown(Button As Integer,Shift As Integer,X As Single, Y As Single) If Button=2 Then Print "aaaa" End If End Sub 程序运行后,为了在窗体上输出“AAAA”,应按下的鼠标键为

    A.左键

    B.右键

    C.同时按下左、右键

    D.按什么键都不显示


    正确答案:B
    解析:在窗体上压下鼠标键,触发Form_MouseDown事件。参数Button标识鼠标的信息,1表示按下鼠标左键;2表示按下鼠标右键:4表示按下鼠标中间键。当按下鼠标右键时,程序能在窗体上显示字符串“AAAA”。

  • 第11题:

    执行下列程序后,鼠标单击窗体,输出结果为 Private Sub Form_Click() Print"Click": End Sub Private Sub Form_MouseDown(Button As Integer,Shift_As Integer,X As Single,Y As Single) Print"Donw" End Sub Private Sub Form_MouseUp(Button As Integer,Shift_As Integer,X As Single,Y As Single) Print"Up" End Sub

    A.DownUpClick

    B.CfickDownUp

    C.DownClickUp

    D.UpDownClick


    正确答案:A

  • 第12题:

    单选题
    对窗体编写如下事件过程: Private Sub Form_MouseDown(Button As Integer,Shif tAs 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

    B

    BBBBB

    C

    AAAAA CR BBBBB(其中CR表示回车和换行)

    D

    BBBBB CR AAAAA


    正确答案: C
    解析: 暂无解析

  • 第13题:

    假定已经在菜单编辑器中建立了窗体的弹出式菜单,其顶级菜单项的名称为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 a1 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_MousoDown(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 Buaon=2 Then PopupMenu a1 End If End Sub


    正确答案:B
    解析:单击左键或者右键均可以弹出菜单,因此不需进行判断单击的哪个键。因此本题答案为B)。

  • 第14题:

    要求当鼠标在图片框P1中移动时,立即在图片框中显示鼠标的位置坐标。下面能正确实现上述功能的事件过程是

    A.Private Sub P1_MouseMove(Button As Integer,Shift As Integer,x As Single,Y As Single) Print X,Y End Sub

    B.Private Sub P1_M0useDown(Button As Integer,Shift As Integer,X As Single,Y As Single) Picture.Print X,Y End Sub

    C.Private Sub P1_MouscMove(Button As integer,Shift As Integer,X As Single,Y As Single) P1.Print X.Y End Sub

    D.Private Sub Form_MouseMove(Button As Integer,Shift As Integer,x As Single,Y As Single) P1.Print X.Y End Sub


    正确答案:C
    解析:鼠标在图片框中移动,对象应为图片框控件,而不是窗体,选项D)是错误的;鼠标移动触发的是MouseMove事件,选项B)是错误的;在图片框内显示坐标,Print的对象名为图片框,如果没有对象名,则默认输出到窗体上,所以正确的答案为C)。

  • 第15题:

    下面程序是由鼠标事件在窗体上画图,如果按下鼠标可以画图,双击窗体则可以清除所画图形。补充完整下面的程序。首先在窗体层定义如下变量:

    Dim PaintStart As Boolean

    编写如下事件过程:

    Private Sub Form_Load()

    DrawWidth=2

    ForeColor=vbGreen

    End Sub

    Private Sub Form_MouseDown(Button As Integer,Shift As Integer,X AS Single,Y AS Single)

    PaintStart=True

    End Sub

    Private Sub Form_MouseMove(Button As Integer,Shift As Integer,X As Single,Y As Single)

    If PaintStart Then

    PSet(X,Y)

    End If

    End Sub

    Private Sub Form_MouseUp(Button As Integer,Shift As Integer,X As Single,Y As Single)

    End Sub

    Private Sub Form_DblClick()

    Cls

    End Sub


    正确答案:PaintStart=False
    PaintStart=False 解析:上述过程定义了一个布尔型变量PaintStart,当按下鼠标左键(触发MouseDown事件)时,由题意按下鼠标键表示能画图,所以该变量的值为Tine,而松开鼠标左键(触发MouseUp事件)时,该变量为False;如果变量PaintStart为True,则移动鼠标 (触发MouseMove事件),将在窗体上绘出一个点;除鼠标事件外,上述程序还含有一个Load事件过程和一个DblClick事件过程,其中Load事件过程用来设置画点的大小和颜色,DblClick事件过程用来清除所画的图形,函数Pset是画点语句,用它可以在(x,y) 处画一个点。

  • 第16题:

    设已经在“菜单编辑器”中设计了窗体的快捷菜单,其顶级菜单为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方法把它们作为快捷菜单在运行时显示出来。PopupMenu方法的使用形式如下:
      [对象].PopupMenu菜单名,标志,x,y。
      其中,x,y是提供菜单显示的位置;标志指定快捷菜单的行为。
      [考点链接] 使用菜单编辑器制作菜单。

  • 第17题:

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

    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(ButtonAsInteger,ShiftAsInteger,X As Single,Y As Single) PopupMenu a1,0 End Sub

    C.Private Sub Form_Mouse Down(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


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

  • 第18题:

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

    A.Private Sub Form_Mouse Down(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. Mouse Down(Button As Integer,Shift As Integer,_X As Single,Y As Single) PopupMenu a1,0 End Sub

    C.Private Sub Form_Mouse Down(Button As Imeger,Shift As Integer,_X As Single,Y As Single) PopupMenu a1 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 a1 End Sub


    正确答案:A

  • 第19题:

    对窗体编写如下事件过程: Private Sub Form_MouseDown(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

    C.AAAAA

    D.BBBBB AAAAA


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

  • 第20题:

    对窗体编写如下事件过程: Private Sub Form. _ MouseDown(BuRon 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

    C.AAAAA

    D.BBBBB AAAAA


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

  • 第21题:

    假定已经在菜单编辑器中建立了窗体的弹出式菜单,其顶级菜单的名称为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。

  • 第22题:

    设已经在菜单编辑器中设计了窗体的快捷菜单,某顶级菜单为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提供菜单显示位置;标志:指定快捷菜单的行为。

  • 第23题:

    编写如下事件过程; Private Sub Form_MouseDown(Button As Integer,Shift As Integer,X AS Single, Y As Single) If Shif=6 And Button=2 Then Print"BBBB" End If End Sub 程序运行后,为了在窗体上输出“BBBB”,应执行的操作为______。

    A.同时按下Shift键和鼠标左键

    B.同时按下Shift键和鼠标右键

    C.同时按下Ctrl、Alt键和鼠标左键

    D.同时按下Ctrl、Alt键和鼠标右键


    正确答案:D
    解析:在鼠标的Mouse_Down事件中,当按下左键时,Button=1,右键时Button=2,在键盘上按下Shift键时,Shift值为1,Ctrl键时,Shift值为2,Alt时,Shift值为4,如果同时按下多键,则它们的值也相加。

  • 第24题:

    单选题
    对窗体编写如下事件过程: Private Sub Form_MouseDown(Button As Integer,Shift As Integer,X As Single Y As Single) If Button=2 ThenPrint"AAAAA"End IfEnd SubPrivate Sub Form_MouseUp(Button As Integer,Shift As Integer,X As Single,Y As Single) Print"BBBBB" End Sub程序运行后,如果单击鼠标右键,则输出结果为()
    A

    AAAAA

    B

    BBBBB

    C

    AAAAA CR BBBBB(其中CR表示回车和换行)

    D

    BBBBB CR AAAAA


    正确答案: D
    解析: 暂无解析