开发者

Control init lag at startup

I get a small lag at the 开发者_JAVA技巧controls I'm using when I start up my app. Can I show the main form after the controls are drawn?


Try subscribing to the Application.Idle event inside your form's load method, and unsubscribing from it once invoked. Like this:

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
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜