I have a Form with a Panel mainBackPanel. To mainBackPanel I add different panels say redPanel, greenPanel, bluePanel depending on key pressed, r, g, b respectively. Each panel has a different image (say tomatoes, trees, sky) and a transparent label.
Now when the panel changes, I see a small flicker on the area covered by the label.
mainBackPanel (to which the individual panels are added) is double buffered.
All KeyEvents are being handled by MainForm in the following method
void mainFormKeyUpHandler(Object o, KeyEventArgs kev)
{
if( kev.KeyCode == Keys.R )
{
this.mainBackPanel.Controls.Clear();
this.mainBackPanel.SuspendLayout();
this.mainBackPanel.Controls.Add(this.mainFormPanel); this.mainBackPanel.ResumeLayout();
}
else
.
.
.
}
The code, in .NET 2.0, can be found
here.
You will need to put 3 image files namely fb.jpg, mf.jpg and pl.jpg in bin/debug folder prior to running the app.
Please suggest how to get rid of the flicker.
Thanks
Sukhjinder