Flicker free drawing on Panel

  • Thread starter Thread starter arlef
  • Start date Start date
A

arlef

Hi there,
Is there a way to achieve flicker free drawing on a Panel? I know it is
possible on a form using the double buffered property.
However, I do not know how to achieve the same using a Panel.

Please can somebody help.

Regards,
James
 
The DoubleBuffered property is not a property of System.Windows.Forms.Form,
but of System.Windows.Forms.Control. Both System.Windows.Forms.Form and
System.Windows.Forms.Panel inherit System.Windows.Forms.Control.

--
HTH,

Kevin Spencer
Microsoft MVP
Short Order Coder
http://unclechutney.blogspot.com

The devil is in the yada yada yada
 
arlef said:
Is there a way to achieve flicker free drawing on a Panel?

Here's what I use. For brevity, I've omitted the Dispose and
InitializeComponent methods (generated automatically by the Forms
Designer).

public class FlickerFreePanel : System.Windows.Forms.Panel
{
public FlickerFreePanel() : base()
{
this.SetStyle(ControlStyles.DoubleBuffer, true);
this.SetStyle(ControlStyles.UserPaint, true);
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);

this.UpdateStyles();
}
}
 
Kevin said:
The DoubleBuffered property is not a property of System.Windows.Forms.Form,
but of System.Windows.Forms.Control. Both System.Windows.Forms.Form and
System.Windows.Forms.Panel inherit System.Windows.Forms.Control.

Yes, but it is a protected property so it is only available to derived
classes. So the op will have to derive his own panel from the existing
panel control.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top