예제 #1
0
        public Form1()
        {
            InitializeComponent();
            TestingObject tester = ShowDialog3("Test2", "Caption2");

            Console.WriteLine(tester.ToString());
        }
예제 #2
0
        public static TestingObject ShowDialog3(string text, string caption)
        {
            Form prompt = new Form();

            prompt.Width  = 250;
            prompt.Height = 250;
            prompt.Text   = caption;

            TestingObject testingObj = null;

            FlowLayoutPanel panel   = new FlowLayoutPanel();
            Button          Object1 = new Button()
            {
                Text = "Object1"
            };

            Object1.Click += (sender, e) => { testingObj = new TestingObject("Test1", 1); prompt.Close(); };
            Button Object2 = new Button()
            {
                Text = "Object2"
            };

            Object2.Click += (sender, e) => { testingObj = new TestingObject("Test2", 2); prompt.Close(); };

            panel.Controls.Add(Object1);
            panel.Controls.Add(Object2);

            prompt.Controls.Add(panel);
            prompt.ShowDialog();
            return(testingObj);
        }
예제 #3
0
        private void popUpButton2_Click(object sender, EventArgs e)
        {
            TestingObject tester = ShowDialog3("Test2", "Caption2");

            Console.WriteLine(tester.ToString());
        }