Saturday, March 31, 2007

Simple MDI Application in C#

Multiple Document Interface (MDI) allow programmers to create multiple sub-windows within one main window. The following C# snippets show how to accomplish this.

First, set the main or parent window by adding the following code to the InitializeComponent method of that form:

this.IsMdiContainer = true;

Next, create and add the child form. The following code was added to a button_click function:

Form1 fm1 = new Form1();
fm1.MdiParent = this;
fm1.Show();

No comments: