Reputation: 93
I am loading something that takes a long time in OnPaint function the first time I run my program, and I need a way to show my progress. I already have the progress stuff up, but I just don't know the simplest way to show it.
Want either
Something to keep the form responsive when stucked in OnPaint function for a prolonged period, I am changing the title name to show progression and I want the form to stay responsive!
Pop up something else that is easily created to show progress
btw, I am loading it only OnPaint because I wanted the form to show up so that the user will know that the program opened correctly. Otherwise nothing will happen while the form loads, and the user might think that the program was not even opened.
Upvotes: 0
Views: 143
Reputation: 93
As per mentioned by Jeremy Thompson, many thanks
Though I need to wait 2 days to be able to accept this answer.
Upvotes: 0
Reputation: 253
There is not a lot of context here, but if I understand correctly it appears that you have something that needs to happen when the form loads and it might take a long time. You are trying to do this in the paint event because you want to make sure that the user sees something while whatever is loading completes.
Is that assessment correct?
If so, I recommend that you consider the BackgroundWorker class as it will let you do the expensive 'loading' you discuss while keeping the UI responsive.
The example with the documentation does a great job so I'll not write another sample here...
Chris
Upvotes: 2