From db3eeb45f8061c795978debb7b42379b7020e6f2 Mon Sep 17 00:00:00 2001 From: Sunny Date: Tue, 17 May 2022 21:21:09 +0800 Subject: [PATCH] =?UTF-8?q?*=20UIMainFrame:=20=E4=BF=AE=E5=A4=8D=E4=BA=86?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E9=A1=B5=E9=9D=A2=E5=85=B3=E9=97=AD=E6=8C=89?= =?UTF-8?q?=E9=92=AE=EF=BC=8C=E7=A7=BB=E9=99=A4=E6=9C=80=E5=90=8E=E4=B8=80?= =?UTF-8?q?=E4=B8=AA=E9=A1=B5=E9=9D=A2=E5=87=BA=E9=94=99=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SunnyUI/Common/UControl.cs | 1 + SunnyUI/Frames/UIMainFrame.cs | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/SunnyUI/Common/UControl.cs b/SunnyUI/Common/UControl.cs index 789b1a00..afc93176 100644 --- a/SunnyUI/Common/UControl.cs +++ b/SunnyUI/Common/UControl.cs @@ -296,6 +296,7 @@ namespace Sunny.UI public static List GetControls(this Control ctrl, bool includeChild = false) where T : Control { List values = new List(); + if (ctrl.IsNull()) return values; foreach (Control obj in ctrl.Controls) { diff --git a/SunnyUI/Frames/UIMainFrame.cs b/SunnyUI/Frames/UIMainFrame.cs index 84eeb7e2..dc0732b4 100644 --- a/SunnyUI/Frames/UIMainFrame.cs +++ b/SunnyUI/Frames/UIMainFrame.cs @@ -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 pages = e.TabPage.GetControls(); Selecting?.Invoke(this, e, pages.Count == 0 ? null : pages[0]);