Skip to content

Instantly share code, notes, and snippets.

@denis-sh
Created May 21, 2014 08:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save denis-sh/56e2104dba7d9793f68d to your computer and use it in GitHub Desktop.
Save denis-sh/56e2104dba7d9793f68d to your computer and use it in GitHub Desktop.
DGui button with image example
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());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment