private void CodeText(CommBar commBar) { barcode += commBar.Code.ToString(); if (barcode.Length > 300) { barcode = ""; } if (barcode.IndexOf("\r") > 0 || barcode.IndexOf("\n") > 0) { barcode = barcode.Replace("\n", ""); barcode = barcode.Replace("\r", ""); this.textBox_TestTxt.Text = ""; this.textBox_TestTxt.Text = barcode; //SendKeys.SendWait(119); Thread.Sleep(100); SendKeys.SendWait("{F8}"); Thread.Sleep(500); SendKeys.SendWait(barcode); SendKeys.SendWait("{ENTER}"); barcode = ""; } }
bool buttonBool = false;//指示按钮是开还是关 public Form1() { InitializeComponent(); commBar = new CommBar(); CheckForIllegalCrossThreadCalls = false; }