CommonTools/ColorPickerCtrl/ColorWheel.cs

(开头部分) 5KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Data;
using System.Text;
using System.Windows.Forms;

namespace CommonTools
{
	class ColorWheel : Control
	{
		public event EventHandler SelectedColorChanged;
		
		Color m_frameColor = Color.CadetBlue;
		HSLColor m_selectedColor = new HSLColor(Color.BlanchedAlmond);
		PathGradientBrush m_brush = null;
		List<PointF> m_path = new List<PointF>();
		List<Color> m_colors = new List<Color>();
		double m_wheelLightness = 0.5;

		public HSLColor SelectedHSLColor
		{
			get { return m_selectedColor; }
			set 
			{
				if (m_selectedColor == value)
					return;
				Invalidate(Util.Rect(ColorSelectorRectangle));
				m_selectedColor = value;
				if (SelectedColorChanged != null)
					SelectedColorChanged(this, null);
				Refresh();//Invalidate(Util.Rect(ColorSelectorRectangle));
			}
		}
		public ColorWheel()
		{
			SetStyle(ControlStyles.SupportsTransparentBackColor, true);
			DoubleBuffered = true;
			SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.UserPaint, true);
		}
		
		protected override void OnGotFocus(EventArgs e)
		{
			base.OnGotFocus(e);
			Invalidate();
		}
		protected override void OnLostFocus(EventArgs e)
		{
			base.OnLostFocus(e);
			Invalidate();
		}
		protected override void OnPaint(PaintEventArgs e)
		{
			using (SolidBrush b = new SolidBrush(BackColor))
			{
				e.Graphics.FillRectangle(b, ClientRectangle);
			}
			RectangleF wheelrect = WheelRectangle;
后面还有 165 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。