occr
asked on
How to release resouces used by a PictureBox and still use it
I have a program that uses PictureBox control to display a tiff image. The only property/method i am using for this control is the Handle. I use routines from a proprietary DLL to manipulate the image, basically display and merge text into the tiff image.
The issue i am having is that after about two hundred images have been processed, the program crashes and displays the message, "Screen-compatible bitmap cannot be created. The screen bitmap format cannot be determined."
If I reduce the amount of text that i add to the tiff image by half then i can process almost twice as many (almost 350+) images. Also if i add and use a second PictureBox control and switch to it after processing about 175 images i can process twice as many images in one run.
I think that the resources being used by the PictureBox contol are not being released.
If i use the Dispose method to release resources, i can no longer use the PictureBox control. I get the message "Cannot access a disposed object".
How can i release resources used by the PictureBox control after processing each image and still use it?
Any help is greatly appreciated. Thank you.
The issue i am having is that after about two hundred images have been processed, the program crashes and displays the message, "Screen-compatible bitmap cannot be created. The screen bitmap format cannot be determined."
If I reduce the amount of text that i add to the tiff image by half then i can process almost twice as many (almost 350+) images. Also if i add and use a second PictureBox control and switch to it after processing about 175 images i can process twice as many images in one run.
I think that the resources being used by the PictureBox contol are not being released.
If i use the Dispose method to release resources, i can no longer use the PictureBox control. I get the message "Cannot access a disposed object".
How can i release resources used by the PictureBox control after processing each image and still use it?
Any help is greatly appreciated. Thank you.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Glad the DLL was well documented!... =)
ASKER