using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using CoreFS.CA06; using Core.Mes.Client.Comm.Tool; namespace Core.StlMes.Client.Mcp.VRP { public partial class PopupTextBox : FrmBase { public string TextInfo { get { return txtInfo.Text.Trim(); } } private int _maxLength = 0; public PopupTextBox(string textInfo, int maxLength) { InitializeComponent(); _maxLength = maxLength; this.txtInfo.Text = textInfo; } private void btnOk_Click(object sender, EventArgs e) { if (UnicodeEncoding.Unicode.GetBytes(this.txtInfo.Text.Trim()).Length > _maxLength) { MessageUtil.ShowWarning("输入的文本超出最大字符数限制!"); return; } this.DialogResult = DialogResult.OK; } private void btnCancel_Click(object sender, EventArgs e) { this.DialogResult = DialogResult.Cancel; } private void txtInfo_KeyDown(object sender, KeyEventArgs e) { if (e.Control) { if (e.KeyCode == Keys.A) { txtInfo.SelectAll(); } } } } }