Shuxia Ning
2024-12-19 b0c978129ba55cf81e8470b6c9326745a5dbc7d1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
namespace Yw.WinFrmUI.Phart
{
    public partial class InputXYDlg : DevExpress.XtraEditors.XtraForm
    {
        public InputXYDlg()
        {
            InitializeComponent();
        }
 
        public void SetLabelX(string caption)
        {
            this.itemX.Text = caption;
        }
 
        public void SetLabelY(string caption)
        {
            this.itemY.Text = caption;
        }
 
        public double Y = 0, X = 0;
        private bool Valid()
        {
            this.dxErrorProvider1.ClearErrors();
            if (string.IsNullOrEmpty(this.txtX.Text))
            {
                this.dxErrorProvider1.SetError(this.txtX, "必填项");
                return false;
            }
            if (string.IsNullOrEmpty(this.txtY.Text))
            {
                this.dxErrorProvider1.SetError(this.txtY, "必填项");
                return false;
            }
            return true;
        }
 
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (!Valid())
                return;
 
            X = Convert.ToDouble(this.txtX.Text.Trim());
            Y = Convert.ToDouble(this.txtY.Text.Trim());
 
 
            DialogResult = DialogResult.OK;
            this.Close();
        }
    }
}