www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - dgui - self defined components with double buffering

Hi,
I habe several self defined components in my Windows.
During resizing of the Windows, the Windows controls
gets ugly and then disappear. I want to implement
double buffering but found no obvious way to create
a memory canvas and after having done the drawing copying
It to the canvas of the control.

Current implementation looks this:

class TitleBox : PictureBox
{
     private Color startColor_ = SystemColors.darkGray;
     private Color endColor_ = SystemColors.white;

     protected override void onPaint(PaintEventArgs e)
     {
        Canvas c = e.canvas;
        c.fillRectGradient(Rect(nullPoint, this.size), 
startColor_, endColor_, GradientFillRectMode.vertical);
        c.drawText(text, Rect(Point(2,2), this.size));

        super.onPaint(e);
     }
}

Does anyone have an idea?

Kind regards
André
Sep 09 2014