using DevExpress.XtraEditors; namespace PBS.WinFrmUI.Hydro { public partial class SelectBackgroundImageCtrl : XtraUserControl { public SelectBackgroundImageCtrl() { InitializeComponent(); } /// /// 回调事件 /// public event EventHandler ApplyDataEvent; public event EventHandler ConfirmDataEvent; public event EventHandler CancleEvent; public string PicPath { get; set; } /// /// 底图X /// public float BackGroundImgX = 0; /// /// 底图Y /// public float BackGroundImgY = 0; /// /// 底图高度 /// public float BackGroundImgHeight = 0; /// /// 底图宽度 /// public float BackGroundImgWidth = 0; /// /// 底图旋转角度 /// 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); } } }