All pastes #79900 Raw Copy code Copy link Edit

Unnamed

public unlisted text v1 · immutable
#79900 ·published 2006-07-05 21:16 UTC
rendered paste body
// Sample
using System;
using System.Windows.Forms;
using System.Drawing;

public class Test
{
        static void Main ()
        {
                TestForm form = new TestForm ();
                Application.Run (form);
        }
}

public class TestForm : Form
{
        public TestForm ()
        {
                IsMdiContainer = true;

                // Add an Mdi component
                Form form = new Form ();
                form.MdiParent = this;
                form.Show ();

                Button button = new Button ();
                button.Text = "Click me!";
                button.Location = new Point (5, 5);
                button.Parent = form;
                button.Click += delegate (object o, EventArgs args) {
                        IsMdiContainer = false; // This is the important line
                        //IsMdiContainer = true; // This is a funny line
                };
        }
}