public void SetLightness(double lightness) { m_selectedColor.Lightness = lightness; Invalidate(UIColorUtil.Rect(ColorSelectorRectangle)); SelectedColorChanged?.Invoke(this, null); Refresh();//Invalidate(UIColorUtil.Rect(ColorSelectorRectangle)); }
protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); DrawColorBar(e.Graphics); if (Focused) { RectangleF lr = ClientRectangleF; lr.Inflate(-2, -2); ControlPaint.DrawFocusRectangle(e.Graphics, UIColorUtil.Rect(lr)); } }
protected void DrawColorBar(Graphics dc) { RectangleF lr = BarRectangle; if (m_numberOfColors == eNumberOfColors.Use2Colors) { UIColorUtil.Draw2ColorBar(dc, lr, Orientation, m_color1, m_color2); } else { UIColorUtil.Draw3ColorBar(dc, lr, Orientation, m_color1, m_color2, m_color3); } DrawSelector(dc, lr, Orientation, (float)Percent); }