Shuxia Ning
2024-08-12 d2cee56db11f0ee475e9f9dbdc8bfd03ad982e18
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
51
52
53
using System;
using System.Windows.Forms;
 
namespace AStation.WinFrmUI.Chart
{
    public partial class InputXYDialog : DevExpress.XtraEditors.XtraForm
    {
        public InputXYDialog()
        {
            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();
        }
    }
}