AppleTree iOS

Modal & Modeless 대화상자 본문

C#

Modal & Modeless 대화상자

사과나무 2011. 11. 23. 16:01

Form1==============================================
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

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

        private void button1_Click(object sender, EventArgs e)
        {
            Form2 form2 = new Form2();
            if (radioButton1.Checked ==true)
            {
                form2.Text = "ModalDialogBox";
                form2.ShowDialog();
            }
            else if(radioButton2.Checked == true)
            {
                form2.Text = "ModelessDialogBox";
                form2.Show();
            }
        }
    }
}


Form2==========================================================
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication17
{
    public partial class Form2 : Form
    {
        public Form2()
        {
            InitializeComponent();
        }

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


'C#' 카테고리의 다른 글

메세지박스 예제  (0) 2011.11.23
Comments