From c328bb7f02770dca3aa8a1b1e46065421b20a923 Mon Sep 17 00:00:00 2001 From: Sunny Date: Sat, 10 Aug 2024 20:47:20 +0800 Subject: [PATCH] =?UTF-8?q?*=20=E5=BC=B9=E7=AA=97=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E7=BA=BF=E7=A8=8B=E5=AE=89=E5=85=A8=E8=B0=83=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SunnyUI/Controls/UITreeView.cs | 2 +- SunnyUI/Forms/UIFormHelper.cs | 44 ++++++++++++++++++++++++++-------- 2 files changed, 35 insertions(+), 11 deletions(-) diff --git a/SunnyUI/Controls/UITreeView.cs b/SunnyUI/Controls/UITreeView.cs index 5552b7ab..ff4bb0e3 100644 --- a/SunnyUI/Controls/UITreeView.cs +++ b/SunnyUI/Controls/UITreeView.cs @@ -1346,7 +1346,7 @@ namespace Sunny.UI //绘制左侧+号 if (ShowPlusMinus && e.Node.Nodes.Count > 0) { - if (ShowLines) + if (ShowLinesEx) { e.Graphics.FillRectangle(Color.White, new Rectangle(lineX - 4, lineY - 4, 8, 8)); e.Graphics.DrawRectangle(UIFontColor.Primary, new Rectangle(lineX - 4, lineY - 4, 8, 8)); diff --git a/SunnyUI/Forms/UIFormHelper.cs b/SunnyUI/Forms/UIFormHelper.cs index 951dce7c..87fa2180 100644 --- a/SunnyUI/Forms/UIFormHelper.cs +++ b/SunnyUI/Forms/UIFormHelper.cs @@ -169,12 +169,25 @@ namespace Sunny.UI public static bool ShowMessageDialog(Form owner, string message, string title, bool showCancel, UIStyle style, bool showMask = false, UIMessageDialogButtons defaultButton = UIMessageDialogButtons.Ok, int delay = 0) { - using UIMessageForm frm = new UIMessageForm(); - frm.ShowMessage(message, title, showCancel, style); - frm.DefaultButton = showCancel ? defaultButton : UIMessageDialogButtons.Ok; - frm.Delay = delay; - - return frm.ShowForm(owner, showMask || owner == null, showMask); + if (owner == null) + { + using UIMessageForm frm = new UIMessageForm(); + frm.ShowMessage(message, title, showCancel, style); + frm.DefaultButton = showCancel ? defaultButton : UIMessageDialogButtons.Ok; + frm.Delay = delay; + return frm.ShowForm(owner, showMask || owner == null, showMask); + } + else + { + return owner.ThreadSafeCall(() => + { + using UIMessageForm frm = new UIMessageForm(); + frm.ShowMessage(message, title, showCancel, style); + frm.DefaultButton = showCancel ? defaultButton : UIMessageDialogButtons.Ok; + frm.Delay = delay; + return frm.ShowForm(owner, showMask || owner == null, showMask); + }); + } } /// @@ -188,10 +201,21 @@ namespace Sunny.UI /// 结果 public static bool ShowMessageDialog2(Form owner, string title, string message, UINotifierType noteType, bool showMask = false, UIMessageDialogButtons defaultButton = UIMessageDialogButtons.Cancel, int delay = 0) { - using UIMessageForm2 frm = new UIMessageForm2(title, message, noteType, defaultButton); - frm.Delay = delay; - - return frm.ShowForm(owner, showMask || owner == null, showMask); + if (owner == null) + { + using UIMessageForm2 frm = new UIMessageForm2(title, message, noteType, defaultButton); + frm.Delay = delay; + return frm.ShowForm(owner, showMask || owner == null, showMask); + } + else + { + return owner.ThreadSafeCall(() => + { + using UIMessageForm2 frm = new UIMessageForm2(title, message, noteType, defaultButton); + frm.Delay = delay; + return frm.ShowForm(owner, showMask || owner == null, showMask); + }); + } } internal static bool ShowForm(this UIForm frm, Form owner, bool screenCenter, bool showMask)