问题 单项选择题

关系运算中花费时间可能最长的运算是( )。

A. Private Sub Form _ Mouse Up(Button As Integer,Shift AS Integer,_                 X As Single,Y As Single)    If Button=2 Then      PopupMenu mnuEdit,vbPopupMenuCenterAlign Or_        vbPopupMenuRightButton,X,Y,mnuEditOpen    End If  End Sub

B. Private Sub Form _ MouseUp(Button AS Integer,Shift AS Integer,_                X As Single,Y As Single)    If Button=2 Then      PopupMenu mnuEdit,    End If  End Sub

C. Private Sub Form _ MouseUp(Button AS Integer,Shift AS Integer,_                X As Single,Y As Single)    PopupMenu mnuEdit,vbPopupMenuCenterAlign Or_           vbPopupMenuRightButton  End Sub

D. Private SUb Form _ MouseUp(Button AS Integer,_                Shift As Integer,X As Single,Y As Single)    If Button=2 Then         PopupMenu mnuEdit,2    End If  End Sub

答案

参考答案:A

解析:在Visual Basic中,允许出现快捷菜单,对用户来说,提供了很大的方便,一般来说,菜单都在窗口的顶部,有时,用户需要执行菜单中的某一命令,就得把鼠标移动到窗口顶部,然后打开菜单选择命令,这对用户来说,会觉得麻烦。而快捷菜单并不需要到窗口的顶部来打开,只要单击鼠标右键,就会弹出菜单。PopupMenu方法的使用形式如下:  [对象]:PopupMenu菜单名,flags,x,y  其中,x,y是提供菜单显示的位置;标志:指定快捷菜单的行为,当标志为0时,快捷菜单中的项只能对鼠标左键起反应,当标志为1时,快捷菜单中的项对鼠标右键和左键都反应;标志为2时,PopupMenu方法只能用在MouseDown事件过程中。

单项选择题
单项选择题