* UIHeaderButton: 增加Disabled颜色
This commit is contained in:
parent
cab9dfc02a
commit
8f3b1bccbb
Binary file not shown.
Binary file not shown.
@ -14,26 +14,26 @@ namespace Sunny.UI.Demo
|
||||
Header.SetNodeSymbol(Header.Nodes[0], 61451);
|
||||
TreeNode parent = Aside.CreateNode("控件", 61451, 24, pageIndex);
|
||||
//通过设置PageIndex关联,节点文字、图标由相应的Page的Text、Symbol提供
|
||||
Aside.CreateChildNode(parent, AddPage(new FAvatar(), ++pageIndex));
|
||||
Aside.CreateChildNode(parent, AddPage(new FButton(), ++pageIndex));
|
||||
Aside.CreateChildNode(parent, AddPage(new FCheckBox(), ++pageIndex));
|
||||
Aside.CreateChildNode(parent, AddPage(new FCombobox(), ++pageIndex));
|
||||
Aside.CreateChildNode(parent, AddPage(new FContextMenuStrip(), ++pageIndex));
|
||||
Aside.CreateChildNode(parent, AddPage(new FDataGridView(), ++pageIndex));
|
||||
Aside.CreateChildNode(parent, AddPage(new FFlowLayoutPanel(), ++pageIndex));
|
||||
Aside.CreateChildNode(parent, AddPage(new FHeaderButton(), ++pageIndex));
|
||||
Aside.CreateChildNode(parent, AddPage(new FLabel(), ++pageIndex));
|
||||
Aside.CreateChildNode(parent, AddPage(new FCheckBox(), ++pageIndex));
|
||||
Aside.CreateChildNode(parent, AddPage(new FRadioButton(), ++pageIndex));
|
||||
Aside.CreateChildNode(parent, AddPage(new FTextBox(), ++pageIndex));
|
||||
Aside.CreateChildNode(parent, AddPage(new FCombobox(), ++pageIndex));
|
||||
Aside.CreateChildNode(parent, AddPage(new FDataGridView(), ++pageIndex));
|
||||
Aside.CreateChildNode(parent, AddPage(new FListBox(), ++pageIndex));
|
||||
Aside.CreateChildNode(parent, AddPage(new FTreeView(), ++pageIndex));
|
||||
Aside.CreateChildNode(parent, AddPage(new FNavigation(), ++pageIndex));
|
||||
Aside.CreateChildNode(parent, AddPage(new FTabControl(), ++pageIndex));
|
||||
Aside.CreateChildNode(parent, AddPage(new FLine(), ++pageIndex));
|
||||
Aside.CreateChildNode(parent, AddPage(new FListBox(), ++pageIndex));
|
||||
Aside.CreateChildNode(parent, AddPage(new FNavigation(), ++pageIndex));
|
||||
Aside.CreateChildNode(parent, AddPage(new FPanel(), ++pageIndex));
|
||||
Aside.CreateChildNode(parent, AddPage(new FFlowLayoutPanel(), ++pageIndex));
|
||||
Aside.CreateChildNode(parent, AddPage(new FTransfer(), ++pageIndex));
|
||||
Aside.CreateChildNode(parent, AddPage(new FAvatar(), ++pageIndex));
|
||||
Aside.CreateChildNode(parent, AddPage(new FContextMenuStrip(), ++pageIndex));
|
||||
Aside.CreateChildNode(parent, AddPage(new FProcess(), ++pageIndex));
|
||||
Aside.CreateChildNode(parent, AddPage(new FRadioButton(), ++pageIndex));
|
||||
Aside.CreateChildNode(parent, AddPage(new FScrollBar(), ++pageIndex));
|
||||
Aside.CreateChildNode(parent, AddPage(new FTabControl(), ++pageIndex));
|
||||
Aside.CreateChildNode(parent, AddPage(new FTextBox(), ++pageIndex));
|
||||
Aside.CreateChildNode(parent, AddPage(new FTransfer(), ++pageIndex));
|
||||
Aside.CreateChildNode(parent, AddPage(new FTreeView(), ++pageIndex));
|
||||
Aside.CreateChildNode(parent, AddPage(new FOther(), ++pageIndex));
|
||||
//示例设置某个节点的小红点提示
|
||||
Aside.ShowTips = true;
|
||||
@ -81,7 +81,7 @@ namespace Sunny.UI.Demo
|
||||
AddPage(new FColorful());
|
||||
|
||||
//选中第一个节点
|
||||
Aside.SelectFirst();
|
||||
Aside.SelectPage(1002);
|
||||
}
|
||||
|
||||
private void Header_MenuItemClick(string text, int menuIndex, int pageIndex)
|
||||
|
@ -20,6 +20,7 @@
|
||||
* 2021-03-27: V3.0.2 增加字体图标背景时鼠标移上背景色
|
||||
* 2021-06-01: V3.0.4 增加图片与文字的位置
|
||||
* 2021-06-22: V3.0.4 增加ShowSelected,是否显示选中状态
|
||||
* 2021-09-21: V3.0.7 增加Disabled颜色
|
||||
******************************************************************************/
|
||||
|
||||
using System;
|
||||
@ -51,10 +52,16 @@ namespace Sunny.UI
|
||||
foreHoverColor = UIStyles.GetStyleColor(UIStyle.Blue).ButtonForeHoverColor;
|
||||
forePressColor = UIStyles.GetStyleColor(UIStyle.Blue).ButtonForePressColor;
|
||||
foreSelectedColor = UIStyles.GetStyleColor(UIStyle.Blue).ButtonForeSelectedColor;
|
||||
|
||||
fillHoverColor = UIStyles.GetStyleColor(UIStyle.Blue).ButtonFillHoverColor;
|
||||
fillPressColor = UIStyles.GetStyleColor(UIStyle.Blue).ButtonFillPressColor;
|
||||
fillSelectedColor = UIStyles.GetStyleColor(UIStyle.Blue).ButtonFillSelectedColor;
|
||||
|
||||
SetStyle(ControlStyles.StandardDoubleClick, UseDoubleClick);
|
||||
|
||||
fillDisableColor = fillColor;
|
||||
foreDisableColor = foreColor;
|
||||
rectDisableColor = UIStyles.GetStyleColor(UIStyle.Blue).RectDisableColor;
|
||||
}
|
||||
|
||||
private bool isClick;
|
||||
@ -141,9 +148,21 @@ namespace Sunny.UI
|
||||
fillSelectedColor = uiColor.ButtonFillSelectedColor;
|
||||
foreSelectedColor = uiColor.ButtonForeSelectedColor;
|
||||
|
||||
rectDisableColor = uiColor.RectDisableColor;
|
||||
fillDisableColor = fillColor;
|
||||
foreDisableColor = foreColor;
|
||||
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
[Description("不可用颜色"), Category("SunnyUI")]
|
||||
[DefaultValue(typeof(Color), "173, 178, 181")]
|
||||
public Color CircleDisabledColor
|
||||
{
|
||||
get => rectDisableColor;
|
||||
set => SetRectDisableColor(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 填充颜色,当值为背景色或透明色或空值则不填充
|
||||
/// </summary>
|
||||
@ -155,6 +174,14 @@ namespace Sunny.UI
|
||||
set => SetFillColor(value);
|
||||
}
|
||||
|
||||
[Description("填充颜色"), Category("SunnyUI")]
|
||||
[DefaultValue(typeof(Color), "80, 160, 255")]
|
||||
public Color FillDisableColor
|
||||
{
|
||||
get => fillDisableColor;
|
||||
set => SetFillDisableColor(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 字体颜色
|
||||
/// </summary>
|
||||
@ -166,15 +193,7 @@ namespace Sunny.UI
|
||||
set => SetForeColor(value);
|
||||
}
|
||||
|
||||
[DefaultValue(typeof(Color), "244, 244, 244"), Category("SunnyUI")]
|
||||
[Description("不可用时填充颜色")]
|
||||
public Color FillDisableColor
|
||||
{
|
||||
get => fillDisableColor;
|
||||
set => SetFillDisableColor(value);
|
||||
}
|
||||
|
||||
[DefaultValue(typeof(Color), "109, 109, 103"), Category("SunnyUI")]
|
||||
[DefaultValue(typeof(Color), "White"), Category("SunnyUI")]
|
||||
[Description("不可用时字体颜色")]
|
||||
public Color ForeDisableColor
|
||||
{
|
||||
@ -457,6 +476,7 @@ namespace Sunny.UI
|
||||
if (Symbol > 0 && Image == null)
|
||||
{
|
||||
Color bcColor = CircleColor;
|
||||
if (!Enabled) bcColor = CircleDisabledColor;
|
||||
if (ShowCircleHoverColor && IsHover)
|
||||
{
|
||||
bcColor = CircleHoverColor;
|
||||
@ -484,6 +504,7 @@ namespace Sunny.UI
|
||||
if (Symbol > 0 && Image == null)
|
||||
{
|
||||
Color bcColor = CircleColor;
|
||||
if (!Enabled) bcColor = CircleDisabledColor;
|
||||
if (ShowCircleHoverColor && IsHover)
|
||||
{
|
||||
bcColor = CircleHoverColor;
|
||||
@ -515,6 +536,7 @@ namespace Sunny.UI
|
||||
if (Symbol > 0 && Image == null)
|
||||
{
|
||||
Color bcColor = CircleColor;
|
||||
if (!Enabled) bcColor = CircleDisabledColor;
|
||||
if (ShowCircleHoverColor && IsHover)
|
||||
{
|
||||
bcColor = CircleHoverColor;
|
||||
@ -542,6 +564,7 @@ namespace Sunny.UI
|
||||
if (Symbol > 0 && Image == null)
|
||||
{
|
||||
Color bcColor = CircleColor;
|
||||
if (!Enabled) bcColor = CircleDisabledColor;
|
||||
if (ShowCircleHoverColor && IsHover)
|
||||
{
|
||||
bcColor = CircleHoverColor;
|
||||
|
@ -196,11 +196,10 @@ namespace Sunny.UI
|
||||
rectColor = uiColor.SwitchActiveColor;
|
||||
fillColor = uiColor.SwitchFillColor;
|
||||
inActiveColor = uiColor.SwitchInActiveColor;
|
||||
disabledColor = uiColor.RectDisableColor;
|
||||
rectDisableColor = uiColor.RectDisableColor;
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
private Color disabledColor;
|
||||
[Description("不可用颜色"), Category("SunnyUI")]
|
||||
[DefaultValue(typeof(Color), "173, 178, 181")]
|
||||
public Color DisabledColor
|
||||
@ -218,7 +217,7 @@ namespace Sunny.UI
|
||||
protected override void OnPaintFill(Graphics g, GraphicsPath path)
|
||||
{
|
||||
Color color = Active ? ActiveColor : InActiveColor;
|
||||
if (!Enabled) color = disabledColor;
|
||||
if (!Enabled) color = rectDisableColor;
|
||||
|
||||
if (SwitchShape == UISwitchShape.Round)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user