* UIButton: 渐变色增加方向选择
This commit is contained in:
parent
cc1e8dadcc
commit
442014fa11
@ -28,6 +28,7 @@
|
|||||||
* 2022-03-31: V3.1.2 是否显示浅色背景
|
* 2022-03-31: V3.1.2 是否显示浅色背景
|
||||||
* 2022-08-25: V3.2.3 增加同一个容器的相同GroupIndex的按钮控件的Selected单选
|
* 2022-08-25: V3.2.3 增加同一个容器的相同GroupIndex的按钮控件的Selected单选
|
||||||
* 2023-05-12: V3.3.6 重构DrawString函数
|
* 2023-05-12: V3.3.6 重构DrawString函数
|
||||||
|
* 2023-07-02: V3.3.9 渐变色增加方向选择
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
@ -230,7 +231,26 @@ namespace Sunny.UI
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LinearGradientBrush br = new LinearGradientBrush(new Point(0, 0), new Point(0, Height), FillColor, FillColor2);
|
LinearGradientBrush br;
|
||||||
|
switch (fillColorGradientDirection)
|
||||||
|
{
|
||||||
|
case FlowDirection.LeftToRight:
|
||||||
|
br = new LinearGradientBrush(new Point(0, 0), new Point(Width, y: 0), FillColor, FillColor2);
|
||||||
|
break;
|
||||||
|
case FlowDirection.TopDown:
|
||||||
|
br = new LinearGradientBrush(new Point(0, 0), new Point(0, Height), FillColor, FillColor2);
|
||||||
|
break;
|
||||||
|
case FlowDirection.RightToLeft:
|
||||||
|
br = new LinearGradientBrush(new Point(Width, 0), new Point(0, y: 0), FillColor, FillColor2);
|
||||||
|
break;
|
||||||
|
case FlowDirection.BottomUp:
|
||||||
|
br = new LinearGradientBrush(new Point(0, Height), new Point(0, 0), FillColor, FillColor2);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
br = new LinearGradientBrush(new Point(0, 0), new Point(0, Height), FillColor, FillColor2);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
br.GammaCorrection = true;
|
br.GammaCorrection = true;
|
||||||
g.FillPath(br, path);
|
g.FillPath(br, path);
|
||||||
br.Dispose();
|
br.Dispose();
|
||||||
@ -452,6 +472,23 @@ namespace Sunny.UI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private FlowDirection fillColorGradientDirection = FlowDirection.TopDown;
|
||||||
|
|
||||||
|
[Description("填充颜色渐变方向"), Category("SunnyUI")]
|
||||||
|
[DefaultValue(FlowDirection.TopDown)]
|
||||||
|
public FlowDirection FillColorGradientDirection
|
||||||
|
{
|
||||||
|
get => fillColorGradientDirection;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (fillColorGradientDirection != value)
|
||||||
|
{
|
||||||
|
fillColorGradientDirection = value;
|
||||||
|
Invalidate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 边框颜色
|
/// 边框颜色
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
* 2022-04-02: V3.1.1 增加用户控件基类
|
* 2022-04-02: V3.1.1 增加用户控件基类
|
||||||
* 2022-04-02: V3.1.2 默认设置AutoScaleMode为None
|
* 2022-04-02: V3.1.2 默认设置AutoScaleMode为None
|
||||||
* 2023-05-12: V3.3.6 重构DrawString函数
|
* 2023-05-12: V3.3.6 重构DrawString函数
|
||||||
|
* 2023-07-02: V3.3.9 渐变色增加方向选择
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
@ -535,7 +536,6 @@ namespace Sunny.UI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected virtual void OnPaintFill(Graphics g, GraphicsPath path)
|
protected virtual void OnPaintFill(Graphics g, GraphicsPath path)
|
||||||
{
|
{
|
||||||
Color color = GetFillColor();
|
Color color = GetFillColor();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user