controls doesn't show if run on a background thread ( c# winform)

前端 未结 1 1489
星月不相逢
星月不相逢 2021-01-28 10:41

I have a form (complexForm in the code) with multiple controls which takes some time to load. So I decided to put in in a separate thread in order to decrease i

1条回答
  •  一整个雨季
    2021-01-28 11:01

    Do not do this. It'll end in tears. Only ever create UI controls from the UI thread - that's the thread that owns the message pump, which is crucial to proper operation.

    The right solution to this is to create a Splash Screen which is shown while your main window is initialising.

    There's quite a few threads on Stack Overflow about how to create a splash screen.

    0 讨论(0)
提交回复
热议问题