C#/Winform

윈폼 컨트롤 비동기로 다루기 (MethodInvoker)

kjun.kr 2017. 8. 24. 00:20
728x90

Task 나 Thread 내부에서 디자인단의 컨트롤의 내용을 변경하려면

Invoke 를 쓰면서 작업을 해줘야하는데

좀 쉽게 할수 있는 방법이 있어 공유합니다.

아시는 분은 패스~

 this.Invoke(new MethodInvoker(
                 delegate()
                 {
                     // 변경하고자 하는 작업을 코딩합니다.
                      this.progressbar.value = 40;
                      this.progressbarLabel.Text ="40";
                 }
                 )
            );
728x90