dgui - Button continually repainting
Mike James via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Sep 9 03:50:10 PDT 2014
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=-.
More information about the Digitalmars-d-learn
mailing list