2011年4月14日

textbox只能输入数字

摘要: View Code 1 private void txtJustNumber_KeyPress(object sender, KeyPressEventArgs e)2 {3 if (e.KeyChar != 8 && !char.IsDigit(e.KeyChar) && e.KeyChar != 13)4 {5 MessageBox.Show("只能输入数字");6 e.Handled = true;7 }8 } 阅读全文

posted @ 2011-04-14 16:55 源远流长 阅读(160) 评论(0) 推荐(0) 编辑

模仿Word中的查找

摘要: View Code 1 private int FindPlace = 0; //文本查找位置,缺省为文本起点 2 private void btnStart_Click(object sender, EventArgs e) 3 { 4 if (txtToSearch.Text != "") //当查找内容不为空时,进行查找 5 { 6 //获得Form1窗体的引用 7 MainForm mainForm = (MainForm)this.Owner; 8 //如果主窗体文本内容不为空,进行查找 9 if (mainForm.rtbData.Text.Length > 阅读全文

posted @ 2011-04-14 16:53 源远流长 阅读(151) 评论(0) 推荐(0) 编辑

SerialPort 串口通信

摘要: SerialPort 串口的参数:View Code public class KeySerialConfig { public string PortName { get; set; } public int BaudRate { get; set; } public int DataBits { get; set; } public StopBits SerialStopBits { get; set; } public Parity SerialParity { get; set; } }SerialPort 通信协议类View Code 1 public class KeyProtoc 阅读全文

posted @ 2011-04-14 16:44 源远流长 阅读(485) 评论(0) 推荐(0) 编辑

导航