* UIRichTextBox: 增加了可设置垂直滚动条宽度的属性
* UITextBox: 增加了可设置垂直滚动条宽度的属性
This commit is contained in:
parent
9b7d27be4c
commit
04a1e69233
@ -21,6 +21,7 @@
|
||||
* 2021-07-29: V3.0.5 修改滚动条没有文字时自动隐藏
|
||||
* 2022-02-23: V3.1.1 增加了一些原生的属性和事件
|
||||
* 2022-03-14: V3.1.1 增加滚动条的颜色设置
|
||||
* 2022-11-03: V3.2.6 增加了可设置垂直滚动条宽度的属性
|
||||
******************************************************************************/
|
||||
|
||||
using System;
|
||||
@ -93,6 +94,32 @@ namespace Sunny.UI
|
||||
public new event MouseEventHandler MouseMove;
|
||||
public new event EventHandler MouseLeave;
|
||||
|
||||
private int scrollBarWidth = 0;
|
||||
|
||||
[DefaultValue(0), Category("SunnyUI"), Description("垂直滚动条宽度,最小为原生滚动条宽度")]
|
||||
public int ScrollBarWidth
|
||||
{
|
||||
get => scrollBarWidth;
|
||||
set
|
||||
{
|
||||
scrollBarWidth = value;
|
||||
SetScrollInfo();
|
||||
}
|
||||
}
|
||||
|
||||
private int scrollBarHandleWidth = 6;
|
||||
|
||||
[DefaultValue(6), Category("SunnyUI"), Description("垂直滚动条滑块宽度,最小为原生滚动条宽度")]
|
||||
public int ScrollBarHandleWidth
|
||||
{
|
||||
get => scrollBarHandleWidth;
|
||||
set
|
||||
{
|
||||
scrollBarHandleWidth = value;
|
||||
if (bar != null) bar.FillWidth = value;
|
||||
}
|
||||
}
|
||||
|
||||
private void Edit_MouseMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
MouseMove?.Invoke(this, e);
|
||||
@ -418,7 +445,8 @@ namespace Sunny.UI
|
||||
|
||||
public void SetScrollInfo()
|
||||
{
|
||||
bar.Width = ScrollBarInfo.VerticalScrollBarWidth() + 1;
|
||||
int barWidth = Math.Max(ScrollBarInfo.VerticalScrollBarWidth() + 1, ScrollBarWidth);
|
||||
bar.Width = barWidth;
|
||||
bar.Left = Width - bar.Width - 1;
|
||||
if (bar == null)
|
||||
{
|
||||
|
@ -40,6 +40,7 @@
|
||||
* 2022-09-05: V3.2.3 修复了无水印文字时,光标有时不显示的问题
|
||||
* 2022-09-16: V3.2.4 支持自定义右键菜单
|
||||
* 2022-09-16: V3.2.4 修改右侧Button可能不显示的问题
|
||||
* 2022-11-03: V3.2.6 增加了可设置垂直滚动条宽度的属性
|
||||
******************************************************************************/
|
||||
|
||||
using System;
|
||||
@ -128,6 +129,32 @@ namespace Sunny.UI
|
||||
TextAlignmentChange += UITextBox_TextAlignmentChange;
|
||||
}
|
||||
|
||||
private int scrollBarWidth = 0;
|
||||
|
||||
[DefaultValue(0), Category("SunnyUI"), Description("垂直滚动条宽度,最小为原生滚动条宽度")]
|
||||
public int ScrollBarWidth
|
||||
{
|
||||
get => scrollBarWidth;
|
||||
set
|
||||
{
|
||||
scrollBarWidth = value;
|
||||
SetScrollInfo();
|
||||
}
|
||||
}
|
||||
|
||||
private int scrollBarHandleWidth = 6;
|
||||
|
||||
[DefaultValue(6), Category("SunnyUI"), Description("垂直滚动条滑块宽度,最小为原生滚动条宽度")]
|
||||
public int ScrollBarHandleWidth
|
||||
{
|
||||
get => scrollBarHandleWidth;
|
||||
set
|
||||
{
|
||||
scrollBarHandleWidth = value;
|
||||
if (bar != null) bar.FillWidth = value;
|
||||
}
|
||||
}
|
||||
|
||||
private void Edit_SelectionChanged(object sender, UITextBoxSelectionArgs e)
|
||||
{
|
||||
SelectionChanged?.Invoke(this, e);
|
||||
@ -627,8 +654,9 @@ namespace Sunny.UI
|
||||
edit.Left = 1;
|
||||
edit.Width = Width - 2;
|
||||
|
||||
int barWidth = Math.Max(ScrollBarInfo.VerticalScrollBarWidth() + 1, ScrollBarWidth);
|
||||
bar.Top = 2;
|
||||
bar.Width = ScrollBarInfo.VerticalScrollBarWidth();
|
||||
bar.Width = barWidth;
|
||||
bar.Left = Width - bar.Width - 1;
|
||||
bar.Height = Height - 4;
|
||||
bar.BringToFront();
|
||||
|
Loading…
x
Reference in New Issue
Block a user