Files
lserp_cs_6.0/插件库/Lskj.Main/Control/ResSelectForm.cs
T
2026-07-02 10:11:39 +00:00

84 lines
3.0 KiB
C#

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;
using Lskj.Business;
namespace Lskj.Main.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;
case "0.842":
this.BtnRes4.Enabled = false;
this.BtnRes4.Appearance.BackColor = Color.LightGray;
break;
}
this.BtnRes1.MouseClick += OnMouseClick;
this.BtnRes2.MouseClick += OnMouseClick;
this.BtnRes3.MouseClick += OnMouseClick;
this.BtnRes4.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();
string text = !string.IsNullOrWhiteSpace(SystemInfo.Instance.ResSwitchingPrompt) ? SystemInfo.Instance.ResSwitchingPrompt : "更改分辨率将退回至主界面\r\n是否继续?";
if (MessageUtil.Show(text, 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);
}
}
}
}