首页 新闻 搜索 专区 学院

DevExpress.XtraBars.BarManager怎么动态添加?

0
[已关闭问题] 关闭于 2010-07-14 13:55

DevExpress.XtraBars.BarManager怎么动态添加?就是我要动态添加这个控件,已经相应的toolbar,menu,status……

阿笨的主页 阿笨 | 初学一级 | 园豆:200
提问于:2010-07-10 18:23
< >
分享
所有回答(1)
0

我开始在窗体中加了个按钮,但点击按钮时添加一BarManager,是这样吗?

     public XtraForm1()
        {
            InitializeComponent();
        }

        private BarDockControl barDockControlTop;
        private BarDockControl barDockControlBottom;
        private BarDockControl barDockControlLeft;
        private BarDockControl barDockControlRight;

        private BarManager barManager;
        private Bar statusBar;
        private Bar toolsBar;
        private Bar menuBar;

        private void simpleButton1_Click(object sender, EventArgs e)
        {
            barManager = new BarManager();
            statusBar = new Bar();
            toolsBar = new Bar();
            menuBar = new Bar();
            this.barDockControlTop = new DevExpress.XtraBars.BarDockControl();
            this.barDockControlBottom = new DevExpress.XtraBars.BarDockControl();
            this.barDockControlLeft = new DevExpress.XtraBars.BarDockControl();
            this.barDockControlRight = new DevExpress.XtraBars.BarDockControl();
      
            this.barManager.Bars.AddRange(new Bar[] {
            this.statusBar,
            this.menuBar,
            this.toolsBar
            });
            this.barManager.DockControls.Add(this.barDockControlTop);
            this.barManager.DockControls.Add(this.barDockControlBottom);
            this.barManager.DockControls.Add(this.barDockControlLeft);
            this.barManager.DockControls.Add(this.barDockControlRight);

            this.barManager.Form = this;

            this.barManager.MainMenu = this.menuBar;
            this.barManager.MaxItemId=0;
            this.barManager.StatusBar = statusBar;

            //
            // toolsBar
            //
            this.toolsBar.BarName = "Tools";
            this.toolsBar.DockCol = 0;
            this.toolsBar.DockStyle = DevExpress.XtraBars.BarDockStyle.Top;
            this.toolsBar.Text = "工具栏";
            //
            // menuBar
            //
            this.menuBar.BarName = "MainMenu";
            this.menuBar.DockCol = 0;
            this.menuBar.DockStyle = DevExpress.XtraBars.BarDockStyle.Top;
            this.menuBar.OptionsBar.MultiLine = true;
            this.menuBar.OptionsBar.UseWholeRow = true;
            this.menuBar.Text = "菜单栏";
            //
            // statusBar
            //
            this.statusBar.BarName = "Statusbar";
            this.statusBar.CanDockStyle = DevExpress.XtraBars.BarCanDockStyle.Bottom;
            this.statusBar.DockCol = 0;
            this.statusBar.DockStyle = DevExpress.XtraBars.BarDockStyle.Bottom;
            this.statusBar.OptionsBar.AllowQuickCustomization = false;
            this.statusBar.OptionsBar.DrawDragBorder = false;
            this.statusBar.OptionsBar.UseWholeRow = true;
            this.statusBar.Text = "状态栏";
         
        }

ForrestWoo | 园豆:550 (小虾三级) | 2010-07-14 03:05
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册