using System; using System.Collections.Generic; using System.ComponentModel; using System.Configuration; using System.Data; using System.Drawing; using System.Drawing.Drawing2D; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace 补片 { public partial class FrmSet : Form { public FrmSet() { InitializeComponent(); } private void FrmSet_Load(object sender, EventArgs e) { InitShow(); } void InitShow() { txtServerIP.Text = BuPianBll.ServerIP; txtMesIP.Text = BuPianBll.MesServerIP; txtMainName.Text = BuPianBll.MainName; txtVersion.Text = BuPianBll.Version; txtPosition.Text = BuPianBll.Position; } private void Button_MouseEnter(object sender, EventArgs e) { ((Control)sender).BackColor = Color.FromArgb(213, 234, 255); ((Control)sender).ForeColor = Color.FromArgb(92, 173, 254); } private void Button_MouseLeave(object sender, EventArgs e) { ((Control)sender).BackColor = Color.FromArgb(92, 173, 254); ((Control)sender).ForeColor = Color.FromArgb(213, 234, 255); } private void lblBtnSure_Click(object sender, EventArgs e) { if (UpdateSet()) { this.DialogResult = DialogResult.OK; }; } Configuration cfa = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); bool UpdateSet() { try { BuPianBll.ServerIP = cfa.AppSettings.Settings["ServerIP"].Value = txtServerIP.Text.Trim(); BuPianBll.MesServerIP = cfa.AppSettings.Settings["MesServerIP"].Value = txtMesIP.Text.Trim(); BuPianBll.MainName = cfa.AppSettings.Settings["MainName"].Value = txtMainName.Text.Trim(); BuPianBll.Version = cfa.AppSettings.Settings["Version"].Value = txtVersion.Text.Trim(); BuPianBll.Position = cfa.AppSettings.Settings["Position"].Value = txtPosition.Text.Trim(); cfa.Save(); return true; } catch (Exception ex) { return false; } } private void lblVerision_Click(object sender, EventArgs e) { } private void lblVerision_DoubleClick(object sender, EventArgs e) { txtVersion.ReadOnly = !txtVersion.ReadOnly; } private void btnCancel_Click(object sender, EventArgs e) { this.Close(); } } }