* UIColorPicker: 修复选中颜色不显示

This commit is contained in:
Sunny 2022-03-10 17:55:56 +08:00
parent 75845313cb
commit 415773efac
3 changed files with 4 additions and 2 deletions

Binary file not shown.

Binary file not shown.

View File

@ -11,13 +11,14 @@
* If you use this code, please keep this note. * If you use this code, please keep this note.
* 使 * 使
****************************************************************************** ******************************************************************************
* : UIDatePicker.cs * : UIColorPicker.cs
* : * :
* : V3.1 * : V3.1
* : 2020-05-29 * : 2020-05-29
* *
* 2020-05-31: V2.2.5 * 2020-05-31: V2.2.5
* 2021-03-13: V3.0.2 * 2021-03-13: V3.0.2
* 2022-03-10: V3.1.1
****************************************************************************** ******************************************************************************
* : UIColorPicker.cs * : UIColorPicker.cs
* : Color picker with color wheel and eye dropper * : Color picker with color wheel and eye dropper
@ -58,7 +59,6 @@ namespace Sunny.UI
public UIColorPicker() public UIColorPicker()
{ {
InitializeComponent(); InitializeComponent();
ShowText = false;
Value = UIColor.Blue; Value = UIColor.Blue;
} }
@ -113,6 +113,7 @@ namespace Sunny.UI
protected override void OnPaintFore(Graphics g, System.Drawing.Drawing2D.GraphicsPath path) protected override void OnPaintFore(Graphics g, System.Drawing.Drawing2D.GraphicsPath path)
{ {
base.OnPaintFore(g, path); base.OnPaintFore(g, path);
if (Text.IsValid()) Text = "";
var pathColor = g.CreateRoundedRectanglePath(new Rectangle(3, 3, Width - 32, Height - 7), 3, UICornerRadiusSides.All); var pathColor = g.CreateRoundedRectanglePath(new Rectangle(3, 3, Width - 32, Height - 7), 3, UICornerRadiusSides.All);
g.FillPath(Value, pathColor); g.FillPath(Value, pathColor);
} }
@ -120,6 +121,7 @@ namespace Sunny.UI
protected override void OnPaint(PaintEventArgs e) protected override void OnPaint(PaintEventArgs e)
{ {
base.OnPaint(e); base.OnPaint(e);
if (DropDownStyle != UIDropDownStyle.DropDownList) if (DropDownStyle != UIDropDownStyle.DropDownList)
DropDownStyle = UIDropDownStyle.DropDownList; DropDownStyle = UIDropDownStyle.DropDownList;
} }