* UITabControl: 修复不可关闭的主页被关闭了 #IC1XIU

This commit is contained in:
Sunny 2025-04-17 22:20:30 +08:00
parent c5e5a11188
commit 0b7f218b3c
2 changed files with 16 additions and 17 deletions

View File

@ -39,7 +39,7 @@
* 2023-11-16: V3.5.2
* 2024-04-13: V3.6.5
* 2024-05-17: V3.6.6
* 2025-04-17: V3.8.2
* 2025-04-17: V3.8.3
******************************************************************************/
using System;

View File

@ -38,6 +38,7 @@
* 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
******************************************************************************/
using System;
@ -819,7 +820,6 @@ namespace Sunny.UI
protected override void OnMouseDown(MouseEventArgs e)
{
base.OnMouseDown(e);
int removeIndex = -1;
for (int index = 0; index <= TabCount - 1; index++)
{
@ -838,12 +838,12 @@ namespace Sunny.UI
}
TabPage tabPage = TabPages[removeIndex];
if (tabPage.Text == MainPage) return;
UIPage uiPage = Helper.GetPage(tabPage);
bool show1 = tabPage.Text != MainPage;
bool show2 = uiPage == null || !uiPage.AlwaysOpen;
bool showButton = show1 && show2;
if (showButton)
{
if (uiPage == null) return;
if (uiPage.Text == MainPage) return;
if (uiPage.AlwaysOpen) return;
if (ShowCloseButton)
{
if (BeforeRemoveTabPage == null || BeforeRemoveTabPage.Invoke(this, removeIndex))
@ -862,7 +862,6 @@ namespace Sunny.UI
}
}
}
}
public delegate bool OnBeforeRemoveTabPage(object sender, int index);