c# - Controls doesn't show if heavy process -
i use c# in winform.
before heavy function, want show waiting form prevent user. form opens, controls in not drawn.
in following code, waitingform little form, textbox , progressbar
using (waitingform waitingform = new waintingform()) { waitingform.show(); heavyfunction(); }
i see 2 white rectangles, controls should appear. why happens ?
you can't show waiting form before heavy processing , expect ui remain responsive. thread you're clogging heavyfunction()
same 1 responsible drawing forms, controls , maintaining ui. use backgroundworker or threadpool offload heavy processing thread.
edit: also, please consider ron beyer's input regarding async/await
Comments
Post a Comment