views:

70

answers:

4

Hi everyone.

Can I have master form that will contain windows forms? Or even windows control?

Thanks a lot.

A: 

You can achieve this with inheritance i suppose

Aykut
Why the downvote? This is absolutely right. Visual inheritance, as pointed out by Matt Bishop, is a nice way to achieve an effect on Windows Forms very similar to that of master pages on ASP.NET.
CesarGon
I did not click it well... after that i try to vote it bu it said too old
SonOfOmer
A: 

I think you want to create a Multiple Document Interface (MDI). Also, all windows forms can contain controls, so you can by definition create a form that contains a control.

Zach Johnson
+3  A: 

For a form to contain other forms, you want MDI (as Zach Johnson already said). Setting the relevant form properties (IsMdiContainer / MdiChildren / MdiParent / etc) will get you the behaviour you want.

For something like a "master page for forms", you could try using Visual Inheritance. First you define a basic "master" form layout, leaving space for the controls on the child forms. Then when you create new forms, be sure to select Add New-->Windows Forms-->Inherited Form, and Visual Studio will prompt you to select a parent form to inherit from.

Matt Bishop
A: 

A winform application I work has a main form that is completely built in this manner. It uses one Winform and everything displayed on it is a user control. All the displays are written as plugins and can be pulled into the applications menu and have their user control displayed.

L2Type