设已经在菜单编辑器中设计了弹出式菜单mnuStyle,要求程序运行时,当用户在文本框Text1上单击鼠标右键时,能够弹出该菜单,则应使用的事件过程是( )。

admin2018-06-20  15

问题 设已经在菜单编辑器中设计了弹出式菜单mnuStyle,要求程序运行时,当用户在文本框Text1上单击鼠标右键时,能够弹出该菜单,则应使用的事件过程是(    )。

选项 A、Private Sub Text1_MouseDown(Button As Integer,Shift As Integer,X As Single,Y As Single)
If Button=2Then
PopupMenu mnuStyle
End If
End Sub
B、Private Sub Text1_MouseDown(Button As Integer,Shift A sInteger,X As Single,Y As Single)
If Button=1Then
PopupMenu mnuStyle
End If
End Sub
C、Private Sub Text1_MouseDown(Button As Integer,Shift As Integer,X As Single,Y As Single)
If Button=2Then
mnuStyle.Show
End If
End Sub
D、Private Sub Text1_MouseDown(Button As Integer,Shift As Integer,X As Single,Y As Single)
If Button=1Then
mnuStyle.Popup
End If
End Sub

答案A

解析 为了显示弹出式菜单,通常把PopupMenu方法放在MouseDown事件中,该事件响应所有的鼠标单击操作。按照惯例,一般通过单击鼠标右键显示弹出式菜单,这可以用Button参数来实现。对于鼠标来说,左键的Button参数值为1,右键的Button参数设置为2,因此,可以使用“If Button=2,Then PopupMenu菜单名”语句可以通过单击鼠标右键来响应MouseDown事件、显示弹出式菜单,故本题A选项正确。本题选择A选项。
转载请注明原文地址:https://kaotiyun.com/show/AaGp777K
0

相关试题推荐
最新回复(0)