* UIRoundProcess: 内圈尺寸小的时候更新配色

This commit is contained in:
Sunny 2023-07-12 23:41:49 +08:00
parent 4b0ca7dca6
commit ed5353224c
2 changed files with 35 additions and 0 deletions

View File

@ -19,12 +19,14 @@
* 2021-04-08: V3.0.2 * 2021-04-08: V3.0.2
* 2021-10-18: V3.0.8 * 2021-10-18: V3.0.8
* 2022-03-19: V3.1.1 * 2022-03-19: V3.1.1
* 2023-07-12: V3.4.0
******************************************************************************/ ******************************************************************************/
using System; using System;
using System.ComponentModel; using System.ComponentModel;
using System.Drawing; using System.Drawing;
using System.Drawing.Drawing2D; using System.Drawing.Drawing2D;
using System.Windows.Forms;
namespace Sunny.UI namespace Sunny.UI
{ {
@ -165,6 +167,29 @@ namespace Sunny.UI
} }
} }
protected override void OnPaintFore(Graphics g, GraphicsPath path)
{
if (ShowText)
{
Size size = TextRenderer.MeasureText(Text, Font);
if (Inner * 2 < size.Width - 4)
g.DrawString(Text, Font, ForeColor2, new Rectangle(0, 0, Width, Height), ContentAlignment.MiddleCenter);
else
g.DrawString(Text, Font, ForeColor, new Rectangle(0, 0, Width, Height), ContentAlignment.MiddleCenter);
}
}
private Color foreColor2 = Color.Black;
public Color ForeColor2
{
get => foreColor2;
set
{
foreColor2 = value;
Invalidate();
}
}
public delegate void OnValueChanged(object sender, int value); public delegate void OnValueChanged(object sender, int value);
public event OnValueChanged ValueChanged; public event OnValueChanged ValueChanged;
@ -201,6 +226,7 @@ namespace Sunny.UI
fillColor = uiColor.ProcessBarForeColor; fillColor = uiColor.ProcessBarForeColor;
foreColor = uiColor.ProcessBarForeColor; foreColor = uiColor.ProcessBarForeColor;
rectColor = uiColor.ProcessBackColor; rectColor = uiColor.ProcessBackColor;
foreColor2 = uiColor.RoundProcessForeColor2;
} }
[DefaultValue(false)] [DefaultValue(false)]

View File

@ -229,6 +229,9 @@ namespace Sunny.UI
//SplitContainer //SplitContainer
public virtual Color SplitContainerArrowColor { get; protected set; } public virtual Color SplitContainerArrowColor { get; protected set; }
//RoundProcess
public virtual Color RoundProcessForeColor2 { get; protected set; }
protected Color ForeColor { get; set; } protected Color ForeColor { get; set; }
public UIBaseStyle DropDownStyle { get; protected set; } public UIBaseStyle DropDownStyle { get; protected set; }
@ -402,6 +405,8 @@ namespace Sunny.UI
FlowLayoutPanelBarFillColor = PlainColor; FlowLayoutPanelBarFillColor = PlainColor;
FlowLayoutPanelBarForeColor = PrimaryColor; FlowLayoutPanelBarForeColor = PrimaryColor;
RoundProcessForeColor2 = Color.Black;
DropDownStyle = this; DropDownStyle = this;
return this; return this;
@ -597,6 +602,8 @@ namespace Sunny.UI
DropDownPanelFillColor = UIColor.LightBlue; DropDownPanelFillColor = UIColor.LightBlue;
DropDownPanelForeColor = UIFontColor.Primary; DropDownPanelForeColor = UIFontColor.Primary;
RoundProcessForeColor2 = Color.White;
DropDownStyle = UIStyles.Blue; DropDownStyle = UIStyles.Blue;
SplitContainerArrowColor = UIColor.Blue; SplitContainerArrowColor = UIColor.Blue;
@ -715,6 +722,8 @@ namespace Sunny.UI
DropDownPanelFillColor = UIColor.LightBlue; DropDownPanelFillColor = UIColor.LightBlue;
DropDownPanelForeColor = UIFontColor.Primary; DropDownPanelForeColor = UIFontColor.Primary;
RoundProcessForeColor2 = Color.White;
DropDownStyle = UIStyles.Blue; DropDownStyle = UIStyles.Blue;
SplitContainerArrowColor = UIColor.Blue; SplitContainerArrowColor = UIColor.Blue;