The problem is that the SetStyle method of the Control class is protected, which
is why the compiler is complaining.
It seems that you need to create a new class derived from Panel and set the
control styles in the constructor. Something like:
public class DoubleBufferPanel : Panel
// Set the value of the double-buffering style bits to true.
You can then use this new class instead of your panel. Just replace the
System.Windows.Forms.Panel declaration with your DoubleBufferPanel where the
panel variable is declared and where the panel is created in InitializeComponent().
System.Windows.Forms.Panel panel1 becomes DoubleBufferPanel panel1
panel1 = new System.Windows.Forms.Panel(); becomes panel1 = new DoubleBufferPanel();
hope this helps.
Sequence Diagram Editor - A quick and easy way to draw and edit sequence diagrams
Millennium Falcon wrote:
In my application, I have a panel in the middle of the form, which I'll be
using as a drawing panel. I would like to update the drawing panel each time
when it is required, without updating the form as a whole. The following
snippet makes compiler mad :
this.DXPanel.SetStyle(ControlStyles.AllPaintingInW mPaint |
How can I apply double buffering to panel to update it (with its paint
Please respond in C#. I am new to C# and have no knowledge in VB.
Thanks for all the suggestion.