Form.IsMdiContainer Property
Assembly: System.Windows.Forms (in system.windows.forms.dll)
/** @property */ public boolean get_IsMdiContainer () /** @property */ public void set_IsMdiContainer (boolean value)
public function get IsMdiContainer () : boolean public function set IsMdiContainer (value : boolean)
Not applicable.
Property Value
true if the form is a container for MDI child forms; otherwise, false. The default is false.This property changes the display and behavior of the form to an MDI parent form. When this property is set to true, the form displays a sunken client area with a raised border. All MDI child forms assigned to the parent form are displayed within its client area.
When an MDI parent form is closed, the Closing events of all MDI child forms are raised before the MDI parent form's Closing event is raised. In addition, the Closed events of all MDI child forms are raised before the Closed event of the MDI parent form is raised.
The following code example demonstrates using the IsMdiContainer property as well as changing the BackColor property of an MDI Form. To run this example, paste the following code in a new form.
// Create a new form.
private Form mdiChildForm = new Form();
private void Form1_Load(Object sender, System.EventArgs e)
{
// Set the IsMdiContainer property to true.
set_IsMdiContainer(true);
// Set the child form's MdiParent property to
// the current form.
mdiChildForm.set_MdiParent(this);
// Call the method that changes the background color.
SetBackGroundColorOfMDIForm();
} //Form1_Load
private void SetBackGroundColorOfMDIForm()
{
for (int iCtr = 0; iCtr < this.get_Controls().get_Count(); iCtr++) {
Control ctl = this.get_Controls().get_Item(iCtr);
if (ctl instanceof MdiClient) {
// If the control is the correct type,
// change the color.
ctl.set_BackColor(System.Drawing.Color.get_PaleGreen());
}
}
} //SetBackGroundColorOfMDIForm
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.
Note: