2010-06-07 6 views
2

내 앱을 시작할 때 사용하고있는 컨트롤에서 약간의 지연이 발생합니다. 컨트롤이 그려진 뒤에 기본 폼 을 표시 할 수 있습니까?시작시 컨트롤 시작 지연

+0

메인 폼이 나타나면 컨트롤이 즉시 나타나지 않는다고 말하고 있습니까? – egrunin

+0

나는 그렇다고 생각한다. 폼이 표시된 후에 컨트롤이 나타납니다. – blez

답변

1

양식의로드 메소드에서 Application.Idle 이벤트를 구독하고 일단 호출하면이 이벤트의 구독을 취소하십시오. 이와 같이 :

public Form() 
{ 
    InitializeComponent(); 
} 

private void Form_Load(object sender, EventArgs e) 
{ 
    Application.Idle += new EventHandler(Application_Idle); 
    // any loading prep code here 
} 

private void Application_Idle(object sender, EventArgs e) 
{ 
    Application.Idle -= new EventHandler(Application_Idle); 
    // additional code here, which is executed *after* controls are visible and loaded 
} 
관련 문제