我开始在窗体中加了个按钮,但点击按钮时添加一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 = "状态栏";
}