效果:
代码:
private void InitializeComponent()
{
this.comboPortName = new System.Windows.Forms.ComboBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.comboBaudrate = new System.Windows.Forms.ComboBox();
this.buttonOpenClose = new System.Windows.Forms.Button();
this.labelGetCount = new System.Windows.Forms.Label();
this.labelSendCount = new System.Windows.Forms.Label();
this.buttonReset = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.txGet = new System.Windows.Forms.TextBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.btnCrc = new System.Windows.Forms.Button();
this.DropCRC = new System.Windows.Forms.ComboBox();
this.label4 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.buttonSend = new System.Windows.Forms.Button();
this.checkBoxHexSend = new System.Windows.Forms.CheckBox();
this.txSend = new System.Windows.Forms.TextBox();
this.checkBoxNewlineSend = new System.Windows.Forms.CheckBox();
this.checkBoxHexView = new System.Windows.Forms.CheckBox();
this.checkBoxNewlineGet = new System.Windows.Forms.CheckBox();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.SuspendLayout();
//
// comboPortName
//
this.comboPortName.BackColor = System.Drawing.Color.White;
this.comboPortName.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboPortName.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.comboPortName.FormattingEnabled = true;
this.comboPortName.Location = new System.Drawing.Point(78, 11);
this.comboPortName.Name = "comboPortName";
this.comboPortName.Size = new System.Drawing.Size(121, 20);
this.comboPortName.TabIndex = 4;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(13, 15);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(53, 12);
this.label1.TabIndex = 2;
this.label1.Text = "串口名称";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(205, 15);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(41, 12);
this.label2.TabIndex = 3;
this.label2.Text = "波特率";
//
// comboBaudrate
//
this.comboBaudrate.BackColor = System.Drawing.Color.White;
this.comboBaudrate.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBaudrate.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.comboBaudrate.FormattingEnabled = true;
this.comboBaudrate.Items.AddRange(new object[] {
"2400",
"4800",
"9600",
"19200",
"38400",