* UITabControl: 修改删除页面时的页面跳转

This commit is contained in:
Sunny 2022-01-13 22:50:35 +08:00
parent 4709f2be8e
commit ce29048f92
2 changed files with 10 additions and 6 deletions

Binary file not shown.

View File

@ -24,6 +24,7 @@
* 2021-07-14: V3.0.5 Tab在下方显示
* 2021-08-14: V3.0.6 DisposeTabPageAfterRemove标志TabPage后TabPage
* 2022-01-02: V3.0.9
* 2022-01-13: V3.1.0
******************************************************************************/
using Sunny.UI.Win32;
@ -62,6 +63,8 @@ namespace Sunny.UI
timer = new Timer();
timer.Interval = 500;
timer.Tick += Timer_Tick;
DisposeTabPageAfterRemove = true;
}
private ConcurrentDictionary<TabPage, string> TipsTexts = new ConcurrentDictionary<TabPage, string>();
@ -696,7 +699,7 @@ namespace Sunny.UI
get; set;
}
[DefaultValue(false)]
[DefaultValue(true)]
[Description("移除TabPage后是否自动销毁TabPage"), Category("SunnyUI")]
public bool DisposeTabPageAfterRemove
{
@ -723,14 +726,15 @@ namespace Sunny.UI
}
}
SelectedTab = TabPages[index > 0 ? index - 1 : 0];
TabPages.Remove(tabPage);
AfterRemoveTabPage?.Invoke(this, index);
if (TabCount > 0)
{
if (index == 0) SelectedIndex = 0;
if (index > 0) SelectedIndex = index - 1;
}
//if (TabCount > 0)
//{
// if (index == 0) SelectedIndex = 0;
// if (index > 0) SelectedIndex = index - 1;
//}
if (DisposeTabPageAfterRemove) tabPage.Dispose();
}