Question: How to check if Graphics object is usable.
My Problem: I create Graphics object from form and give it to “object X” for drawing, when form closes and “object X” tries to draw into Graphics object, GDI+ error occurs 0x80004005.
So i need to check if Graphics is drawable only having that Graphics object.
Any ideas?
When your form is closed you should inform your “object X” of this fact…
Otherwise the only way to know if a Graphics object is accessible is to call a small method on it like GetHdc (with the correct ReleaseHdc after if it succeed) and catch the error that may happens.