修复右键Tabs关闭所有选项卡再次点击菜单显示空白

This commit is contained in:
czz_y 2025-01-21 08:59:43 +08:00
parent 8225018bfb
commit 638fca0e74
2 changed files with 5 additions and 5 deletions

View File

@ -29,7 +29,7 @@
private void InitializeComponent() private void InitializeComponent()
{ {
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainWindow)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainWindow));
AntdUI.Tabs.StyleCard styleCard2 = new AntdUI.Tabs.StyleCard(); AntdUI.Tabs.StyleCard styleCard1 = new AntdUI.Tabs.StyleCard();
this.titlebar = new AntdUI.PageHeader(); this.titlebar = new AntdUI.PageHeader();
this.input_search = new AntdUI.Input(); this.input_search = new AntdUI.Input();
this.dropdown_translate = new AntdUI.Dropdown(); this.dropdown_translate = new AntdUI.Dropdown();
@ -63,7 +63,7 @@
this.titlebar.Size = new System.Drawing.Size(1024, 40); this.titlebar.Size = new System.Drawing.Size(1024, 40);
this.titlebar.SubText = "Demo"; this.titlebar.SubText = "Demo";
this.titlebar.TabIndex = 0; this.titlebar.TabIndex = 0;
this.titlebar.Text = "AntdUI"; this.titlebar.Text = "AntdUI 1.8.4";
// //
// input_search // input_search
// //
@ -153,8 +153,8 @@
this.tabs.Name = "tabs"; this.tabs.Name = "tabs";
this.tabs.Pages.Add(this.tabPage); this.tabs.Pages.Add(this.tabPage);
this.tabs.Size = new System.Drawing.Size(954, 560); this.tabs.Size = new System.Drawing.Size(954, 560);
styleCard2.Closable = true; styleCard1.Closable = true;
this.tabs.Style = styleCard2; this.tabs.Style = styleCard1;
this.tabs.TabIndex = 9; this.tabs.TabIndex = 9;
this.tabs.Type = AntdUI.TabType.Card; this.tabs.Type = AntdUI.TabType.Card;
// //

View File

@ -90,6 +90,7 @@ namespace AntdUIDemo
{ {
if (item.Text == closeall) if (item.Text == closeall)
{ {
tabs.SelectedIndex = 0;
// 只清除从第二个页面开始的控件 // 只清除从第二个页面开始的控件
for (int i = 1; i < tabs.Pages.Count; i++) for (int i = 1; i < tabs.Pages.Count; i++)
{ {
@ -101,7 +102,6 @@ namespace AntdUIDemo
{ {
tabs.Pages.RemoveRange(1, tabs.Pages.Count - 1); // 从索引1开始移除后面的所有页面 tabs.Pages.RemoveRange(1, tabs.Pages.Count - 1); // 从索引1开始移除后面的所有页面
} }
tabs.SelectedIndex = 0;
} }
}, menulist); }, menulist);