www.pudn.com > OA-FlowDefine.rar > ColorPicker.cs
using System;
using System.Windows.Forms;
using System.Drawing;
namespace FlowCharter
{
///
/// Summary description for ColorPicker.
///
public class ColorPicker : Button
{
public ColorPicker()
{
}
private Color _color;
public Color Color
{
get
{
return _color;
}
set
{
_color = value;
Invalidate();
}
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
SolidBrush b;
Pen p;
Rectangle r;
r = this.Bounds;
r.Offset(-r.Left, -r.Top);
b = new SolidBrush(Color);
p = new Pen(Color.Black, 0);
r.Width -= 1;
r.Height -= 1;
e.Graphics.FillRectangle(b, r);
e.Graphics.DrawRectangle(p, r);
p.Dispose();
b.Dispose();
}
}
}