---
title: "WORKING ON MDI (MULTI DOCUMENT INTERFACE)"  
description: "In this Application we have to show the working of MDI Form and their various Properties with the help of an example. Choose a New Project and Name as"  
author: "Anonymous User"  
published: 2010-09-11  
updated: 2019-09-07  
canonical: https://www.mindstick.com/articles/129/working-on-mdi-multi-document-interface  
category: "c#"  
tags: ["c#"]  
reading_time: 3 minutes  

---

# WORKING ON MDI (MULTI DOCUMENT INTERFACE)

In this Application we have to show the working of MDI Form and their various Properties with the help of an example. Choose a New Project and Name as MDISample, Next Right Click on the right hand side of MDISample and Click on ADD Option then Click on ADD item, then chooses an Option MDIParent Form as shown below as shown in arrow.\

![WORKING ON MDI (MULTI DOCUMENT INTERFACE)](https://www.mindstick.com/mindstickarticle/eed154c9-06b8-4bc7-97ce-8f4910d2f3f0/images/aabaab80-1ac1-4a5f-972d-951a879a1bea.png)

As we click on MDIParent form you will see Below or we can use menus as well as ToolStrip task with the help of control as shown Below with the help of an Arrow.

![MDI Parent](https://www.mindstick.com/mindstickarticle/eed154c9-06b8-4bc7-97ce-8f4910d2f3f0/images/714b4213-d3e2-4fe6-bac3-b0c32cc2a41a.png)

As in the above figure we can see all the functionalities as normal notepad as vertical tiles, Horizontal Tiles, cascade, close all, Arrange Icons etc.

##### The Code Snippet as shown below

```
public partial class MDIParent1 : Form    {         private int childFormNumber = 0;//Initializing childformno as 0.           public MDIParent1()         {            InitializeComponent();         }           private void ShowNewForm(object sender, EventArgs e)         {            Form childForm = new Form();//Creating Object of Form            childForm.MdiParent = this;            childForm.Text = "Window " + childFormNumber++;            childForm.Show();         }           private void OpenFile(object sender, EventArgs e)         {            //Creating an object of openFileDialog and checking the open file into the same form.            OpenFileDialog openFileDialog = new OpenFileDialog();          //openning the file as initial directory                       openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal);           openFileDialog.Filter = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*";            if (openFileDialog.ShowDialog(this) == DialogResult.OK)            {                string FileName = openFileDialog.FileName;            }         }           private void SaveAsToolStripMenuItem_Click(object sender, EventArgs e)         { //Creating an object of savefile dialog            SaveFileDialog saveFileDialog = new SaveFileDialog();//saving the file in a initial directory                        saveFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal);            saveFileDialog.Filter = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*";//Checking condition for save Dialog box            if (saveFileDialog.ShowDialog(this) == DialogResult.OK)            {                string FileName = saveFileDialog.FileName;            }         }           private void ExitToolsStripMenuItem_Click(object sender, EventArgs e)         { //Closing the application            this.Close();         }           private void CutToolStripMenuItem_Click(object sender, EventArgs e)         {         }           private void CopyToolStripMenuItem_Click(object sender, EventArgs e)         {         }           private void PasteToolStripMenuItem_Click(object sender, EventArgs e)         {         }         private void ToolBarToolStripMenuItem_Click(object sender, EventArgs e)         {            toolStrip.Visible = toolBarToolStripMenuItem.Checked;         }       private void StatusBarToolStripMenuItem_Click(object sender, EventArgs e)         {            statusStrip.Visible = statusBarToolStripMenuItem.Checked;         }          private void CascadeToolStripMenuItem_Click(object sender,EventArgs e)         {//for cascading            LayoutMdi(MdiLayout.Cascade);         }
```

![MDI Child](https://www.mindstick.com/mindstickarticle/eed154c9-06b8-4bc7-97ce-8f4910d2f3f0/images/1fd4cfc5-e3eb-49c5-a198-c569f3554398.png)

```
 private void TileVerticalToolStripMenuItem_Click(object sender,  EventArgs e)         {//for Tile verticle            LayoutMdi(MdiLayout.TileVertical);         }
```

![MDI Child Layout](https://www.mindstick.com/mindstickarticle/eed154c9-06b8-4bc7-97ce-8f4910d2f3f0/images/5d64e4e0-3961-46a6-938f-a8817b079053.png)

```
           private void TileHorizontalToolStripMenuItem_Click(object sender, EventArgs e)         {//For Horizontal            LayoutMdi(MdiLayout.TileHorizontal);         }
```

![MDI Cascading](https://www.mindstick.com/mindstickarticle/eed154c9-06b8-4bc7-97ce-8f4910d2f3f0/images/1c7d9bdc-d097-4e2e-be37-ecaf5ce627f8.png)

```
         private void ArrangeIconsToolStripMenuItem_Click(object sender, EventArgs e)         {//for Arrange icons            LayoutMdi(MdiLayout.ArrangeIcons);         }
```

![MDI Parent](https://www.mindstick.com/mindstickarticle/eed154c9-06b8-4bc7-97ce-8f4910d2f3f0/images/46943079-fa8b-4556-a48e-8bfb5e30ac23.png)

```
     private void CloseAllToolStripMenuItem_Click(object sender, EventArgs e)         {            foreach (Form childForm in MdiChildren)            {//closing Form                childForm.Close();            }         }  
```

##### The Output of the code is shown as

![MDI Menu](https://www.mindstick.com/mindstickarticle/eed154c9-06b8-4bc7-97ce-8f4910d2f3f0/images/bd1677b7-d5ad-45e7-aa78-06e41e28e401.png)

\

---

Original Source: https://www.mindstick.com/articles/129/working-on-mdi-multi-document-interface

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
