colorpicker.cs
来自「一个C#加上flowchart控件的例程」· CS 代码 · 共 55 行
CS
55 行
using System;
using System.Windows.Forms;
using System.Drawing;
namespace FlowCharter
{
/// <summary>
/// Summary description for ColorPicker.
/// </summary>
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();
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?