From 866af62b33f8ce8eb24b80771e0964ebec147317 Mon Sep 17 00:00:00 2001 From: Sunny Date: Mon, 18 Apr 2022 16:04:30 +0800 Subject: [PATCH] =?UTF-8?q?*=20UIEditForm:=20=E4=BF=AE=E6=94=B9=E4=B8=80?= =?UTF-8?q?=E5=A4=84Show=E5=BC=95=E8=B5=B7=E7=9A=84=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E6=8E=A7=E4=BB=B6=E5=80=BC=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/Forms/UIEditForm.cs | 23 ++++++++++++++++------- SunnyUI/Forms/UIInputForm.cs | 3 +-- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/SunnyUI/Forms/UIEditForm.cs b/SunnyUI/Forms/UIEditForm.cs index f040c3e8..2e9fa153 100644 --- a/SunnyUI/Forms/UIEditForm.cs +++ b/SunnyUI/Forms/UIEditForm.cs @@ -21,6 +21,7 @@ * 2021-05-19: V3.0.3 动态生成表单,增加校验方法 * 2021-10-26: V3.0.8 代码生成增加ComboTreeView类型 * 2021-10-28: V3.0.8 代码生成增加ComboCheckedListBox类型 + * 2022-04-18: V3.1.5 修改一处Show引起的无法获取控件值的问题 ******************************************************************************/ using System; @@ -294,31 +295,39 @@ namespace Sunny.UI set => btnCancel.Enabled = value; } - protected void btnOK_Click(object sender, EventArgs e) + private void btnOK_Click(object sender, EventArgs e) { if (!CheckData()) { return; } + else + { + DialogResult = DialogResult.OK; + IsOK = true; + } if (CheckedData != null) { if (!CheckedData.Invoke(this, new EditFormEventArgs(this))) { + DialogResult = DialogResult.None; + IsOK = false; return; } + else + { + DialogResult = DialogResult.OK; + IsOK = true; + } } if (ButtonOkClick != null) { + DialogResult = DialogResult.None; + IsOK = false; ButtonOkClick.Invoke(sender, e); } - else - { - DialogResult = DialogResult.OK; - IsOK = true; - Close(); - } } private void btnCancel_Click(object sender, EventArgs e) diff --git a/SunnyUI/Forms/UIInputForm.cs b/SunnyUI/Forms/UIInputForm.cs index d24e47cd..07ebac89 100644 --- a/SunnyUI/Forms/UIInputForm.cs +++ b/SunnyUI/Forms/UIInputForm.cs @@ -60,8 +60,7 @@ namespace Sunny.UI protected override void DoEnter() { if (btnCancel.Focused || btnOK.Focused) return; - - btnOK_Click(null, null); + btnOK.PerformClick(); } private void UIInputForm_Shown(object sender, System.EventArgs e)