* UIEditForm:增加按钮事件

This commit is contained in:
Sunny 2020-07-13 23:55:14 +08:00
parent 72ab4b487e
commit c95d530a83
5 changed files with 29 additions and 6 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -55,6 +55,12 @@ namespace Sunny.UI
max = 0; max = 0;
} }
if ((max - min).IsZero())
{
max = 100;
min = 0;
}
UIChartHelper.CalcDegreeScale(min, max, o.YAxis.SplitNumber, UIChartHelper.CalcDegreeScale(min, max, o.YAxis.SplitNumber,
out int start, out int end, out double interval); out int start, out int end, out double interval);

View File

@ -36,6 +36,9 @@ namespace Sunny.UI
public bool IsOK { get; private set; } public bool IsOK { get; private set; }
public event EventHandler ButtonOkClick;
public event EventHandler ButtonCancelClick;
protected void btnOK_Click(object sender, EventArgs e) protected void btnOK_Click(object sender, EventArgs e)
{ {
if (!CheckData()) if (!CheckData())
@ -43,16 +46,30 @@ namespace Sunny.UI
return; return;
} }
DialogResult = DialogResult.OK; if (ButtonOkClick != null)
IsOK = true; {
Close(); ButtonOkClick.Invoke(sender,e);
}
else
{
DialogResult = DialogResult.OK;
IsOK = true;
Close();
}
} }
private void btnCancel_Click(object sender, EventArgs e) private void btnCancel_Click(object sender, EventArgs e)
{ {
DialogResult = DialogResult.Cancel; if (ButtonCancelClick != null)
IsOK = false; {
Close(); ButtonCancelClick.Invoke(sender,e);
}
else
{
DialogResult = DialogResult.Cancel;
IsOK = false;
Close();
}
} }
protected virtual bool CheckData() protected virtual bool CheckData()