How do I show a “Loading . . . please wait” message in Winforms for a long loading form?

前端 未结 12 622
一生所求
一生所求 2020-12-04 17:29

I have a form that is very slow because there are many controls placed on the form.

As a result the form takes a long time to loaded.

How do I load the fo

12条回答
  •  眼角桃花
    2020-12-04 18:23

    I put some animated gif in a form called FormWait and then I called it as:

    // show the form
    new Thread(() => new FormWait().ShowDialog()).Start();
    
    // do the heavy stuff here
    
    // get the form reference back and close it
    FormWait f = new FormWait();
    f = (FormWait)Application.OpenForms["FormWait"];
    f.Close();
    

提交回复
热议问题