Maximized MDI window at startup

image_pdfimage_print


   


using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace MdiBasic
{
  public class frmContainer : System.Windows.Forms.Form
  {
    private System.ComponentModel.Container components = null;

    public frmContainer()
    {
      InitializeComponent();
            MdiBasic.frmChild child = new MdiBasic.frmChild(this);

            child.Show();
        }
    private void InitializeComponent()
    {
         this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
         this.ClientSize = new System.Drawing.Size(292, 273);
         this.IsMdiContainer = true;
         this.Name = "frmContainer";
         this.Text = "MDI Basic";
         this.WindowState = System.Windows.Forms.FormWindowState.Maximized;

        }
    [STAThread]
    static void Main() 
    {
      Application.Run(new frmContainer());
    }
  }

  public class frmChild : System.Windows.Forms.Form
  {
    private System.ComponentModel.Container components = null;

        public frmChild(MdiBasic.frmContainer parent)
    {
      InitializeComponent();
            this.MdiParent = parent;
        }
    private void InitializeComponent()
    {
      this.components = new System.ComponentModel.Container();
      this.Size = new System.Drawing.Size(300,300);
      this.Text = "frmChild";
    }
  }
}