Hi all, I have a background image stored in the database so instead of setting BackgroundImage property of the form I handle OnPaint event to draw the image on the background for each form. The problem is that each control on the form invalidates parent control - the form, so the OnPaint fires multiple times (12x). Even though the image is in memory the form shortly flickers. I need to get rid of this effect. I can't see a way how to determine which control is the last to cause the parent form to repaint so I can apply the background just once. Any ideas?
protected override void OnPaint(PaintEventArgs e)
{
if (Program.AppManager.AppBackgroundImage != null && !this.EH_BackImageNotApplicable)
{
e.Graphics.DrawImage(Program.AppManager.AppBackgroundImage, this.ClientRectangle);
}
}