Compare commits
No commits in common. "master" and "V3.8.3" have entirely different histories.
@ -50,7 +50,6 @@
|
||||
* 2024-06-19: V3.6.7 增加AddDateTimeColumn,解决默认时间列不显示秒数的问题
|
||||
* 2024-08-27: V3.7.0 增加属性AutoScrollToBottom,数据更新时是否自动滚动到最后一行
|
||||
* 2024-09-04: V3.7.0 解决有隐藏行时,滚动条滚动时出错的问题
|
||||
* 2025-04-21: V3.8.3 修复数据更新时是否自动滚动到最后一行
|
||||
******************************************************************************/
|
||||
|
||||
using System;
|
||||
@ -1097,7 +1096,7 @@ namespace Sunny.UI
|
||||
//选中最后一行
|
||||
this.Rows[this.RowCount - 1].Selected = true;
|
||||
//滚动到最后一行
|
||||
this.FirstDisplayedScrollingRowIndex = this.RowCount - 1;
|
||||
SetRowHeight(this.RowCount - 1);
|
||||
//如果需要滚动到底部(右侧),使用下面的代码
|
||||
//this.FirstDisplayedCell = this.Rows[this.RowCount - 1].Cells[this.Columns.Count - 1];
|
||||
}
|
||||
|
@ -39,7 +39,6 @@
|
||||
* 2023-11-16: V3.5.2 重构主题
|
||||
* 2024-04-13: V3.6.5 修复通过代码设置背景色无效的问题
|
||||
* 2024-05-17: V3.6.6 防止控件闪烁
|
||||
* 2025-04-17: V3.8.3 增加节点文字居中的属性
|
||||
******************************************************************************/
|
||||
|
||||
using System;
|
||||
@ -107,22 +106,6 @@ namespace Sunny.UI
|
||||
selectedHighColor = UIStyles.Blue.NavMenuMenuSelectedColor;
|
||||
}
|
||||
|
||||
private NodeTextAlign _nodeTextAlign = NodeTextAlign.Left;
|
||||
|
||||
[DefaultValue(NodeTextAlign.Left), Category("SunnyUI"), Description("节点文字显示位置")]
|
||||
public NodeTextAlign NodeTextAlign
|
||||
{
|
||||
get => _nodeTextAlign;
|
||||
set
|
||||
{
|
||||
if (_nodeTextAlign != value)
|
||||
{
|
||||
_nodeTextAlign = value;
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnHandleCreated(EventArgs e)
|
||||
{
|
||||
base.OnHandleCreated(e);
|
||||
@ -714,25 +697,13 @@ namespace Sunny.UI
|
||||
e.Graphics.FillRectangle(SelectedColor, new Rectangle(new Point(0, e.Node.Bounds.Y), new Size(Width, e.Node.Bounds.Height)));
|
||||
}
|
||||
|
||||
if (NodeTextAlign == NodeTextAlign.Left)
|
||||
e.Graphics.DrawString(e.Node.Text, Font, SelectedForeColor, new Rectangle(drawLeft, e.Bounds.Y, e.Bounds.Width - drawLeft, ItemHeight), ContentAlignment.MiddleLeft);
|
||||
if (NodeTextAlign == NodeTextAlign.TextAreaCenter)
|
||||
e.Graphics.DrawString(e.Node.Text, Font, SelectedForeColor, new Rectangle(drawLeft, e.Bounds.Y, e.Bounds.Width - drawLeft, ItemHeight), ContentAlignment.MiddleCenter);
|
||||
if (NodeTextAlign == NodeTextAlign.Center)
|
||||
e.Graphics.DrawString(e.Node.Text, Font, SelectedForeColor, new Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, ItemHeight), ContentAlignment.MiddleCenter);
|
||||
|
||||
e.Graphics.DrawString(e.Node.Text, Font, SelectedForeColor, new Rectangle(drawLeft, e.Bounds.Y, e.Bounds.Width - drawLeft, ItemHeight), ContentAlignment.MiddleLeft);
|
||||
e.Graphics.FillRectangle(SelectedHighColor, new Rectangle(0, e.Bounds.Y, 4, e.Bounds.Height));
|
||||
}
|
||||
else if (e.Node == CurrentNode && (e.State & TreeNodeStates.Hot) != 0)
|
||||
{
|
||||
e.Graphics.FillRectangle(HoverColor, new Rectangle(new Point(0, e.Node.Bounds.Y), new Size(Width, e.Node.Bounds.Height)));
|
||||
|
||||
if (NodeTextAlign == NodeTextAlign.Left)
|
||||
e.Graphics.DrawString(e.Node.Text, Font, ForeColor, new Rectangle(drawLeft, e.Bounds.Y, e.Bounds.Width - drawLeft, ItemHeight), ContentAlignment.MiddleLeft);
|
||||
if (NodeTextAlign == NodeTextAlign.TextAreaCenter)
|
||||
e.Graphics.DrawString(e.Node.Text, Font, ForeColor, new Rectangle(drawLeft, e.Bounds.Y, e.Bounds.Width - drawLeft, ItemHeight), ContentAlignment.MiddleCenter);
|
||||
if (NodeTextAlign == NodeTextAlign.Center)
|
||||
e.Graphics.DrawString(e.Node.Text, Font, ForeColor, new Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, ItemHeight), ContentAlignment.MiddleCenter);
|
||||
e.Graphics.DrawString(e.Node.Text, Font, ForeColor, new Rectangle(drawLeft, e.Bounds.Y, e.Bounds.Width - drawLeft, ItemHeight), ContentAlignment.MiddleLeft);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -743,13 +714,7 @@ namespace Sunny.UI
|
||||
}
|
||||
|
||||
e.Graphics.FillRectangle(color, new Rectangle(new Point(0, e.Node.Bounds.Y), new Size(Width, e.Node.Bounds.Height)));
|
||||
|
||||
if (NodeTextAlign == NodeTextAlign.Left)
|
||||
e.Graphics.DrawString(e.Node.Text, Font, ForeColor, new Rectangle(drawLeft, e.Bounds.Y, e.Bounds.Width - drawLeft, ItemHeight), ContentAlignment.MiddleLeft);
|
||||
if (NodeTextAlign == NodeTextAlign.TextAreaCenter)
|
||||
e.Graphics.DrawString(e.Node.Text, Font, ForeColor, new Rectangle(drawLeft, e.Bounds.Y, e.Bounds.Width - drawLeft, ItemHeight), ContentAlignment.MiddleCenter);
|
||||
if (NodeTextAlign == NodeTextAlign.Center)
|
||||
e.Graphics.DrawString(e.Node.Text, Font, ForeColor, new Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, ItemHeight), ContentAlignment.MiddleCenter);
|
||||
e.Graphics.DrawString(e.Node.Text, Font, ForeColor, new Rectangle(drawLeft, e.Bounds.Y, e.Bounds.Width - drawLeft, ItemHeight), ContentAlignment.MiddleLeft);
|
||||
}
|
||||
|
||||
//画右侧图标
|
||||
|
@ -205,13 +205,6 @@ namespace Sunny.UI
|
||||
}
|
||||
}
|
||||
|
||||
public enum NodeTextAlign
|
||||
{
|
||||
Left,
|
||||
Center,
|
||||
TextAreaCenter
|
||||
}
|
||||
|
||||
public class NavMenuItem : ISymbol
|
||||
{
|
||||
public string Text { get; set; }
|
||||
|
@ -38,8 +38,6 @@
|
||||
* 2024-12-12: V3.8.0 增加未选页签颜色 #IB7U69
|
||||
* 2025-02-07: V3.8.1 修复切换主题色时,TabPage 未设置背景色,#IBKDR7
|
||||
* 2025-02-13: V3.8.1 增加标签页分割线属性 ShowTabDivider,#IBLERL
|
||||
* 2025-04-17: V3.8.3 修复不可关闭的主页被关闭了 #IC1XIU
|
||||
* 2025-04-21: V3.8.3 更新部分注释
|
||||
******************************************************************************/
|
||||
|
||||
using System;
|
||||
@ -379,9 +377,9 @@ namespace Sunny.UI
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 标签页默认背景颜色
|
||||
/// 边框颜色
|
||||
/// </summary>
|
||||
[Description("标签页默认背景颜色"), Category("SunnyUI")]
|
||||
[Description("边框颜色"), Category("SunnyUI")]
|
||||
[DefaultValue(typeof(Color), "56, 56, 56")]
|
||||
public Color TabBackColor
|
||||
{
|
||||
@ -400,7 +398,7 @@ namespace Sunny.UI
|
||||
private Color tabSelectedColor = Color.FromArgb(36, 36, 36);
|
||||
|
||||
/// <summary>
|
||||
/// 选中Tab页背景色
|
||||
/// 边框颜色
|
||||
/// </summary>
|
||||
[Description("选中Tab页背景色"), Category("SunnyUI")]
|
||||
[DefaultValue(typeof(Color), "36, 36, 36")]
|
||||
@ -421,9 +419,9 @@ namespace Sunny.UI
|
||||
private Color tabUnSelectedColor = Color.FromArgb(56, 56, 56);
|
||||
|
||||
/// <summary>
|
||||
/// 未选中Tab页背景色
|
||||
/// 边框颜色
|
||||
/// </summary>
|
||||
[Description("未选中Tab页背景色"), Category("SunnyUI")]
|
||||
[Description("选中Tab页背景色"), Category("SunnyUI")]
|
||||
[DefaultValue(typeof(Color), "56, 56, 56")]
|
||||
public Color TabUnSelectedColor
|
||||
{
|
||||
@ -442,7 +440,7 @@ namespace Sunny.UI
|
||||
private Color tabSelectedForeColor = UIColor.Blue;
|
||||
|
||||
/// <summary>
|
||||
/// 选中Tab页字体色
|
||||
/// 边框颜色
|
||||
/// </summary>
|
||||
[Description("选中Tab页字体色"), Category("SunnyUI")]
|
||||
[DefaultValue(typeof(Color), "80, 160, 255")]
|
||||
@ -462,7 +460,7 @@ namespace Sunny.UI
|
||||
private Color tabUnSelectedForeColor = Color.FromArgb(240, 240, 240);
|
||||
|
||||
/// <summary>
|
||||
/// 未选中Tab页字体色
|
||||
/// 边框颜色
|
||||
/// </summary>
|
||||
[Description("未选中Tab页字体色"), Category("SunnyUI")]
|
||||
[DefaultValue(typeof(Color), "240, 240, 240")]
|
||||
@ -483,7 +481,7 @@ namespace Sunny.UI
|
||||
private Color tabSelectedHighColor = UIColor.Blue;
|
||||
|
||||
/// <summary>
|
||||
/// 选中Tab页高亮
|
||||
/// 边框颜色
|
||||
/// </summary>
|
||||
[Description("选中Tab页高亮"), Category("SunnyUI")]
|
||||
[DefaultValue(typeof(Color), "80, 160, 255")]
|
||||
@ -821,6 +819,7 @@ namespace Sunny.UI
|
||||
protected override void OnMouseDown(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseDown(e);
|
||||
|
||||
int removeIndex = -1;
|
||||
for (int index = 0; index <= TabCount - 1; index++)
|
||||
{
|
||||
@ -839,28 +838,29 @@ namespace Sunny.UI
|
||||
}
|
||||
|
||||
TabPage tabPage = TabPages[removeIndex];
|
||||
if (tabPage.Text == MainPage) return;
|
||||
UIPage uiPage = Helper.GetPage(tabPage);
|
||||
if (uiPage == null) return;
|
||||
if (uiPage.Text == MainPage) return;
|
||||
if (uiPage.AlwaysOpen) return;
|
||||
|
||||
if (ShowCloseButton)
|
||||
bool show1 = tabPage.Text != MainPage;
|
||||
bool show2 = uiPage == null || !uiPage.AlwaysOpen;
|
||||
bool showButton = show1 && show2;
|
||||
if (showButton)
|
||||
{
|
||||
if (BeforeRemoveTabPage == null || BeforeRemoveTabPage.Invoke(this, removeIndex))
|
||||
{
|
||||
RemoveTabPage(removeIndex);
|
||||
}
|
||||
}
|
||||
else if (ShowActiveCloseButton && removeIndex == SelectedIndex)
|
||||
{
|
||||
if (DrawedIndex == removeIndex)
|
||||
if (ShowCloseButton)
|
||||
{
|
||||
if (BeforeRemoveTabPage == null || BeforeRemoveTabPage.Invoke(this, removeIndex))
|
||||
{
|
||||
RemoveTabPage(removeIndex);
|
||||
}
|
||||
}
|
||||
else if (ShowActiveCloseButton && removeIndex == SelectedIndex)
|
||||
{
|
||||
if (DrawedIndex == removeIndex)
|
||||
{
|
||||
if (BeforeRemoveTabPage == null || BeforeRemoveTabPage.Invoke(this, removeIndex))
|
||||
{
|
||||
RemoveTabPage(removeIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user