码的方式合并或者拆分Toolbar(可参考下面代码),如果是SDI程序,那么将需要自定义窗体的Toolbar
作为一个参数,使用主窗体Toolbar的Merge方法合并。
private void barManager1_Merge(object sender, BarManagerMergeEventArgs e) {
if(e.ChildManager.Form is Form2) {
Bar newBar = new Bar(barManager1);
newBar.BarName = "DynamicBar";
newBar.OptionsBar.Hidden = true;
Bar sourceBar = e.ChildManager.Bars["Custom 2"];
newBar.DockStyle = BarDockStyle.Top;
barManager1.Bars.Add(newBar);
newBar.Merge(sourceBar);
sourceBar.Visible = false;
}
}
private void barManager1_UnMerge(object sender, BarManagerMergeEventArgs e) {
Bar newBar = barManager1.Bars["DynamicBar"];
if(newBar != null)
newBar.Dispose();
}
欢迎任何形式的转载,但请务必注明出处,尊重他人劳动成果
转载请注明:文章转载自:DevExpress控件中文网 [https://www.devexpresscn.com/]
本文地址:https://www.devexpresscn.com/post/129.html