Merging MDI toolbar
In .net MDI application the menu of child form automatically is merged to the menu of parent form. Is there a way to do similar thing with the tool bars.The concept i开发者_C百科s to send the toolbar of active child to the parent toolbar stripe.
I found http://community.devexpress.com/forums/p/5696/24663.aspx but could not achieve it.
It can be done if following way . More detail could be found in this blog. Both forms should have a toolstrip.
//In Parent form
protected override void OnMdiChildActivate(EventArgs e)
{
base.OnMdiChildActivate(e); //REQUIRED
HandleChildMerge(); //Handle merging
}
private void HandleChildMerge()
{
ToolStripManager.RevertMerge(tsParent);
IChildForm ChildForm = ActiveMdiChild as IChildForm;
if (ChildForm != null)
{
ToolStripManager.Merge(ChildForm.ChildToolStrip, tsParent);
}
}
public partial class frmChild : Form, IChildForm
{...}
interface IChildForm
{
ToolStrip ChildToolStrip { get; set; }
}
精彩评论