Getsuyodev, Programming is mainly used when constructing an application. Programming requires knowledge of application domains, algorithms, and programming language expertise. Programming can be developed in different logic based on developer knowledge.

C# MDI Form



A Multiple Document Interface (MDI) programs can display multiple child windows inside them. This is in contrast to the single document interface (SDI) applications, which can manipulate only one document at a time. Visual Studio Environment is an example of Multiple Document Interface (MDI), and notepad is an example of an SDI application. MDI applications often have a Window menu item with submenus for switching between windows or documents.

Any windows can become an MDI parent if you set the IsMdiContainer property to True.

The following C# program shows an MDI form with two child forms. Create a new C# project; then you will get a default form Form1. Then add two more forms in the project (Form2, Form 3). Create a Menu on your form and call these two forms on the menu click event. Click here to see how to create a Menu on your form How to Menu Control C#.

NOTE: If you want the MDI parent to auto-size the child form you can code like this.

using System;
using System.Drawing;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void menu1ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            MessageBox.Show("You are selected MenuItem_1");
        }
    }
}

Comments are closed.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More