Rule of thumb for System.Drawing

A friend of mine ran into this the other day.

If you call a method to get a handle some sort of System.Drawing object, you may be creating an object that needs to be cleaned up through P/Invoke or some other function call.

Bitmap.GetHIcon - requires p/invoking DestroyIcon.
Font.ToHFont - requires p/invoking DeleteObject
Graphics.GetHdc - requires calling Graphics.ReleaseHdc

The MSDN2 documentation seems to be a lot more clear about this, so if you're accessing a handle, you might want to pop over there to see if there are cleanup instructions. You might also consider using the GDICounter and reading the background info on when to use Dispose.