Hello,
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 DoubleBufferPan el : Panel
{
public DoubleBufferPan el()
{
// Set the value of the double-buffering style bits to true.
this.SetStyle(C ontrolStyles.Do ubleBuffer |
ControlStyles.U serPaint |
ControlStyles.A llPaintingInWmP aint,
true);
this.UpdateStyl es();
}
}
You can then use this new class instead of your panel. Just replace the
System.Windows. Forms.Panel declaration with your DoubleBufferPan el where the
panel variable is declared and where the panel is created in InitializeCompo nent().
For example,
System.Windows. Forms.Panel panel1 becomes DoubleBufferPan el panel1
and
panel1 = new System.Windows. Forms.Panel(); becomes panel1 = new DoubleBufferPan el();
hope this helps.
--
Rodger Constandse
<http://www.SequenceDia gramEditor.com>
Sequence Diagram Editor - A quick and easy way to draw and edit sequence diagrams
Millennium Falcon wrote:
Hi!
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.Se tStyle(ControlS tyles.AllPainti ngInWmPaint |
ControlStyles.O paque, true);
How can I apply double buffering to panel to update it (with its paint
method and
without flickers)?
Please respond in C#. I am new to C# and have no knowledge in VB.
Thanks for all the suggestion.
Regards