在窗体上画一个名称为Command1的命令按钮,然后编写如下事件过程: Private Sub Command1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single

admin2019-03-14  29

问题 在窗体上画一个名称为Command1的命令按钮,然后编写如下事件过程:
Private Sub Command1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Button = 2 Then
        Print "ABCD";
    Else
        Print "DDDD";
    End If
End Sub
Private Sub Command1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Print "EFGH"
End Sub
程序运行后,单击命令按钮,输出结果是

选项 A、ABCDEFGH
B、DDDDEFGH
C、ABCD
D、EFGH

答案B

解析 MouseDown是按下鼠标时触发的事件,MouseUp是松开鼠标时触发的事件。鼠标键参数中Button=2表示按下右键。单击命令按钮时,先用鼠标单击一下左键,在此过程中,鼠标会从按下转为松开。先触发MouseDown事件,因button!=2故输出DDDD,再触发MouseUp事件,输出EFGH。故本题正确答案为选项B。
转载请注明原文地址:https://kaotiyun.com/show/AdFp777K
0

最新回复(0)