Hi,

Just checked, on WM_PAINT all event listeners (event paint) are called.

Overwriting onPaint seems to work better (issue 18 in dgui bitbucket site). Please file this issue also on the dgui bibucket home page.

Kind regards
Andre


On Tuesday, 9 September 2014 at 10:50:11 UTC, Mike James wrote:
Hi.

I've created a graphic button as per this example on the dgui website:

import dgui.all;

class MyForm: Form
{
        this()
        {
                text = "An Exception was thrown...";
                size = Size(130, 100);

                // Or use `Bitmap.fromFile`:
                auto img = new Bitmap(90, 15, SystemColors.yellow);
                auto pen = SystemPens.blackPen;

                with(new Button())
                {
                        bounds = Rect(10, 10, 100, 25);
                        parent = this;
                        paint.attach((s, e)
                        {
                                e.canvas.drawImage(img, 5, 5);
                                e.canvas.drawLine(pen, 5, 10, 95, 10);
                                e.canvas.drawLine(pen, 10, 5, 10, 20);
                        });
                }
        }
}

int main()
{
        return Application.run(new MyForm());
}

and added a writeln("paint") in the paint.attach to show when the button is repainting. When the form with the button is visible the button is being continually repainted. Is this a 'feature' of dgui or is there a flag to set to only re-paint when the button is invalidated?

Regards, -=mike=-.

Reply via email to