⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 colorpicker.cs

📁 一个C#加上flowchart控件的例程
💻 CS
字号:
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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -