using System.Windows.Forms; namespace Core.StlMes.Client.LgCommon { /// /// FrmNumberWriter 的摘要说明。 /// public class frmHeatNoEditor : System.Windows.Forms.Form { private System.Windows.Forms.Button btn_Num_1; private System.Windows.Forms.Button btn_Num_2; private System.Windows.Forms.Button btn_Num_3; private System.Windows.Forms.Button btn_Num_4; private System.Windows.Forms.Button btn_Num_5; private System.Windows.Forms.Button btn_Num_6; private System.Windows.Forms.Button btn_Num_7; private System.Windows.Forms.Button btn_Num_8; private System.Windows.Forms.Button btn_Num_9; private System.Windows.Forms.Button btn_Num_0; private System.Windows.Forms.Button btnCancel; private System.Windows.Forms.Button btnClear; private System.Windows.Forms.Button btnOK; private System.Windows.Forms.TextBox edt_HeatNo; private System.Windows.Forms.Button btn_Letter_E; private Button btn_Letter_F; private Button btn_Letter_Concat; /// /// 必需的设计器变量。 /// private System.ComponentModel.Container components = null; public frmHeatNoEditor() { InitializeComponent(); } /// /// 清理所有正在使用的资源。 /// protected override void Dispose( bool disposing ) { if( disposing ) { if(components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows 窗体设计器生成的代码 /// /// 设计器支持所需的方法 - 不要使用代码编辑器修改 /// 此方法的内容。 /// private void InitializeComponent() { this.btn_Num_1 = new System.Windows.Forms.Button(); this.btn_Num_2 = new System.Windows.Forms.Button(); this.btn_Num_3 = new System.Windows.Forms.Button(); this.btn_Num_4 = new System.Windows.Forms.Button(); this.btn_Num_5 = new System.Windows.Forms.Button(); this.btn_Num_6 = new System.Windows.Forms.Button(); this.btn_Num_7 = new System.Windows.Forms.Button(); this.btn_Num_8 = new System.Windows.Forms.Button(); this.btn_Num_9 = new System.Windows.Forms.Button(); this.btn_Num_0 = new System.Windows.Forms.Button(); this.btnCancel = new System.Windows.Forms.Button(); this.btnClear = new System.Windows.Forms.Button(); this.btnOK = new System.Windows.Forms.Button(); this.edt_HeatNo = new System.Windows.Forms.TextBox(); this.btn_Letter_E = new System.Windows.Forms.Button(); this.btn_Letter_F = new System.Windows.Forms.Button(); this.btn_Letter_Concat = new System.Windows.Forms.Button(); this.SuspendLayout(); // // btn_Num_1 // this.btn_Num_1.Font = new System.Drawing.Font("宋体", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btn_Num_1.ForeColor = System.Drawing.Color.Black; this.btn_Num_1.Location = new System.Drawing.Point(12, 35); this.btn_Num_1.Name = "btn_Num_1"; this.btn_Num_1.Size = new System.Drawing.Size(50, 50); this.btn_Num_1.TabIndex = 1; this.btn_Num_1.Text = "1"; this.btn_Num_1.Click += new System.EventHandler(this.button_Click); // // btn_Num_2 // this.btn_Num_2.Font = new System.Drawing.Font("宋体", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btn_Num_2.ForeColor = System.Drawing.Color.Black; this.btn_Num_2.Location = new System.Drawing.Point(79, 35); this.btn_Num_2.Name = "btn_Num_2"; this.btn_Num_2.Size = new System.Drawing.Size(50, 50); this.btn_Num_2.TabIndex = 2; this.btn_Num_2.Text = "2"; this.btn_Num_2.Click += new System.EventHandler(this.button_Click); // // btn_Num_3 // this.btn_Num_3.Font = new System.Drawing.Font("宋体", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btn_Num_3.ForeColor = System.Drawing.Color.Black; this.btn_Num_3.Location = new System.Drawing.Point(149, 35); this.btn_Num_3.Name = "btn_Num_3"; this.btn_Num_3.Size = new System.Drawing.Size(50, 50); this.btn_Num_3.TabIndex = 3; this.btn_Num_3.Text = "3"; this.btn_Num_3.Click += new System.EventHandler(this.button_Click); // // btn_Num_4 // this.btn_Num_4.Font = new System.Drawing.Font("宋体", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btn_Num_4.ForeColor = System.Drawing.Color.Black; this.btn_Num_4.Location = new System.Drawing.Point(12, 91); this.btn_Num_4.Name = "btn_Num_4"; this.btn_Num_4.Size = new System.Drawing.Size(50, 50); this.btn_Num_4.TabIndex = 4; this.btn_Num_4.Text = "4"; this.btn_Num_4.Click += new System.EventHandler(this.button_Click); // // btn_Num_5 // this.btn_Num_5.Font = new System.Drawing.Font("宋体", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btn_Num_5.ForeColor = System.Drawing.Color.Black; this.btn_Num_5.Location = new System.Drawing.Point(79, 91); this.btn_Num_5.Name = "btn_Num_5"; this.btn_Num_5.Size = new System.Drawing.Size(50, 50); this.btn_Num_5.TabIndex = 5; this.btn_Num_5.Text = "5"; this.btn_Num_5.Click += new System.EventHandler(this.button_Click); // // btn_Num_6 // this.btn_Num_6.Font = new System.Drawing.Font("宋体", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btn_Num_6.ForeColor = System.Drawing.Color.Black; this.btn_Num_6.Location = new System.Drawing.Point(149, 91); this.btn_Num_6.Name = "btn_Num_6"; this.btn_Num_6.Size = new System.Drawing.Size(50, 50); this.btn_Num_6.TabIndex = 6; this.btn_Num_6.Text = "6"; this.btn_Num_6.Click += new System.EventHandler(this.button_Click); // // btn_Num_7 // this.btn_Num_7.Font = new System.Drawing.Font("宋体", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btn_Num_7.ForeColor = System.Drawing.Color.Black; this.btn_Num_7.Location = new System.Drawing.Point(11, 147); this.btn_Num_7.Name = "btn_Num_7"; this.btn_Num_7.Size = new System.Drawing.Size(50, 50); this.btn_Num_7.TabIndex = 7; this.btn_Num_7.Text = "7"; this.btn_Num_7.Click += new System.EventHandler(this.button_Click); // // btn_Num_8 // this.btn_Num_8.Font = new System.Drawing.Font("宋体", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btn_Num_8.ForeColor = System.Drawing.Color.Black; this.btn_Num_8.Location = new System.Drawing.Point(79, 147); this.btn_Num_8.Name = "btn_Num_8"; this.btn_Num_8.Size = new System.Drawing.Size(50, 50); this.btn_Num_8.TabIndex = 8; this.btn_Num_8.Text = "8"; this.btn_Num_8.Click += new System.EventHandler(this.button_Click); // // btn_Num_9 // this.btn_Num_9.Font = new System.Drawing.Font("宋体", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btn_Num_9.ForeColor = System.Drawing.Color.Black; this.btn_Num_9.Location = new System.Drawing.Point(149, 147); this.btn_Num_9.Name = "btn_Num_9"; this.btn_Num_9.Size = new System.Drawing.Size(50, 50); this.btn_Num_9.TabIndex = 9; this.btn_Num_9.Text = "9"; this.btn_Num_9.Click += new System.EventHandler(this.button_Click); // // btn_Num_0 // this.btn_Num_0.Font = new System.Drawing.Font("宋体", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btn_Num_0.ForeColor = System.Drawing.Color.Black; this.btn_Num_0.Location = new System.Drawing.Point(12, 204); this.btn_Num_0.Name = "btn_Num_0"; this.btn_Num_0.Size = new System.Drawing.Size(50, 50); this.btn_Num_0.TabIndex = 10; this.btn_Num_0.Text = "0"; this.btn_Num_0.Click += new System.EventHandler(this.button_Click); // // btnCancel // this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.btnCancel.Location = new System.Drawing.Point(307, 206); this.btnCancel.Name = "btnCancel"; this.btnCancel.Size = new System.Drawing.Size(39, 39); this.btnCancel.TabIndex = 16; this.btnCancel.Text = "取消"; this.btnCancel.Visible = false; // // btnClear // this.btnClear.Location = new System.Drawing.Point(79, 204); this.btnClear.Name = "btnClear"; this.btnClear.Size = new System.Drawing.Size(50, 50); this.btnClear.TabIndex = 14; this.btnClear.Text = "回退"; this.btnClear.Click += new System.EventHandler(this.btnClear_Click); // // btnOK // this.btnOK.Location = new System.Drawing.Point(149, 204); this.btnOK.Name = "btnOK"; this.btnOK.Size = new System.Drawing.Size(50, 50); this.btnOK.TabIndex = 15; this.btnOK.Text = "确定"; this.btnOK.Click += new System.EventHandler(this.btnOK_Click); // // edt_HeatNo // this.edt_HeatNo.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper; this.edt_HeatNo.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.edt_HeatNo.Location = new System.Drawing.Point(12, 6); this.edt_HeatNo.Name = "edt_HeatNo"; this.edt_HeatNo.Size = new System.Drawing.Size(187, 23); this.edt_HeatNo.TabIndex = 0; // // btn_Letter_E // this.btn_Letter_E.Font = new System.Drawing.Font("宋体", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btn_Letter_E.ForeColor = System.Drawing.Color.Black; this.btn_Letter_E.Location = new System.Drawing.Point(307, 65); this.btn_Letter_E.Name = "btn_Letter_E"; this.btn_Letter_E.Size = new System.Drawing.Size(39, 39); this.btn_Letter_E.TabIndex = 11; this.btn_Letter_E.Text = "E"; this.btn_Letter_E.Visible = false; this.btn_Letter_E.Click += new System.EventHandler(this.button_Click); // // btn_Letter_F // this.btn_Letter_F.Font = new System.Drawing.Font("宋体", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btn_Letter_F.ForeColor = System.Drawing.Color.Black; this.btn_Letter_F.Location = new System.Drawing.Point(307, 112); this.btn_Letter_F.Name = "btn_Letter_F"; this.btn_Letter_F.Size = new System.Drawing.Size(39, 39); this.btn_Letter_F.TabIndex = 12; this.btn_Letter_F.Text = "F"; this.btn_Letter_F.Visible = false; this.btn_Letter_F.Click += new System.EventHandler(this.button_Click); // // btn_Letter_Concat // this.btn_Letter_Concat.Font = new System.Drawing.Font("宋体", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btn_Letter_Concat.Location = new System.Drawing.Point(307, 159); this.btn_Letter_Concat.Name = "btn_Letter_Concat"; this.btn_Letter_Concat.Size = new System.Drawing.Size(39, 39); this.btn_Letter_Concat.TabIndex = 13; this.btn_Letter_Concat.Text = "-"; this.btn_Letter_Concat.Visible = false; this.btn_Letter_Concat.Click += new System.EventHandler(this.button_Click); // // frmHeatNoEditor // this.AcceptButton = this.btnOK; this.AutoScaleBaseSize = new System.Drawing.Size(6, 14); this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(205)))), ((int)(((byte)(228)))), ((int)(((byte)(225))))); this.CancelButton = this.btnCancel; this.ClientSize = new System.Drawing.Size(215, 263); this.Controls.Add(this.btn_Letter_Concat); this.Controls.Add(this.btn_Letter_F); this.Controls.Add(this.btn_Letter_E); this.Controls.Add(this.edt_HeatNo); this.Controls.Add(this.btnOK); this.Controls.Add(this.btnClear); this.Controls.Add(this.btnCancel); this.Controls.Add(this.btn_Num_0); this.Controls.Add(this.btn_Num_9); this.Controls.Add(this.btn_Num_8); this.Controls.Add(this.btn_Num_7); this.Controls.Add(this.btn_Num_6); this.Controls.Add(this.btn_Num_5); this.Controls.Add(this.btn_Num_4); this.Controls.Add(this.btn_Num_3); this.Controls.Add(this.btn_Num_2); this.Controls.Add(this.btn_Num_1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "frmHeatNoEditor"; this.ShowInTaskbar = false; this.StartPosition = System.Windows.Forms.FormStartPosition.Manual; this.Load += new System.EventHandler(this.frmNumberWriter_Load); this.ResumeLayout(false); this.PerformLayout(); } #endregion private string _Text = ""; public string InputText { get { return _Text; } set { if (value != _Text)_Text = value; } } private void button_Click(object sender, System.EventArgs e) { if (this.edt_HeatNo.Text.Length >= 8 && string.IsNullOrEmpty(this.edt_HeatNo.SelectedText)) return; Button bt = (Button)sender; this.edt_HeatNo.SelectedText = bt.Text; this.edt_HeatNo.Focus(); this.edt_HeatNo.SelectionLength = 0; } private void btnClear_Click(object sender, System.EventArgs e) { try { if (this.edt_HeatNo.Text.Length == 0) { this.edt_HeatNo.Focus(); return; } int index = this.edt_HeatNo.Text.Length; this.edt_HeatNo.Text = this.edt_HeatNo.Text.ToString().Substring(0,index-1); this.edt_HeatNo.Focus(); this.edt_HeatNo.SelectionStart = index; // index = this.edt_HeatNo.Text.IndexOf(this.edt_HeatNo.SelectedText); // this.edt_HeatNo.SelectedText = ""; } catch { } } private void frmNumberWriter_Load(object sender, System.EventArgs e) { this.edt_HeatNo.ReadOnly = true; this.edt_HeatNo.Text = _Text; this.edt_HeatNo.Focus(); this.edt_HeatNo.SelectionStart = _Text.Length; this.edt_HeatNo.SelectionLength = 0; } private void btnOK_Click(object sender, System.EventArgs e) { _Text = this.edt_HeatNo.Text; this.DialogResult = DialogResult.OK; this.Close(); } } }