* UIMiniPagination: 优化按钮自定义配色逻辑
This commit is contained in:
parent
d19339cf1f
commit
0b74e6c548
@ -20,6 +20,7 @@
|
||||
* 2023-06-14: V3.3.9 按钮图标位置修正
|
||||
* 2023-06-27: V3.3.9 内置按钮关联值由Tag改为TagString
|
||||
* 2023-08-30: V3.4.2 左右跳转按钮的文字换成字体图标
|
||||
* 2024-05-29: V3.6.6 优化按钮自定义配色逻辑
|
||||
******************************************************************************/
|
||||
|
||||
using System;
|
||||
@ -135,23 +136,6 @@ namespace Sunny.UI
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置主题样式
|
||||
/// </summary>
|
||||
/// <param name="uiColor">主题样式</param>
|
||||
public override void SetStyleColor(UIBaseStyle uiColor)
|
||||
{
|
||||
base.SetStyleColor(uiColor);
|
||||
foreach (var button in buttons.Values)
|
||||
{
|
||||
button.SetStyleColor(uiColor);
|
||||
button.FillColor = uiColor.PlainColor;
|
||||
button.SymbolColor = button.ForeColor = uiColor.PaginationForeColor;
|
||||
button.FillSelectedColor = uiColor.ButtonFillColor;
|
||||
button.BackColor = Color.Transparent;
|
||||
}
|
||||
}
|
||||
|
||||
public override void SetDPIScale()
|
||||
{
|
||||
base.SetDPIScale();
|
||||
@ -592,7 +576,6 @@ namespace Sunny.UI
|
||||
this.b16.TagString = ">";
|
||||
this.b16.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
this.b16.ZoomScaleRect = new System.Drawing.Rectangle(0, 0, 0, 0);
|
||||
this.b16.LocationChanged += new System.EventHandler(this.b16_LocationChanged);
|
||||
//
|
||||
// UIMiniPagination
|
||||
//
|
||||
@ -768,16 +751,6 @@ namespace Sunny.UI
|
||||
}
|
||||
}
|
||||
|
||||
private void b16_LocationChanged(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void btnSelect_Click(object sender, EventArgs e)
|
||||
{
|
||||
//ActivePage = edtPage.IntValue;
|
||||
}
|
||||
|
||||
private void SetDataConnection(object newDataSource, BindingMemberInfo newDisplayMember)
|
||||
{
|
||||
var dataSourceChanged = dataSource != newDataSource;
|
||||
@ -821,5 +794,151 @@ namespace Sunny.UI
|
||||
}
|
||||
|
||||
public event OnPageChangeEventHandler PageChanged;
|
||||
|
||||
/// <summary>
|
||||
/// 设置主题样式
|
||||
/// </summary>
|
||||
/// <param name="uiColor">主题样式</param>
|
||||
public override void SetStyleColor(UIBaseStyle uiColor)
|
||||
{
|
||||
base.SetStyleColor(uiColor);
|
||||
foreach (var button in buttons.Values)
|
||||
{
|
||||
button.SetStyleColor(uiColor);
|
||||
button.FillColor = button.RectColor = uiColor.ButtonFillColor;
|
||||
button.SymbolColor = button.ForeColor = uiColor.ButtonForeColor;
|
||||
b0.RectSelectedColor = button.FillSelectedColor = uiColor.ButtonFillSelectedColor;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 填充颜色,当值为背景色或透明色或空值则不填充
|
||||
/// </summary>
|
||||
[Description("按钮填充颜色"), Category("SunnyUI")]
|
||||
[DefaultValue(typeof(Color), "80, 160, 255")]
|
||||
public Color ButtonFillColor
|
||||
{
|
||||
get => b0.FillColor;
|
||||
set
|
||||
{
|
||||
foreach (var button in buttons.Values)
|
||||
{
|
||||
button.RectColor = button.FillColor = value;
|
||||
button.Style = UIStyle.Custom;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 字体颜色
|
||||
/// </summary>
|
||||
[Description("按钮字体颜色"), Category("SunnyUI")]
|
||||
[DefaultValue(typeof(Color), "White")]
|
||||
public Color ButtonForeColor
|
||||
{
|
||||
get => b0.ForeColor;
|
||||
set
|
||||
{
|
||||
foreach (var button in buttons.Values)
|
||||
{
|
||||
button.SymbolColor = button.ForeColor = value;
|
||||
button.Style = UIStyle.Custom;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[DefaultValue(typeof(Color), "115, 179, 255"), Category("SunnyUI")]
|
||||
[Description("按钮鼠标移上时填充颜色")]
|
||||
public Color ButtonFillHoverColor
|
||||
{
|
||||
get => b0.FillHoverColor;
|
||||
set
|
||||
{
|
||||
foreach (var button in buttons.Values)
|
||||
{
|
||||
button.RectHoverColor = button.FillHoverColor = value;
|
||||
button.Style = UIStyle.Custom;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[DefaultValue(typeof(Color), "White"), Category("SunnyUI")]
|
||||
[Description("按钮鼠标移上时字体颜色")]
|
||||
public Color ButtonForeHoverColor
|
||||
{
|
||||
get => b0.ForeHoverColor;
|
||||
set
|
||||
{
|
||||
foreach (var button in buttons.Values)
|
||||
{
|
||||
button.SymbolHoverColor = button.ForeHoverColor = value;
|
||||
button.Style = UIStyle.Custom;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[DefaultValue(typeof(Color), "64, 128, 204"), Category("SunnyUI")]
|
||||
[Description("按钮鼠标按下时填充颜色")]
|
||||
public Color ButtonFillPressColor
|
||||
{
|
||||
get => b0.FillPressColor;
|
||||
set
|
||||
{
|
||||
foreach (var button in buttons.Values)
|
||||
{
|
||||
button.RectPressColor = button.FillPressColor = value;
|
||||
button.Style = UIStyle.Custom;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[DefaultValue(typeof(Color), "White"), Category("SunnyUI")]
|
||||
[Description("按钮鼠标按下时字体颜色")]
|
||||
public Color ButtonForePressColor
|
||||
{
|
||||
get => b0.ForePressColor;
|
||||
set
|
||||
{
|
||||
foreach (var button in buttons.Values)
|
||||
{
|
||||
button.SymbolPressColor = button.ForePressColor = value;
|
||||
button.Style = UIStyle.Custom;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[DefaultValue(typeof(Color), "White"), Category("SunnyUI")]
|
||||
[Description("按钮鼠标按下时字体颜色")]
|
||||
public Color ButtonFillSelectedColor
|
||||
{
|
||||
get => b0.FillSelectedColor;
|
||||
set
|
||||
{
|
||||
foreach (var button in buttons.Values)
|
||||
{
|
||||
button.RectSelectedColor = button.FillSelectedColor = value;
|
||||
button.Style = UIStyle.Custom;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 滚动条主题样式
|
||||
/// </summary>
|
||||
[DefaultValue(true), Description("滚动条主题样式"), Category("SunnyUI")]
|
||||
public bool ButtonStyleInherited
|
||||
{
|
||||
get => b0 != null && b0.Style == UIStyle.Inherited;
|
||||
set
|
||||
{
|
||||
if (value && b0 != null)
|
||||
{
|
||||
foreach (var button in buttons.Values)
|
||||
{
|
||||
button.Style = UIStyle.Inherited;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -947,10 +947,10 @@ namespace Sunny.UI
|
||||
get => b0.FillColor;
|
||||
set
|
||||
{
|
||||
foreach (var b0 in buttons.Values)
|
||||
foreach (var button in buttons.Values)
|
||||
{
|
||||
b0.RectColor = b0.FillColor = value;
|
||||
b0.Style = UIStyle.Custom;
|
||||
button.RectColor = button.FillColor = value;
|
||||
button.Style = UIStyle.Custom;
|
||||
}
|
||||
|
||||
edtPage.RectColor = btnSelect.RectColor = btnSelect.FillColor = value;
|
||||
@ -968,10 +968,10 @@ namespace Sunny.UI
|
||||
get => b0.ForeColor;
|
||||
set
|
||||
{
|
||||
foreach (var b0 in buttons.Values)
|
||||
foreach (var button in buttons.Values)
|
||||
{
|
||||
b0.SymbolColor = b0.ForeColor = value;
|
||||
b0.Style = UIStyle.Custom;
|
||||
button.SymbolColor = button.ForeColor = value;
|
||||
button.Style = UIStyle.Custom;
|
||||
}
|
||||
|
||||
btnSelect.SymbolColor = btnSelect.ForeColor = value;
|
||||
@ -986,10 +986,10 @@ namespace Sunny.UI
|
||||
get => b0.FillHoverColor;
|
||||
set
|
||||
{
|
||||
foreach (var b0 in buttons.Values)
|
||||
foreach (var button in buttons.Values)
|
||||
{
|
||||
b0.RectHoverColor = b0.FillHoverColor = value;
|
||||
b0.Style = UIStyle.Custom;
|
||||
button.RectHoverColor = button.FillHoverColor = value;
|
||||
button.Style = UIStyle.Custom;
|
||||
}
|
||||
|
||||
btnSelect.RectHoverColor = btnSelect.FillHoverColor = value;
|
||||
@ -1004,10 +1004,10 @@ namespace Sunny.UI
|
||||
get => b0.ForeHoverColor;
|
||||
set
|
||||
{
|
||||
foreach (var b0 in buttons.Values)
|
||||
foreach (var button in buttons.Values)
|
||||
{
|
||||
b0.SymbolHoverColor = b0.ForeHoverColor = value;
|
||||
b0.Style = UIStyle.Custom;
|
||||
button.SymbolHoverColor = button.ForeHoverColor = value;
|
||||
button.Style = UIStyle.Custom;
|
||||
}
|
||||
|
||||
btnSelect.SymbolHoverColor = btnSelect.ForeHoverColor = value;
|
||||
@ -1022,10 +1022,10 @@ namespace Sunny.UI
|
||||
get => b0.FillPressColor;
|
||||
set
|
||||
{
|
||||
foreach (var b0 in buttons.Values)
|
||||
foreach (var button in buttons.Values)
|
||||
{
|
||||
b0.RectPressColor = b0.FillPressColor = value;
|
||||
b0.Style = UIStyle.Custom;
|
||||
button.RectPressColor = button.FillPressColor = value;
|
||||
button.Style = UIStyle.Custom;
|
||||
}
|
||||
|
||||
btnSelect.RectPressColor = btnSelect.FillPressColor = value;
|
||||
@ -1040,10 +1040,10 @@ namespace Sunny.UI
|
||||
get => b0.ForePressColor;
|
||||
set
|
||||
{
|
||||
foreach (var b0 in buttons.Values)
|
||||
foreach (var button in buttons.Values)
|
||||
{
|
||||
b0.SymbolPressColor = b0.ForePressColor = value;
|
||||
b0.Style = UIStyle.Custom;
|
||||
button.SymbolPressColor = button.ForePressColor = value;
|
||||
button.Style = UIStyle.Custom;
|
||||
}
|
||||
|
||||
btnSelect.SymbolPressColor = btnSelect.ForePressColor = value;
|
||||
@ -1058,10 +1058,10 @@ namespace Sunny.UI
|
||||
get => b0.FillSelectedColor;
|
||||
set
|
||||
{
|
||||
foreach (var b0 in buttons.Values)
|
||||
foreach (var button in buttons.Values)
|
||||
{
|
||||
b0.RectSelectedColor = b0.FillSelectedColor = value;
|
||||
b0.Style = UIStyle.Custom;
|
||||
button.RectSelectedColor = button.FillSelectedColor = value;
|
||||
button.Style = UIStyle.Custom;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1077,9 +1077,9 @@ namespace Sunny.UI
|
||||
{
|
||||
if (value && b0 != null)
|
||||
{
|
||||
foreach (var b0 in buttons.Values)
|
||||
foreach (var button in buttons.Values)
|
||||
{
|
||||
b0.Style = UIStyle.Inherited;
|
||||
button.Style = UIStyle.Inherited;
|
||||
}
|
||||
|
||||
btnSelect.Style = UIStyle.Inherited;
|
||||
|
Loading…
x
Reference in New Issue
Block a user