mirror of
https://gitee.com/AntdUI/AntdUI.git
synced 2026-04-01 19:20:40 +08:00
💎 Add tab header right gap parameter
* Add tab header right gap parameter
This commit is contained in:
7
example/Demo/Properties/launchSettings.json
Normal file
7
example/Demo/Properties/launchSettings.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"profiles": {
|
||||
"Demo": {
|
||||
"commandName": "Project"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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)
|
||||
|
||||
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user