Merging Mdi parent/child MenuStrip and ToolStrip

I do this every few months and can never remeber what is to be do for this to work. I always spend few minutes looking through code that does merging and sets apprioprate values in among other design-time settings… so here it is, for me to rember.

  1. Set MainMenu strip on Mdi parent box.
  2. Set visible false on Mdi child ToolStrip and MenuStrip
  3. Add this to Mdi parent box:
    ///Raises the <see cref="E:System.Windows.Forms.Form.MdiChildActivate"></see> event.
    ///<param name="e">The <see cref="T:System.EventArgs"></see> that contains the event data. </param>
    protected override void OnMdiChildActivate(EventArgs e) {
    /// <summary>
    /// Merges child window ToolStrips
    /// </summary>
    private void MergeChildToolStrip() {
        IChildBox box = ActiveMdiChild as IChildBox;
        if (box != null) {
            ToolStripManager.Merge(box.ToolStrip, mainToolStrip);
  4. Create IChildBox interface and implement it on Mdi child box.

Leave a Reply

Back to Top