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

admin2019-08-21  27

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

选项 A、Private Sub Text1_MouseDown(Button As Integer,Shift As Integer,X As Single,Y As Single)
    If Button=2 Then
    PopupMenu mnuStyle
    End If
    End Sub
B、Private Sub Text1_MouseDown(Button As Integer,Shift As Integer,X As Single,Y As Single)
    If Button=1 Then
    PopupMenu mnuStyle
    End If
    End Sub
C、Prixrate Sub Text1_MouseDown(Button As Integer,Shift As Integer,X As Single,Y As Single)
    If Button=2 Then
    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=1 Then
    mnuStyle.Popup
    End If
    End Sub

答案A

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

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