* UIMainFrame: 修复了显示页面关闭按钮,移除最后一个页面出错的问题

This commit is contained in:
Sunny 2022-05-17 21:21:09 +08:00
parent 31c41746d2
commit db3eeb45f8
2 changed files with 3 additions and 1 deletions

View File

@ -296,6 +296,7 @@ namespace Sunny.UI
public static List<T> GetControls<T>(this Control ctrl, bool includeChild = false) where T : Control
{
List<T> values = new List<T>();
if (ctrl.IsNull()) return values;
foreach (Control obj in ctrl.Controls)
{

View File

@ -18,6 +18,7 @@
*
* 2020-05-05: V2.2.5
* 2021-08-17: V3.0.8 IFrame接口UIForm
* 2022-05-17: V3.1.9
******************************************************************************/
using System;
@ -89,7 +90,7 @@ namespace Sunny.UI
private void MainContainer_Selecting(object sender, TabControlCancelEventArgs e)
{
if (Selecting != null)
if (Selecting != null && e.TabPage != null)
{
List<UIPage> pages = e.TabPage.GetControls<UIPage>();
Selecting?.Invoke(this, e, pages.Count == 0 ? null : pages[0]);