ocsurf
asked on
Loading a lot photos, app does not respond
I have a function that selects photos, Â resizes them and then adds them to a flowlayoutpanel.
I also have a progressbar to let the user know how long it is going to take.
It works great when only selecting a few photos. but i tested it with 80 1meg photos...the application turns white and the titlebar say Not responding. After the load/resize is done. The application returns.
How can i prevent this?
I also have a progressbar to let the user know how long it is going to take.
It works great when only selecting a few photos. but i tested it with 80 1meg photos...the application turns white and the titlebar say Not responding. After the load/resize is done. The application returns.
How can i prevent this?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
DoEvents won't let you take advantage of multiple cores or multiple CPUs, though.... this can only be done by having additional threads spun up.
ASKER
perfect thanks!
http://msdn2.microsoft.com/en-us/library/system.windows.forms.application.doevents.aspx
or use Thread.Sleep(miliseconds) to give it time to respond (DoEvents is better I think):
http://msdn2.microsoft.com/en-us/library/system.windows.forms.application.doevents.aspx