Hi all,

I want to ask you for little help. I make application in C#. It is made from one main form and it would be great if I can use as a part of it another "small forms" (I want to let user drag them on screen where they want). I have problem to describe it :) I want to make something like tool, colors layers or history box in Paint.NET.


You can drag them where you want, close them or open again while main form is intacted. But you also can minimalize whole app in the tray (at once, not window by window).

But how? Is there some trick? Or I just cats "minimalize" event and change hide/close all windows? Thx for reply to all!

Thank you for your reply! Thats what I need :)

But a little problem here - I use MSDN article http://msdn.microsoft.com/en-us/library/7aw8zc76.aspx and button on main form runs this code:

this.IsMdiContainer = true;

   Form2 newMDIChild = new Form2();
   newMDIChild.MdiParent = this;

...but nothing happened. When I delete line "newMDIChild.MdiParent = this;" it is working, but of course not like parent & child. Can you help me fin out where can be mistake?

EDIT: There is big picture above whole form (not as background). But it can not affect this, am I right?

Try setting the IsMdiContainer property from the properties box. (Not in your event method)

You can set IsMdiContainer to true within the Form1.Designer.cs file or after InitializeComponent() in the forms constructor.

I find out, that problem is in picturebox and other components of MainForm. Situation:

Mainform with some buttons and big picturebox which covers whole form (like background). I create MDI child, it is there - but it is "under" all parts which are on MainForm. So this big image overlaps it. I need to get MDI Child in the front of it (BringToFront does not work, Form.TopMost does not work).

OK, after few hours of testing I have nothing :/. I find some thread where was guy trying to do same thing. They also did not find any solution.

So I change the way, use regular forms, catch events of minimalization/maximalization and apply them to all forms.

Don't use a pictureBox for this.
Use the BackGroundImage property of the form.
See the zipped example.

you might want to take a look at this great library: DockPanel suite


It works very well and i think this is what you are looking for. It is basically a A Visual Studio like Interface which allows you to dock forms into the main form.

check it out, i think it will help