ningshuxia
2025-03-18 468de64c7b909ad0b08fa75d9bbde815887303ff
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
using DevExpress.XtraEditors;
 
namespace PBS.WinFrmUI.Hydro
{
    public partial class SelectBackgroundImageCtrl : XtraUserControl
    {
        public SelectBackgroundImageCtrl()
        {
            InitializeComponent();
        }
 
        /// <summary>
        /// 回调事件
        /// </summary>
        public event EventHandler<SelectBackgroundImageCtrl> ApplyDataEvent;
        public event EventHandler<SelectBackgroundImageCtrl> ConfirmDataEvent;
        public event EventHandler CancleEvent;
 
        public string PicPath { get; set; }
        /// <summary>
        /// 底图X
        /// </summary>
        public float BackGroundImgX = 0;
 
        /// <summary>
        /// 底图Y
        /// </summary>
        public float BackGroundImgY = 0;
        /// <summary>
        /// 底图高度
        /// </summary>
        public float BackGroundImgHeight = 0;
        /// <summary>
        /// 底图宽度
        /// </summary>
        public float BackGroundImgWidth = 0;
        /// <summary>
        /// 底图旋转角度
        /// </summary>
        public float BackGroundImgRotaAngle = 0;
 
        private void pictureEdit1_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();
            openFileDialog.Filter = "Image Files (*.bmp;*.jpg;*.jpeg;*.png;*.gif)|*.bmp;*.jpg;*.jpeg;*.png;*.gif";
            openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures);
 
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                PicPath = openFileDialog.FileName;
                pictureEdit1.Image = Image.FromFile(PicPath);
            }
        }
 
        private void simpleButton3_Click(object sender, EventArgs e)
        {
            this.BackGroundImgX = float.Parse(textEdit2.Text);
            this.BackGroundImgY = float.Parse(textEdit3.Text);
            this.BackGroundImgWidth = float.Parse(textEdit4.Text);
            this.BackGroundImgHeight = float.Parse(textEdit5.Text);
            this.ApplyDataEvent?.Invoke(null, this);
 
        }
 
        private void simpleButton2_Click(object sender, EventArgs e)
        {
            this.CancleEvent?.Invoke(null, null);
        }
 
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            this.BackGroundImgX = float.Parse(textEdit2.Text);
            this.BackGroundImgY = float.Parse(textEdit3.Text);
            this.BackGroundImgWidth = float.Parse(textEdit4.Text);
            this.BackGroundImgHeight = float.Parse(textEdit5.Text);
            this.ConfirmDataEvent?.Invoke(null, this);
        }
    }
}