image

Form1 실행될 폼

image

LoadingForm 맨처음 보여줄 로딩표시를 폼

image

 

Program.cs 수정

    static class Program
    {
        /// <summary>
        /// 해당 응용 프로그램의 주 진입점입니다.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            LoadingForm ld = new LoadingForm();
            ld.Show();
            ld.Refresh();
            Form1 fm = new Form1(ld);
            Application.Run(fm);
        }
    }

위에서 보면 Form1에서 LoadingForrm 을 넘겨주고 있습니다.

로딩이 완료되면LoadingForm 해제

 

Form1에서의 코드

생성자

        public Form1(Form f)
        {
            loadingform = f;
            InitializeComponent();
            System.Threading.Thread.Sleep(1000);


        }

Form1_Paint 메소드

        private void Form1_Paint(object sender, PaintEventArgs e)
        {
            if (loadingform != null)
            {
                loadingform.Close();
                loadingform.Dispose();
                loadingform = null;
            }

        }

+ Recent posts