dgui - self defined components with double buffering

andre via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Sep 9 11:51:41 PDT 2014


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é


More information about the Digitalmars-d-learn mailing list