using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using Lskj.Control; using Lskj.Business.Impl; using Lskj.Util; namespace Lskj.Main3.Control { public partial class ResSelectForm : UserControl { public ResSelectForm() { InitializeComponent(); } private MouseClickEventHanlder _clickEvent = null; public delegate void MouseClickEventHanlder(object sender, EventArgs e); private void OnResSelectForm_Load(object sender, EventArgs e) { switch (Lskj.Control.Model.AutoSizeChange.value.ToString()) { case "1": this.BtnRes1.Enabled = false; this.BtnRes1.Appearance.BackColor = Color.LightGray; break; case "0.948": this.BtnRes2.Enabled = false; this.BtnRes2.Appearance.BackColor = Color.LightGray; break; case "0.894": this.BtnRes3.Enabled = false; this.BtnRes3.Appearance.BackColor = Color.LightGray; break; } this.BtnRes1.MouseClick += OnMouseClick; this.BtnRes2.MouseClick += OnMouseClick; this.BtnRes3.MouseClick += OnMouseClick; } public void SetClickEvent(MouseClickEventHanlder clickEvent) { try { this._clickEvent = clickEvent; } catch (Exception ex) { string Message = ErrorMessage.PromptErrorMessage(ex); MessageUtil.Show(Message,ex.Message); } } private void OnMouseClick(object sender, MouseEventArgs e) { try { DevExpress.XtraEditors.SimpleButton btn = (DevExpress.XtraEditors.SimpleButton)sender; this.Hide(); if (MessageUtil.Show("更改分辨率将退回至主界面\r\n是否继续?", MessageBoxButtons.YesNo) == DialogResult.Yes) { Lskj.Control.Model.AutoSizeChange.value = Convert.ToDouble(btn.Tag); IniHelper.Write(string.Format("DefaultControlScaling_{0}", "Save"), btn.Tag.ToString()); _clickEvent(this, e); } } catch (Exception ex) { string Message = ErrorMessage.PromptErrorMessage(ex); MessageUtil.Show(Message,ex.Message); } } } }