Thursday, 14 November 2013

c# window layout

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

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

        private static int count = 0;

        private void bToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form x = new Form();
            x.MdiParent = this;
            x.Text = "window#" + count.ToString();
            count++;
            x.Show();
        }

        private void cToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void dToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.LayoutMdi(MdiLayout.Cascade);
        }

        private void eToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.LayoutMdi(MdiLayout.TileHorizontal);
        }

        private void fToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.LayoutMdi(MdiLayout.TileVertical);
        }


    }
}

No comments:

Post a Comment