|
-
Oct 21st, 2014, 10:06 PM
#2
Re: Dispose large number of controls quickly? or better manage resources?
 Originally Posted by stepdragon
is there another option that I hadn't considered?
Yes there is. Put the PictureBoxes into a temporary array or collection, Clear the FlowLayoutPanel and then loop through the temp list to Dispose everything.
You could even run the loop on a secondary thread so that it doesn't hold up what you're doing in your UI. Of course, each PictureBox would have to actually be disposed on the UI thread but you can use an invocation for that. That way, the disposal of the PictureBoxes will only occur at times when the UI thread is not busy. I'll put together an example.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|