using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; namespace Stone.Common { /// /// 文件名:frmBarcodePrintSet.cs /// 作 用:Label Matrix 安装路径设置 /// 作 者:刘洪辉 /// 日 期:2007-3-6 /// 版本修订:2007-12-24 /// 版本修订:2008-06-14 /// 版本修订:2010-12-04(为武汉WMS条形码系统修改) /// public class frmBarcodePrintSet : System.Windows.Forms.Form { #region 系统参数设置 private System.Windows.Forms.Label label1; private System.Windows.Forms.TextBox t_Lmw32Path; private System.Windows.Forms.Button b_Save; private System.Windows.Forms.Button b_Close; private System.Windows.Forms.Button b_Browse; private System.Windows.Forms.FolderBrowserDialog folderBrowserDialog1; private System.ComponentModel.Container components = null; public frmBarcodePrintSet() { InitializeComponent(); } protected override void Dispose( bool disposing ) { if( disposing ) { if(components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows 窗体设计器生成的代码 /// /// 设计器支持所需的方法 - 不要使用代码编辑器修改 /// 此方法的内容。 /// private void InitializeComponent() { this.label1 = new System.Windows.Forms.Label(); this.t_Lmw32Path = new System.Windows.Forms.TextBox(); this.b_Browse = new System.Windows.Forms.Button(); this.b_Save = new System.Windows.Forms.Button(); this.b_Close = new System.Windows.Forms.Button(); this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog(); this.SuspendLayout(); // // label1 // this.label1.Location = new System.Drawing.Point(24, 37); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(168, 16); this.label1.TabIndex = 0; this.label1.Text = "Label Matrix 安装路径:"; // // t_Lmw32Path // this.t_Lmw32Path.Location = new System.Drawing.Point(24, 56); this.t_Lmw32Path.Name = "t_Lmw32Path"; this.t_Lmw32Path.Size = new System.Drawing.Size(293, 21); this.t_Lmw32Path.TabIndex = 1; this.t_Lmw32Path.Text = "C:\\Program Files\\lmw32"; // // b_Browse // this.b_Browse.Location = new System.Drawing.Point(323, 54); this.b_Browse.Name = "b_Browse"; this.b_Browse.Size = new System.Drawing.Size(40, 23); this.b_Browse.TabIndex = 2; this.b_Browse.Text = ">>>"; this.b_Browse.Click += new System.EventHandler(this.b_Browse_Click); // // b_Save // this.b_Save.Location = new System.Drawing.Point(144, 134); this.b_Save.Name = "b_Save"; this.b_Save.Size = new System.Drawing.Size(91, 34); this.b_Save.TabIndex = 3; this.b_Save.Text = "保存设置(&S)"; this.b_Save.Click += new System.EventHandler(this.b_Save_Click); // // b_Close // this.b_Close.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.b_Close.Location = new System.Drawing.Point(26, 121); this.b_Close.Name = "b_Close"; this.b_Close.Size = new System.Drawing.Size(91, 34); this.b_Close.TabIndex = 4; this.b_Close.Text = "关闭(&C)"; this.b_Close.Visible = false; this.b_Close.Click += new System.EventHandler(this.b_Close_Click); // // folderBrowserDialog1 // this.folderBrowserDialog1.ShowNewFolderButton = false; // // frmBarcodePrintSet // this.AcceptButton = this.b_Save; this.AutoScaleBaseSize = new System.Drawing.Size(6, 14); this.CancelButton = this.b_Close; this.ClientSize = new System.Drawing.Size(388, 190); this.Controls.Add(this.b_Close); this.Controls.Add(this.b_Save); this.Controls.Add(this.b_Browse); this.Controls.Add(this.t_Lmw32Path); this.Controls.Add(this.label1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "frmBarcodePrintSet"; this.ShowInTaskbar = false; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "Label Matrix 安装路径设置"; this.Load += new System.EventHandler(this.FLabelPrintSet_Load); this.ResumeLayout(false); this.PerformLayout(); } #endregion #endregion #region 窗体事件 private void FLabelPrintSet_Load(object sender, System.EventArgs e) { this.t_Lmw32Path.Text = MyAppconfig.ReadValue("Lmw32Path"); } #endregion #region 按钮事件 private void b_Browse_Click(object sender, System.EventArgs e) { this.folderBrowserDialog1.SelectedPath = this.t_Lmw32Path.Text; if(this.folderBrowserDialog1.ShowDialog().Equals(System.Windows.Forms.DialogResult.OK)) { this.t_Lmw32Path.Text = this.folderBrowserDialog1.SelectedPath; } } private void b_Save_Click(object sender, System.EventArgs e) { if(System.IO.File.Exists(this.t_Lmw32Path.Text.Trim() + @"\Lmwprint.exe")) { MyAppconfig.WriteValue("Lmw32Path", this.t_Lmw32Path.Text); MyMessageBox.ShowInfoMessage("您的设置已经成功保存!"); //this.Close(); } else { MyMessageBox.ShowErrorMessage("您选择的目录中未发现 Label Matrix 软件!请重新选择路径!"); this.t_Lmw32Path.Focus(); this.t_Lmw32Path.SelectAll(); } } private void b_Close_Click(object sender, System.EventArgs e) { this.Close(); } #endregion } }