popup MenuName用菜单编辑器做好,将Visiable设为false。用时用popup menuname就行了!!!

解决方案 »

  1.   

    我试过用tools中的菜单编辑器来编辑菜单,可是编辑的是我的主菜单,我想用右键另弹出一个菜单,就是这个菜单不会做,有 menu 控件吗?如果有,应怎么添加?
      

  2.   

    VERSION 5.00
    Begin VB.Form PopupMenu 
       BorderStyle     =   1  'Fixed Single
       Caption         =   "建立弹出菜单"
       ClientHeight    =   2430
       ClientLeft      =   3555
       ClientTop       =   3480
       ClientWidth     =   5400
       Icon            =   "Popup Menu.frx":0000
       LinkTopic       =   "Form1"
       MaxButton       =   0   'False
       PaletteMode     =   1  'UseZOrder
       ScaleHeight     =   2430
       ScaleWidth      =   5400
       Begin VB.CommandButton cancel 
          Caption         =   "exit"
          Height          =   375
          Left            =   3600
          TabIndex        =   1
          Top             =   1800
          Width           =   975
       End
       Begin VB.Label Label1 
          Caption         =   "右键单击字符区,弹出菜单。左键单击窗体空白区,弹出菜单"
          Height          =   495
          Left            =   480
          TabIndex        =   0
          Top             =   840
          Width           =   4455
       End
       Begin VB.Menu mnufile 
          Caption         =   "Popup Menu"
          Visible         =   0   'False
          Begin VB.Menu mnusub1 
             Caption         =   "This is the first submenu"
          End
          Begin VB.Menu mnusub2 
             Caption         =   "This is the second submenu"
          End
          Begin VB.Menu mnusub3 
             Caption         =   "This is the third submenu"
          End
       End
    End
    Attribute VB_Name = "PopupMenu"
    Attribute VB_GlobalNameSpace = False
    Attribute VB_Creatable = False
    Attribute VB_PredeclaredId = True
    Attribute VB_Exposed = False
    Private Sub Cancel_Click()
         'exit the program
        Unload Me
    End SubPrivate Sub Form_Load()
        'centre the form on the screen
        Move (Screen.Width - Width) \ 2, (Screen.Height - Height) \ 2
    End SubPrivate Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
        '先使菜单不可见
        mnufile.Visible = False
        '鼠标左键单击,则弹出菜单
        If Button = 1 Then PopupMenu mnufile
    End Sub
    Private Sub Label1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
        '先使菜单不可见
        mnufile.Visible = False
        '鼠标右键单击,则弹出菜单
        If Button = 2 Then PopupMenu mnufile
    End Sub
    Private Sub Label2_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)mnufile.Visible = FalseIf Button = 2 Then PopupMenu mnufileEnd Sub
    Private Sub mnusub1_Click()
        '第一个子菜单事件
        MsgBox ("This is the first submenu")
    End SubPrivate Sub mnusub2_Click()
        '第二个子菜单事件
        MsgBox ("This is the second submenu")
    End SubPrivate Sub mnusub3_Click()
        '第三个子菜单事件
        MsgBox ("This is the third submenu")
    End Sub
      

  3.   

    '建立弹出式菜单
    '请把上面的保存为  asdfas.frm
      

  4.   

    还有:
    定位弹出式菜单建立图标菜单如果要的话请发个Email过来
    [email protected]其实这些在VB5.0里的联机手册里一般都有的
    请输入PopupMenu查找一下什么都有了,连不该有的都有了.
    哦给你推荐几个网站
    www.applevb.com
    www.vbgood.com
    bbs.yesky.com
    还有小聪明的网站
    '欢迎访问小聪明的主页VB版 http://coolzm.533.net
    '                         http://go.163.com/~coolzm