using DevExpress.XtraEditors;
|
|
namespace Yw.WinFrmUI.Phart
|
{
|
public partial class UniversalAxisValueDlg : DevExpress.XtraEditors.XtraForm
|
{
|
public UniversalAxisValueDlg()
|
{
|
InitializeComponent();
|
}
|
|
public event Func<double, bool> VerifyValueChanged;
|
|
public void SetBindingData(double? value = null)
|
{
|
this.btnEditValue.EditValue = value;
|
}
|
|
private bool Verify()
|
{
|
this.dxErrorProvider1.ClearErrors();
|
if (this.btnEditValue.EditValue == null)
|
{
|
this.dxErrorProvider1.SetError(this.btnEditValue, "必填项");
|
return false;
|
}
|
|
return true;
|
}
|
|
private void btnEditValue_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
|
{
|
if (!Verify())
|
return;
|
if (VerifyValueChanged == null)
|
return;
|
var value = Convert.ToDouble(this.btnEditValue.Text);
|
var bol = this.VerifyValueChanged(value);
|
if (!bol)
|
{
|
XtraMessageBox.Show("数值不合理!");
|
return;
|
}
|
this.DialogResult = DialogResult.OK;
|
this.Close();
|
}
|
|
|
}
|
}
|