* UIIPTextBox: 修复Enabled切换时背景色不一致的问题

This commit is contained in:
Sunny 2023-05-10 21:09:51 +08:00
parent 2a859f60e9
commit ca15a2f1c5
4 changed files with 29 additions and 16 deletions

View File

@ -639,8 +639,8 @@ namespace Sunny.UI
e.Graphics.FillEllipse(bcColor, (Width - CircleSize) / 2.0f, Height - Padding.Bottom - CircleSize, CircleSize, CircleSize);
e.Graphics.DrawFontImage(Symbol, SymbolSize, SymbolColor,
new RectangleF(
symbolOffset.X + (Width - CircleSize) / 2.0f,
new Rectangle(
symbolOffset.X + (int)(Width - CircleSize) / 2,
symbolOffset.Y + Height - Padding.Bottom - CircleSize,
CircleSize,
CircleSize));
@ -667,9 +667,9 @@ namespace Sunny.UI
e.Graphics.FillEllipse(bcColor, Padding.Left, (Height - CircleSize) / 2.0f, CircleSize, CircleSize);
e.Graphics.DrawFontImage(Symbol, SymbolSize, SymbolColor,
new RectangleF(
new Rectangle(
symbolOffset.X + Padding.Left,
symbolOffset.Y + (Height - CircleSize) / 2.0f,
symbolOffset.Y + (int)(Height - CircleSize) / 2,
CircleSize,
CircleSize));
}
@ -699,9 +699,9 @@ namespace Sunny.UI
e.Graphics.FillEllipse(bcColor, Width - Padding.Right - CircleSize, (Height - CircleSize) / 2.0f, CircleSize, CircleSize);
e.Graphics.DrawFontImage(Symbol, SymbolSize, SymbolColor,
new RectangleF(
new Rectangle(
symbolOffset.X + Width - Padding.Right - CircleSize,
symbolOffset.Y + (Height - CircleSize) / 2.0f,
symbolOffset.Y + (int)(Height - CircleSize) / 2,
CircleSize,
CircleSize));
}
@ -727,8 +727,8 @@ namespace Sunny.UI
e.Graphics.FillEllipse(bcColor, (Width - CircleSize) / 2.0f, Padding.Top, CircleSize, CircleSize);
e.Graphics.DrawFontImage(Symbol, SymbolSize, SymbolColor,
new RectangleF(
symbolOffset.X + (Width - CircleSize) / 2.0f,
new Rectangle(
symbolOffset.X + (int)(Width - CircleSize) / 2,
symbolOffset.Y + Padding.Top,
CircleSize,
CircleSize));

View File

@ -19,6 +19,7 @@
* 2022-01-29: V3.1.0
* 2022-11-02: V3.2.6 TextChanged事件
* 2022-12-02: V3.3.0 TextChanged事件ValueChanged事件
* 2022-05-10: V3.3.6 Enabled切换时背景色不一致的问题
******************************************************************************/
using System;
@ -264,6 +265,19 @@ namespace Sunny.UI
txt4.ForeColor = UIFontColor.Primary;
}
protected override void OnEnabledChanged(EventArgs e)
{
base.OnEnabledChanged(e);
txt1.BackColor = Enabled ? fillColor : FillDisableColor;
txt1.ForeColor = UIFontColor.Primary;
txt2.BackColor = Enabled ? fillColor : FillDisableColor;
txt2.ForeColor = UIFontColor.Primary;
txt3.BackColor = Enabled ? fillColor : FillDisableColor;
txt3.ForeColor = UIFontColor.Primary;
txt4.BackColor = Enabled ? fillColor : FillDisableColor;
txt4.ForeColor = UIFontColor.Primary;
}
/// <summary>
/// 重载绘图
/// </summary>

View File

@ -518,8 +518,7 @@ namespace Sunny.UI
{
if (symbol > 0)
{
e.Graphics.DrawFontImage(symbol, symbolSize, textColor, new RectangleF(NodeX + i * NodeSize.Width + (NodeSize.Width - sf.Width - symbolSize) / 2.0f, NodeY, symbolSize, NodeSize.Height));
e.Graphics.DrawFontImage(symbol, symbolSize, textColor, new Rectangle(NodeX + i * NodeSize.Width + (int)(NodeSize.Width - sf.Width - symbolSize) / 2, NodeY, symbolSize, NodeSize.Height));
}
else
{

View File

@ -379,10 +379,10 @@ namespace Sunny.UI
if (Symbol > 0 && Image == null)
{
e.Graphics.DrawFontImage(Symbol, SymbolSize, GetSymbolForeColor(),
new RectangleF(
(Width - ImageSize.Width) / 2.0f,
Padding.Top + (Height - ImageSize.Height - Padding.Top - Padding.Bottom) / 2.0f,
ImageSize.Width, ImageSize.Height), SymbolOffset.X, SymbolOffset.Y);
new Rectangle(
(int)(Width - ImageSize.Width) / 2,
Padding.Top + (int)(Height - ImageSize.Height - Padding.Top - Padding.Bottom) / 2,
(int)ImageSize.Width, (int)ImageSize.Height), SymbolOffset.X, SymbolOffset.Y);
}
if (Image != null)
@ -401,7 +401,7 @@ namespace Sunny.UI
if (Symbol > 0 && Image == null)
{
e.Graphics.DrawFontImage(Symbol, SymbolSize, GetSymbolForeColor(),
new RectangleF((Width - allWidth) / 2.0f, (Height - ImageSize.Height) / 2.0f, ImageSize.Width, ImageSize.Height), SymbolOffset.X, SymbolOffset.Y);
new Rectangle((int)(Width - allWidth) / 2, (int)(Height - ImageSize.Height) / 2, (int)ImageSize.Width, (int)ImageSize.Height), SymbolOffset.X, SymbolOffset.Y);
}
if (Image != null)
@ -472,7 +472,7 @@ namespace Sunny.UI
if (Symbol > 0 && Image == null)
{
e.Graphics.DrawFontImage(Symbol, SymbolSize, GetSymbolForeColor(),
new RectangleF(left, top, ImageSize.Width, ImageSize.Height), SymbolOffset.X, SymbolOffset.Y);
new Rectangle((int)left, (int)top, (int)ImageSize.Width, (int)ImageSize.Height), SymbolOffset.X, SymbolOffset.Y);
}
if (Image != null)