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

This commit is contained in:
Sunny 2022-11-03 19:50:41 +08:00
parent 94ad1bad69
commit 183fa9d420

View File

@ -29,6 +29,7 @@
* 2022-04-14: V3.1.3 * 2022-04-14: V3.1.3
* 2022-06-23: V3.2.0 SymbolOffset * 2022-06-23: V3.2.0 SymbolOffset
* 2022-08-19: V3.2.3 * 2022-08-19: V3.2.3
* 2022-11-03: V3.2.6
******************************************************************************/ ******************************************************************************/
using System; using System;
@ -689,7 +690,7 @@ namespace Sunny.UI
if (TreeNodeSymbols.ContainsKey(e.Node) && TreeNodeSymbols[e.Node].Count > 0) if (TreeNodeSymbols.ContainsKey(e.Node) && TreeNodeSymbols[e.Node].Count > 0)
{ {
int symbolRight = Width - (ScrollBarVisible ? Bar.Width : 0) - 3; int symbolRight = Width - (ScrollBarVisible ? ScrollBarInfo.VerticalScrollBarWidth() : 0) - 3;
if (e.Node.Nodes.Count > 0) symbolRight -= 32; if (e.Node.Nodes.Count > 0) symbolRight -= 32;
int firstLeft = symbolRight - TreeNodeSymbols[e.Node].Count * 32; int firstLeft = symbolRight - TreeNodeSymbols[e.Node].Count * 32;
@ -706,7 +707,7 @@ namespace Sunny.UI
if (TreeNodeSymbols.ContainsKey(e.Node) && TreeNodeSymbols[e.Node].Count > 0) if (TreeNodeSymbols.ContainsKey(e.Node) && TreeNodeSymbols[e.Node].Count > 0)
{ {
int symbolRight = Width - (ScrollBarVisible ? Bar.Width : 0) - 3; int symbolRight = Width - (ScrollBarVisible ? ScrollBarInfo.VerticalScrollBarWidth() : 0) - 3;
if (e.Node.Nodes.Count > 0) symbolRight -= 32; if (e.Node.Nodes.Count > 0) symbolRight -= 32;
int firstLeft = symbolRight - TreeNodeSymbols[e.Node].Count * 32; int firstLeft = symbolRight - TreeNodeSymbols[e.Node].Count * 32;
@ -746,17 +747,22 @@ namespace Sunny.UI
} }
} }
//显示右侧下拉箭头
if (ShowItemsArrow && e.Node.Nodes.Count > 0) if (ShowItemsArrow && e.Node.Nodes.Count > 0)
{ {
e.Graphics.DrawFontImage(e.Node.IsExpanded ? 61702 : 61703, 24, ForeColor, Width - (Bar.Visible ? 50 : 30), e.Bounds.Y + (ItemHeight - 24) / 2); int size = 24;
int left = Width - size - 6;
if (Bar.Visible) left -= Bar.Width;
e.Graphics.DrawFontImage(e.Node.IsExpanded ? 61702 : 61703, 24, ForeColor, left, e.Bounds.Y + (ItemHeight - 24) / 2);
} }
if (ShowTips && MenuHelper.GetTipsText(e.Node).IsValid() && TreeNodeSymbols.NotContainsKey(e.Node)) if (ShowTips && MenuHelper.GetTipsText(e.Node).IsValid() && TreeNodeSymbols.NotContainsKey(e.Node))
{ {
SizeF tipsSize = e.Graphics.MeasureString(MenuHelper.GetTipsText(e.Node), TempFont); SizeF tipsSize = e.Graphics.MeasureString(MenuHelper.GetTipsText(e.Node), TempFont);
float sfMax = Math.Max(tipsSize.Width, tipsSize.Height) + 1; float sfMax = Math.Max(tipsSize.Width, tipsSize.Height) + 1;
float tipsLeft = Width - (ScrollBarVisible ? Bar.Width : 0) - sfMax - sfMax; float tipsLeft = Width - sfMax - 16;
if (e.Node.Nodes.Count > 0) tipsLeft -= 24; if (e.Node.Nodes.Count > 0) tipsLeft -= 24;
if (Bar.Visible) tipsLeft -= Bar.Width;
float tipsTop = e.Bounds.Y + (ItemHeight - sfMax) / 2; float tipsTop = e.Bounds.Y + (ItemHeight - sfMax) / 2;
if (MenuHelper[e.Node] != null) if (MenuHelper[e.Node] != null)
@ -855,7 +861,7 @@ namespace Sunny.UI
if (e.Node != null && TreeNodeSymbols.ContainsKey(e.Node) && TreeNodeSymbols[e.Node].Count > 0) if (e.Node != null && TreeNodeSymbols.ContainsKey(e.Node) && TreeNodeSymbols[e.Node].Count > 0)
{ {
int symbolRight = Width - (ScrollBarVisible ? Bar.Width : 0) - 3; int symbolRight = Width - (ScrollBarVisible ? ScrollBarInfo.VerticalScrollBarWidth() : 0) - 3;
if (e.Node.Nodes.Count > 0) symbolRight -= 32; if (e.Node.Nodes.Count > 0) symbolRight -= 32;
int firstLeft = symbolRight - TreeNodeSymbols[e.Node].Count * 32; int firstLeft = symbolRight - TreeNodeSymbols[e.Node].Count * 32;
if (e.X >= firstLeft && e.X < symbolRight) if (e.X >= firstLeft && e.X < symbolRight)
@ -941,7 +947,7 @@ namespace Sunny.UI
Bar.Maximum = si.ScrollMax; Bar.Maximum = si.ScrollMax;
Bar.Visible = si.ScrollMax > 0 && si.nMax > 0 && si.nPage > 0; Bar.Visible = si.ScrollMax > 0 && si.nMax > 0 && si.nPage > 0;
Bar.Value = si.nPos; Bar.Value = si.nPos;
Bar.Width = barWidth + 1; Bar.Width = barWidth;
Bar.BringToFront(); Bar.BringToFront();
if (ScrollBarVisible != Bar.Visible) if (ScrollBarVisible != Bar.Visible)