VB中无边框窗体实现弹出菜单

类别:软件工程 点击:0 评论:0 推荐:

说来也简单
1、设定窗体属性:
        A、BorderStyle属性设为0;
        B、ControlBox属性设为False。(这一点很重要,不然插入菜单后会出现边框)
2、编辑菜单
        利用菜单编辑器编辑弹出菜单(例:加S1为一级菜单,它的可见属性为不可见,加S2为二级菜单),如图

3、添加MouseUp事件,如下
        Private Sub Form_MouseUp(Button As Integer, Shift As Integer, x As Single, Y As Single)
                If Button = 2 Then           '若右键释放,则弹出菜单
                        PopupMenu S1
                End If
        End Sub
4、搞定,按F5运行,在窗体上点右键试试~~~~~~~~~~~~

 

本文地址:http://com.8s8s.com/it/it32922.htm