💎 Add tab header right gap parameter

* Add tab header right gap parameter
This commit is contained in:
WenLin
2025-07-14 08:33:54 +00:00
committed by Tom
parent 05b585c283
commit 8d50a401b0
3 changed files with 28 additions and 1 deletions

View File

@@ -0,0 +1,7 @@
{
"profiles": {
"Demo": {
"commandName": "Project"
}
}
}

View File

@@ -27,6 +27,9 @@ namespace Demo
InitializeComponent();
tabHeader1.AddTab("关于", "SlackSquareFilled");
tabHeader1.AddTab(new AntdUI.TagTabItem("关于"));
//测试 右侧编剧
this.tabHeader1.RightGap = 130;
}
private void button1_Click(object sender, EventArgs e)

View File

@@ -278,6 +278,23 @@ namespace AntdUI
}
}
int rightGap = 0;
/// <summary>
/// 新增按钮边距比例
/// </summary>
[Description("新增按钮边距比例"), Category("外观"), DefaultValue(.148F)]
public int RightGap
{
get => rightGap;
set
{
if (rightGap == value) return;
rightGap = value;
LoadLayout();
OnPropertyChanged(nameof(RightGap));
}
}
#endregion
#region
@@ -338,7 +355,7 @@ namespace AntdUI
{
var dir = new Dictionary<int, int[]>(items.Count);
int txtHeight = g.MeasureString(Config.NullText, Font).Height, txtTW = 0, border = (int)(borderWidth * Config.Dpi), border2 = border * 2, offset = (int)(offsetY * Config.Dpi);
Rectangle crect = ClientRectangle.PaddingRect(Padding), rect = new Rectangle(crect.X, crect.Y + offset, crect.Width, crect.Height - offset);
Rectangle crect = ClientRectangle.PaddingRect(Padding), rect = new Rectangle(crect.X, crect.Y + offset, crect.Width - rightGap, crect.Height - offset);
if (showAdd) rect.Width -= rect.Height;
int paddx = (int)(txtHeight * tabGapRatio), paddx2 = paddx * 2, gap = (int)(txtHeight * tabIconGapRatio), gap2 = gap * 2,
ico_size = (int)(txtHeight * tabIconRatio), close_size = (int)(txtHeight * tabCloseRatio), close_i_size = (int)(txtHeight * TabCloseIconRatio),