Skip to content

Instantly share code, notes, and snippets.

@cwensley
Last active December 18, 2015 22:08
Show Gist options
  • Save cwensley/5851835 to your computer and use it in GitHub Desktop.
Save cwensley/5851835 to your computer and use it in GitHub Desktop.
Custom image button
using System;
using Eto.Drawing;
using Eto.Forms;
namespace Samples
{
public class MyButton : Drawable
{
Image image;
public Image Image
{
get { return image; }
set
{
image = value;
if (image != null)
Size = image.Size;
Invalidate();
}
}
public override void OnPaint(PaintEventArgs pe)
{
base.OnPaint(pe);
if (image != null)
pe.Graphics.DrawImage(image, PointF.Empty);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment