Page 1 of 1

OnDrawBackground in a TranslucentForm

Posted: Tue Oct 12, 2010 9:46 am
by Frank Hileman
A Picture can control its background erasure mechanism by overriding OnDrawBackground. When you do this on a TranslucentForm, you must ensure all pixels are cleared. If you use a System.Drawing.Bitmap for erasure, and it has transparency, it will not erase everything. Before you draw the Bitmap, clear the Graphics using Color.Transparent. The technique is illustrated in the sample below: