* UIEditForm: 修改一处Show引起的无法获取控件值的问题

This commit is contained in:
Sunny 2022-04-18 16:04:30 +08:00
parent 74a493a00f
commit 866af62b33
2 changed files with 17 additions and 9 deletions

View File

@ -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)

View File

@ -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)