OnDrawBackground in a TranslucentForm

Anything other than problems and feature requests.

Moderators: Frank Hileman, Anne Szyjan

Post Reply
User avatar
Frank Hileman
Site Admin
Posts: 1400
Joined: Sun Jul 25, 2004 8:16 pm
Location: California
Contact:

OnDrawBackground in a TranslucentForm

Post by Frank Hileman » Tue Oct 12, 2010 9:46 am

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:
DrawBackgroundTest

Post Reply