* UIHeaderButton: 增加字体图标背景时鼠标移上背景色
This commit is contained in:
parent
b483f27724
commit
02fc4e38d5
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2
SunnyUI.Demo/Controls/FHeaderButton.Designer.cs
generated
2
SunnyUI.Demo/Controls/FHeaderButton.Designer.cs
generated
@ -181,6 +181,7 @@ namespace Sunny.UI.Demo
|
|||||||
// uiHeaderButton1
|
// uiHeaderButton1
|
||||||
//
|
//
|
||||||
this.uiHeaderButton1.CircleColor = System.Drawing.Color.RoyalBlue;
|
this.uiHeaderButton1.CircleColor = System.Drawing.Color.RoyalBlue;
|
||||||
|
this.uiHeaderButton1.CircleHoverColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(128)))), ((int)(((byte)(255)))));
|
||||||
this.uiHeaderButton1.Cursor = System.Windows.Forms.Cursors.Hand;
|
this.uiHeaderButton1.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||||
this.uiHeaderButton1.Font = new System.Drawing.Font("微软雅黑", 12F);
|
this.uiHeaderButton1.Font = new System.Drawing.Font("微软雅黑", 12F);
|
||||||
this.uiHeaderButton1.Location = new System.Drawing.Point(100, 1);
|
this.uiHeaderButton1.Location = new System.Drawing.Point(100, 1);
|
||||||
@ -190,6 +191,7 @@ namespace Sunny.UI.Demo
|
|||||||
this.uiHeaderButton1.Radius = 0;
|
this.uiHeaderButton1.Radius = 0;
|
||||||
this.uiHeaderButton1.RadiusSides = Sunny.UI.UICornerRadiusSides.None;
|
this.uiHeaderButton1.RadiusSides = Sunny.UI.UICornerRadiusSides.None;
|
||||||
this.uiHeaderButton1.RectSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.None;
|
this.uiHeaderButton1.RectSides = System.Windows.Forms.ToolStripStatusLabelBorderSides.None;
|
||||||
|
this.uiHeaderButton1.ShowCircleHoverColor = true;
|
||||||
this.uiHeaderButton1.Size = new System.Drawing.Size(100, 88);
|
this.uiHeaderButton1.Size = new System.Drawing.Size(100, 88);
|
||||||
this.uiHeaderButton1.Style = Sunny.UI.UIStyle.Custom;
|
this.uiHeaderButton1.Style = Sunny.UI.UIStyle.Custom;
|
||||||
this.uiHeaderButton1.Symbol = 61461;
|
this.uiHeaderButton1.Symbol = 61461;
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
* 创建日期: 2021-02-10
|
* 创建日期: 2021-02-10
|
||||||
*
|
*
|
||||||
* 2021-02-10: V3.0.1 增加文件说明
|
* 2021-02-10: V3.0.1 增加文件说明
|
||||||
|
* 2021-03-27: V3.0.2 增加字体图标背景时鼠标移上背景色
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
@ -283,6 +284,24 @@ namespace Sunny.UI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[DefaultValue(false)]
|
||||||
|
[Description("是否显示字体图标鼠标移上背景颜色"), Category("SunnyUI")]
|
||||||
|
public bool ShowCircleHoverColor { get; set; }
|
||||||
|
|
||||||
|
private Color circleHoverColor = Color.Bisque;
|
||||||
|
|
||||||
|
[DefaultValue(typeof(Color), "Bisque")]
|
||||||
|
[Description("字体图标鼠标移上背景颜色"), Category("SunnyUI")]
|
||||||
|
public Color CircleHoverColor
|
||||||
|
{
|
||||||
|
get => circleHoverColor;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
circleHoverColor = value;
|
||||||
|
Invalidate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected override void OnPaddingChanged(EventArgs e)
|
protected override void OnPaddingChanged(EventArgs e)
|
||||||
{
|
{
|
||||||
base.OnPaddingChanged(e);
|
base.OnPaddingChanged(e);
|
||||||
@ -397,7 +416,6 @@ namespace Sunny.UI
|
|||||||
//重绘父类
|
//重绘父类
|
||||||
base.OnPaint(e);
|
base.OnPaint(e);
|
||||||
|
|
||||||
|
|
||||||
SizeF ImageSize = new SizeF(0, 0);
|
SizeF ImageSize = new SizeF(0, 0);
|
||||||
if (Symbol > 0)
|
if (Symbol > 0)
|
||||||
ImageSize = e.Graphics.GetFontImageSize(Symbol, SymbolSize);
|
ImageSize = e.Graphics.GetFontImageSize(Symbol, SymbolSize);
|
||||||
@ -407,7 +425,13 @@ namespace Sunny.UI
|
|||||||
//字体图标
|
//字体图标
|
||||||
if (Symbol > 0 && Image == null)
|
if (Symbol > 0 && Image == null)
|
||||||
{
|
{
|
||||||
e.Graphics.FillEllipse(CircleColor, (Width - CircleSize) / 2.0f, Padding.Top, CircleSize, CircleSize);
|
Color bcColor = CircleColor;
|
||||||
|
if (ShowCircleHoverColor && IsHover)
|
||||||
|
{
|
||||||
|
bcColor = CircleHoverColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
e.Graphics.FillEllipse(bcColor, (Width - CircleSize) / 2.0f, Padding.Top, CircleSize, CircleSize);
|
||||||
e.Graphics.DrawFontImage(Symbol, SymbolSize, SymbolColor,
|
e.Graphics.DrawFontImage(Symbol, SymbolSize, SymbolColor,
|
||||||
new RectangleF(
|
new RectangleF(
|
||||||
symbolOffset.X + (Width - CircleSize) / 2.0f,
|
symbolOffset.X + (Width - CircleSize) / 2.0f,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user