* UIVerScrollBarEx: 增加了可设置垂直滚动条宽度的属性

This commit is contained in:
Sunny 2022-11-03 15:27:10 +08:00
parent 22b8c41584
commit 828cc082bc

View File

@ -16,8 +16,9 @@
* : V3.1 * : V3.1
* : 2020-08-29 * : 2020-08-29
* *
* 2020-08-29: V2.2.7 * 2020-08-29: V2.2.7
* 2022-03-19: V3.1.1 * 2022-03-19: V3.1.1
* 2022-11-03: V3.2.6
******************************************************************************/ ******************************************************************************/
using System; using System;
@ -44,6 +45,19 @@ namespace Sunny.UI
fillPressColor = UIStyles.Blue.ScrollBarFillPressColor; fillPressColor = UIStyles.Blue.ScrollBarFillPressColor;
} }
private int fillWidth = 6;
[DefaultValue(6)]
public int FillWidth
{
get => fillWidth;
set
{
fillWidth = Math.Max(6, value);
Invalidate();
}
}
private int maximum = 100; private int maximum = 100;
[DefaultValue(100)] [DefaultValue(100)]
public int Maximum public int Maximum
@ -117,7 +131,8 @@ namespace Sunny.UI
int height = BoundsHeight * (Height - 32) / Maximum; int height = BoundsHeight * (Height - 32) / Maximum;
g.SetHighQuality(); g.SetHighQuality();
g.FillRoundRectangle(clr, new Rectangle(Width / 2 - 3, top, 6, height), 5); int w = Math.Max(6, fillWidth);
g.FillRoundRectangle(clr, new Rectangle(Width / 2 - w / 2, top, w, height), 5);
g.SetDefaultQuality(); g.SetDefaultQuality();
} }