using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using DevExpress.XtraEditors; using System.IO; using SWGDBHelper; namespace SWGDBSysManager { public partial class frmAddValue : DevExpress.XtraEditors.XtraForm { Dictionary mpGBCodes; string mstrValue = ""; string mstrDescri = ""; string mstrStylePath = ""; public frmAddValue(Dictionary pGBCodes) { InitializeComponent(); mpGBCodes = pGBCodes; chB_DefaultStyle_CheckedChanged(null,null); } private void txtValue_EditValueChanged(object sender, EventArgs e) { string value = this.txtValue.Text.Trim(); if (mpGBCodes.ContainsKey(value)) this.txtDescri.Text = mpGBCodes[value]; } private void btnOk_Click(object sender, EventArgs e) { mstrValue = this.txtValue.Text.Trim(); mstrDescri = this.txtDescri.Text.Trim(); if (this.btnEdStyle.Text == "") { DevHelper.ShowInfo(this, "请选择符号库!"); return; } mstrStylePath = this.btnEdStyle.Text; this.DialogResult = DialogResult.OK; this.Close(); } private void btnCancel_Click(object sender, EventArgs e) { this.DialogResult = DialogResult.Cancel; this.Close(); } /// /// 符号化字段的值 /// public string FieldValue { get { return mstrValue; } } /// /// 字段值得描述 /// public string ValueDesci { get { return mstrDescri; } } /// /// 符号库路径 /// public string StylePath { get { return mstrStylePath; } } private void btnEdStyle_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { OpenFileDialog dlg = new OpenFileDialog(); //dlg.RestoreDirectory = true; dlg.InitialDirectory = Application.StartupPath + "\\Style\\"; dlg.CheckFileExists = true; dlg.Multiselect = false; dlg.ShowHelp = false; dlg.Filter = "符号库文件(*.style)|*.style"; if (dlg.ShowDialog() == DialogResult.OK) { this.btnEdStyle.Text = dlg.FileName; } } private void chB_DefaultStyle_CheckedChanged(object sender, EventArgs e) { btnEdStyle.Text = ""; if (chB_DefaultStyle.Checked) { if (File.Exists(Application.StartupPath + "\\Style\\DLGQ10K.style")) { btnEdStyle.Text = Application.StartupPath + "\\Style\\DLGQ10K.style"; } else { DevHelper.ShowWaring("缺失系统文件:" + Application.StartupPath + "\\Style\\DLGQ10K.style"); chB_DefaultStyle.Checked = false; } } btnEdStyle.Enabled = !chB_DefaultStyle.Checked; } } }