PaoloFCantoni
PaoloFCantoni

Reputation: 977

.NET MDI child form suppress/hide caption/icon area

I have a subform (child) that I want to use in a number of parents. I'm not a professional developer (I'm an architect - I know, you can save all the jokes... :) - working solo at present). I've ended up using an MDI form with the subform as a child. I maximize the subform form and most things are fine except that although I've tried to disable all the various widgets (the subform in the designer shows NO caption/icon/button area), I get TWO icons on the left and TWO sets of buttons on the right - of which ONLY the restore button works. Either of the sets of buttons will work the one child form.

Is there any way around this? I want the subform to be "transparent" the the user - they shouldn't be aware there's a subform in use.

I've done a quick search and I'd already suppressed the actual caption as mentioned in another answer - to get the caption bar suppressed in the designer...

Is MDI the right technology, or is there a better way to have the same subform appear in multiple parent forms?

VS2008, C#, Windows 7

TIA, Paolo

Upvotes: 0

Views: 2161

Answers (1)

Hans Passant
Hans Passant

Reputation: 941505

There's a WF bug that will double the glyphs if you create the MDI child form in the parent's constructor. Here's an example:

public partial class Form1 : Form {
    public Form1() {
        InitializeComponent();
        this.IsMdiContainer = true;
        var child = new Form();
        child.MdiParent = this;
        child.WindowState = FormWindowState.Maximized;
        child.Show();
    }
}

Move the child form creation code to the Load event to avoid this.

Upvotes: 1

Related Questions