[Mono-list] OnPaint with double buffering

Jansen Bart bjansen at etro.vub.ac.be
Wed Sep 26 11:18:11 EDT 2007


Hi all,

It seems that the OnPaint method is not called correctly on UserControls
when using double buffering.

See code below: if the two lines are uncommented, the "control painted"
text is not shown after minimizing/maximizing for instance.  Without
double buffering the text is shown correctly.

Is this a known issue? If not, I'll file a bug report ...

public class MyControl : UserControl
    {
        public MyControl()
        {
            this.Size = new Size(100, 100);
            this.BackColor = Color.Green;

            //SetStyle(ControlStyles.OptimizedDoubleBuffer, true); // do
double buffering
            //SetStyle(ControlStyles.AllPaintingInWmPaint, true);
        }

        protected override void OnPaint(PaintEventArgs e)
        {
            Console.WriteLine("control painted");
        }
    }

Bart


More information about the Mono-list mailing list