* UIVerificationCode: 可以自定义颜色 #IBABW1

This commit is contained in:
Sunny 2024-12-12 20:49:26 +08:00
parent 000c567255
commit 09ba37daa3
2 changed files with 27 additions and 2 deletions

View File

@ -63,7 +63,7 @@ namespace Sunny.UI
TabStop = true; TabStop = true;
Width = 100; Width = 100;
Height = 35; Height = 35;
Cursor = Cursors.Hand; base.Cursor = Cursors.Hand;
plainColor = UIStyles.Blue.PlainColor; plainColor = UIStyles.Blue.PlainColor;

View File

@ -19,6 +19,7 @@
* 2022-06-11: V3.1.9 * 2022-06-11: V3.1.9
* 2023-05-16: V3.3.6 DrawString函数 * 2023-05-16: V3.3.6 DrawString函数
* 2022-05-28: V3.3.7 * 2022-05-28: V3.3.7
* 2024-12-12: V3.8.0 #IBABW1
******************************************************************************/ ******************************************************************************/
using System; using System;
@ -38,6 +39,7 @@ namespace Sunny.UI
{ {
SetStyleFlags(); SetStyleFlags();
fillColor = UIStyles.Blue.PlainColor; fillColor = UIStyles.Blue.PlainColor;
foreColor = UIStyles.Blue.RectColor;
Width = 100; Width = 100;
Height = 35; Height = 35;
} }
@ -50,6 +52,7 @@ namespace Sunny.UI
{ {
base.SetStyleColor(uiColor); base.SetStyleColor(uiColor);
fillColor = uiColor.PlainColor; fillColor = uiColor.PlainColor;
foreColor = uiColor.RectColor;
} }
/// <summary> /// <summary>
@ -62,6 +65,28 @@ namespace Sunny.UI
Invalidate(); Invalidate();
} }
/// <summary>
/// 边框颜色
/// </summary>
[Description("边框颜色"), Category("SunnyUI")]
[DefaultValue(typeof(Color), "80, 160, 255")]
public Color RectColor
{
get => rectColor;
set => SetRectColor(value);
}
/// <summary>
/// 字体颜色
/// </summary>
[Description("字体颜色"), Category("SunnyUI")]
[DefaultValue(typeof(Color), "80, 160, 255")]
public override Color ForeColor
{
get => foreColor;
set => SetForeColor(value);
}
/// <summary> /// <summary>
/// 绘制填充颜色 /// 绘制填充颜色
/// </summary> /// </summary>
@ -137,7 +162,7 @@ namespace Sunny.UI
image.SetPixel(x, y, Color.FromArgb(random.Next())); 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); g.DrawString(code, fontex, br, image.Width / 2 - sf.Width / 2, image.Height / 2 - sf.Height / 2);
return TwistImage(image, true, 3, 5); return TwistImage(image, true, 3, 5);
} }