* UIImageListBox: 增加了可设置垂直滚动条宽度的属性
* UIListBox: 增加了可设置垂直滚动条宽度的属性 * UITreeView: 增加了可设置垂直滚动条宽度的属性
This commit is contained in:
parent
828cc082bc
commit
1f11be45fd
@ -23,6 +23,7 @@
|
||||
* 2022-03-19: V3.1.1 重构主题配色
|
||||
* 2022-08-30: V3.2.3 增加了一些事件
|
||||
* 2022-09-05: V3.2.3 修复Click,DoubleClick事件
|
||||
* 2022-11-03: V3.2.6 增加了可设置垂直滚动条宽度的属性
|
||||
******************************************************************************/
|
||||
|
||||
using System;
|
||||
@ -78,6 +79,32 @@ namespace Sunny.UI
|
||||
listbox.DrawItem += Listbox_DrawItem;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
public event DrawItemEventHandler DrawItem;
|
||||
public new event EventHandler MouseLeave;
|
||||
public new event EventHandler MouseEnter;
|
||||
@ -199,9 +226,16 @@ namespace Sunny.UI
|
||||
protected override void OnSizeChanged(EventArgs e)
|
||||
{
|
||||
base.OnSizeChanged(e);
|
||||
SetScrollInfo();
|
||||
}
|
||||
|
||||
private void SetScrollInfo()
|
||||
{
|
||||
bar.Top = 2;
|
||||
bar.Height = Height - 4;
|
||||
bar.Left = Width - bar.Width - 2;
|
||||
int barWidth = Math.Max(ScrollBarInfo.VerticalScrollBarWidth(), ScrollBarWidth);
|
||||
bar.Width = barWidth + 1;
|
||||
bar.Left = Width - barWidth - 2;
|
||||
}
|
||||
|
||||
private void Listbox_BeforeDrawItem(object sender, ListBox.ObjectCollection items, DrawItemEventArgs e)
|
||||
|
@ -30,6 +30,7 @@
|
||||
* 2022-03-19: V3.1.1 重构主题配色
|
||||
* 2022-05-15: V3.1.8 增加滚动条颜色设置
|
||||
* 2022-09-05: V3.2.3 修复Click,DoubleClick事件
|
||||
* 2022-11-03: V3.2.6 增加了可设置垂直滚动条宽度的属性
|
||||
******************************************************************************/
|
||||
|
||||
using System;
|
||||
@ -96,6 +97,32 @@ namespace Sunny.UI
|
||||
timer.Start();
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
public new event MouseEventHandler MouseDoubleClick;
|
||||
|
||||
private void Listbox_MouseDoubleClick(object sender, MouseEventArgs e)
|
||||
@ -394,9 +421,16 @@ namespace Sunny.UI
|
||||
protected override void OnSizeChanged(EventArgs e)
|
||||
{
|
||||
base.OnSizeChanged(e);
|
||||
SetScrollInfo();
|
||||
}
|
||||
|
||||
private void SetScrollInfo()
|
||||
{
|
||||
bar.Top = 2;
|
||||
bar.Height = Height - 4;
|
||||
bar.Left = Width - bar.Width - 2;
|
||||
int barWidth = Math.Max(ScrollBarInfo.VerticalScrollBarWidth(), ScrollBarWidth);
|
||||
bar.Width = barWidth + 1;
|
||||
bar.Left = Width - barWidth - 2;
|
||||
}
|
||||
|
||||
private void Listbox_BeforeDrawItem(object sender, ObjectCollection items, DrawItemEventArgs e)
|
||||
|
@ -28,6 +28,7 @@
|
||||
* 2022-05-15: V3.1.8 修复了一个设计期显示错误
|
||||
* 2022-05-15: V3.1.8 增加了点击文字改变CheckBox状态的NodeClickChangeCheckBoxes
|
||||
* 2022-10-28: V3.2.6 TreeNode支持imagekey绑定图标
|
||||
* 2022-11-03: V3.2.6 增加了可设置垂直滚动条宽度的属性
|
||||
******************************************************************************/
|
||||
|
||||
using System;
|
||||
@ -87,6 +88,32 @@ namespace Sunny.UI
|
||||
view.AfterLabelEdit += View_AfterLabelEdit;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnContextMenuStripChanged(EventArgs e)
|
||||
{
|
||||
base.OnContextMenuStripChanged(e);
|
||||
@ -617,11 +644,13 @@ namespace Sunny.UI
|
||||
view.Width = Width - 4;
|
||||
view.Height = Height - 4;
|
||||
|
||||
int barWidth = Math.Max(ScrollBarInfo.VerticalScrollBarWidth(), ScrollBarWidth);
|
||||
|
||||
if (Bar != null)
|
||||
{
|
||||
Bar.Top = 2;
|
||||
Bar.Left = Width - ScrollBarInfo.VerticalScrollBarWidth() - 2;
|
||||
Bar.Width = ScrollBarInfo.VerticalScrollBarWidth();
|
||||
Bar.Left = Width - barWidth - 2;
|
||||
Bar.Width = barWidth;
|
||||
Bar.Height = Height - 4;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user