쓰레드 사용시 크로스 쓰레드로 그냥 MdiParent를 사용 할 수 없습니다.
Invoke로 해줘야 하는데 방법은 아래 참조


        public delegate void EventHandler_th(); //invoke를 위한 델리게이트
        private void Form1_Load(object sender, EventArgs e)
        {
            Thread th = new Thread(new ThreadStart(test));
            th.Start();
        }
        private void test()
        {
            EventHandler_th eventhandler = new EventHandler_th(this.fm_MdiParent);
            this.Invoke(eventhandler, new object[] { });
        }
        private void fm_MdiParent()
        {
            Form2 fm = new Form2();
            fm.MdiParent = this;
            fm.Show();
        }

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

C# Invoke 사용하기  (0) 2009.08.14
Posted by 아르다