From 09ba37daa321cb70fb27483c5008c8e228f939a6 Mon Sep 17 00:00:00 2001 From: Sunny Date: Thu, 12 Dec 2024 20:49:26 +0800 Subject: [PATCH] =?UTF-8?q?*=20UIVerificationCode:=20=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E9=A2=9C=E8=89=B2=20#IBABW1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SunnyUI/Controls/UIButton.cs | 2 +- SunnyUI/Controls/UIVerificationCode.cs | 27 +++++++++++++++++++++++++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/SunnyUI/Controls/UIButton.cs b/SunnyUI/Controls/UIButton.cs index b07c3a07..8a9f607b 100644 --- a/SunnyUI/Controls/UIButton.cs +++ b/SunnyUI/Controls/UIButton.cs @@ -63,7 +63,7 @@ namespace Sunny.UI TabStop = true; Width = 100; Height = 35; - Cursor = Cursors.Hand; + base.Cursor = Cursors.Hand; plainColor = UIStyles.Blue.PlainColor; diff --git a/SunnyUI/Controls/UIVerificationCode.cs b/SunnyUI/Controls/UIVerificationCode.cs index 33dec3b1..27ad81d0 100644 --- a/SunnyUI/Controls/UIVerificationCode.cs +++ b/SunnyUI/Controls/UIVerificationCode.cs @@ -19,6 +19,7 @@ * 2022-06-11: V3.1.9 增加文件说明 * 2023-05-16: V3.3.6 重构DrawString函数 * 2022-05-28: V3.3.7 修改字体缩放时显示 + * 2024-12-12: V3.8.0 可以自定义颜色 #IBABW1 ******************************************************************************/ using System; @@ -38,6 +39,7 @@ namespace Sunny.UI { SetStyleFlags(); fillColor = UIStyles.Blue.PlainColor; + foreColor = UIStyles.Blue.RectColor; Width = 100; Height = 35; } @@ -50,6 +52,7 @@ namespace Sunny.UI { base.SetStyleColor(uiColor); fillColor = uiColor.PlainColor; + foreColor = uiColor.RectColor; } /// @@ -62,6 +65,28 @@ namespace Sunny.UI Invalidate(); } + /// + /// 边框颜色 + /// + [Description("边框颜色"), Category("SunnyUI")] + [DefaultValue(typeof(Color), "80, 160, 255")] + public Color RectColor + { + get => rectColor; + set => SetRectColor(value); + } + + /// + /// 字体颜色 + /// + [Description("字体颜色"), Category("SunnyUI")] + [DefaultValue(typeof(Color), "80, 160, 255")] + public override Color ForeColor + { + get => foreColor; + set => SetForeColor(value); + } + /// /// 绘制填充颜色 /// @@ -137,7 +162,7 @@ namespace Sunny.UI image.SetPixel(x, y, Color.FromArgb(random.Next())); } - using Brush br = new SolidBrush(rectColor); + using Brush br = new SolidBrush(foreColor); g.DrawString(code, fontex, br, image.Width / 2 - sf.Width / 2, image.Height / 2 - sf.Height / 2); return TwistImage(image, true, 3, 5); }