单选题
窗体的事件过程如下: Private Sub主体_MouseDown(Button As Integer,Shift As Integer,X As Single,Y As Single) If Shift=6 And Button=2 Then MsgBox"Hello World." End If End Sub 程序运行后,要在窗体消息框中显示“Hello world.”,在窗体上应执行的操作是( )。
A、
同时按下Shift键和鼠标左键
B、
同时按下Shift键和鼠标右键
C、
同时按下Ctrl、Alt键和鼠标左键
D、
同时按下Ctrl、Alt键和鼠标右键
【正确答案】
D
【答案解析】
解析:在窗体的鼠标事件中,参数Button的值为1表示左键按下,值为2表示右键按下,值为4表示中间按键按下;参数Shift的值为1表示Shift键按下,值为2表示Ctrl键按下,值为4表示Alt键按下。Shift值为6说明是Ctrl键和Alt键同时按下,Button值为2说明是鼠标右键按下。
提交答案
关闭