Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running each child form as a separate thread in a MDI container

Is it possible to run each child form of a MDI form on a separate thread? If so, can you please give some codes and example how to setup this?

Thanks!

like image 850
Saeid Yazdani Avatar asked Dec 06 '25 10:12

Saeid Yazdani


2 Answers

I can't tell from the question wether you are aware of the exotic nature of the solution you are proposing. I apologize if this answer completely misses the mark.

I assume that you want responsiveness in your application. That you don't want other forms to "hang" while one form is doing work.

However, having a different GUI thread per form is not how one usually achieves this. I don't know if it is even possible.

You will still have only one thread handling all the graphics (aka "the GUI Thread"), but all time consuming work should be immediately offloaded to another thread (aka worker thread). That way the app remains responsive.

I suggest you check out this video. Applicable or not, within 4-6 minutes, you should know wether this is the answer you are looking for.

DNRTV episode with Stephen Toub

Another possibility is that you are asking about how to display a form without it being modal.

like image 65
Tormod Avatar answered Dec 07 '25 22:12

Tormod


No.

Any GUI activity has to happen on the main thread.

Processing can be done in a separate thread, in which case, try using the BackgroundWorker in your child forms.

like image 36
LarsTech Avatar answered Dec 07 '25 22:12

LarsTech



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!