在好例子网,分享、交流、成长!
您当前所在位置:首页C# 开发实例C#语言基础 → 串口调试工具源码(串口之间通讯,支持字符串和16进制)

串口调试工具源码(串口之间通讯,支持字符串和16进制)

C#语言基础

下载此实例
  • 开发语言:C#
  • 实例大小:3.26M
  • 下载次数:68
  • 浏览次数:433
  • 发布时间:2018-08-25
  • 实例类别:C#语言基础
  • 发 布 人:tqx01
  • 文件格式:.zip
  • 所需积分:2
 相关标签: 串口 调试工具 工具 调试

实例介绍

【实例简介】

【实例截图】

from clipboard

from clipboard

【核心代码】

using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.IO.Ports;
using System.Text;
using System.Text.RegularExpressions;
using System.Windows.Forms;

namespace myport2
{
	public class Form1 : Form
	{
		private enum SetPort
		{
			打开,
			关闭
		}

		private SerialPort port = new SerialPort();

		private bool isSetProperty = false;

		private string tbSendDate = "";

		private string tbSend16Date = "";

		private List<byte> ReceivedData = new List<byte>();

		private int a = 0;

		private IContainer components = null;

		private ComboBox cmbt;

		private Label lbport;

		private Label labBaudrate;

		private Button btOpenport;

		private ComboBox cbtDataBit;

		private ComboBox cbxparity;

		private Label label1;

		private Label label2;

		private Panel panel1;

		private Panel panel2;

		private TextBox tbreceivedcount;

		private TextBox tbSend;

		private Label label5;

		private Label label4;

		private Label label3;

		private Button button1;

		private RichTextBox rtbreceivsd;

		private Panel panel3;

		private Button button2;

		private CheckBox cb16re;

		private Label label6;

		private Panel panel4;

		private Button button3;

		private CheckBox cbSend;

		private Label label7;

		private RichTextBox rtbSend;

		private Panel panel5;

		private SerialPort serialPort1;

		private ComboBox cbxportname;

		private ToolStrip toolStrip1;

		private ToolStripLabel toolStripLabel1;

		private ToolStrip toolStrip2;

		private ToolStripLabel tlablTime;

		private Timer timer1;

		private Button btclearSend;

		public string rtbSend16Data
		{
			get;
			set;
		}

		public string tbSendDataStr
		{
			get;
			set;
		}

		private void port_DateReceived(object sender, SerialDataReceivedEventArgs e)
		{
			byte[] receivedData = new byte[this.port.BytesToRead];
			this.port.Read(receivedData, 0, receivedData.Length);
			this.ReceivedData.AddRange(receivedData);
			this.tbreceivedcount.Text = (Convert.ToInt32(this.tbreceivedcount.Text)   receivedData.Length).ToString();
			if (this.cb16re.Checked)
			{
				this.rtbreceivsd.Text = Methods.ByteTo16Str(this.ReceivedData.ToArray());
			}
			else
			{
				this.rtbreceivsd.Text = Encoding.Default.GetString(this.ReceivedData.ToArray());
			}
			this.port.DiscardInBuffer();
		}

		private void DataSend()
		{
			try
			{
				int num;
				if (this.cbSend.Checked)
				{
					byte[] hexbyte = Methods._16strToHex(this.tbSend16Date);
					this.port.Write(hexbyte, 0, hexbyte.Length);
					TextBox textBox = this.tbSend;
					num = Convert.ToInt32(this.tbSend.Text)   hexbyte.Length;
					textBox.Text = num.ToString();
				}
				else
				{
					this.port.WriteLine(this.rtbSend.Text);
					TextBox textBox2 = this.tbSend;
					num = Convert.ToInt32(this.tbSend.Text)   this.rtbSend.Text.Length;
					textBox2.Text = num.ToString();
				}
			}
			catch (Exception e)
			{
				MessageBox.Show(e.Message.ToString());
			}
		}

		private void setportexproperty()
		{
			this.port.PortName = this.cbxportname.Text.Trim();
			this.port.BaudRate = Convert.ToInt32(this.cmbt.Text.Trim());
			this.port.DataBits = Convert.ToInt32(this.cbtDataBit.Text.Trim());
			switch (this.cbxparity.Text.Trim())
			{
			case "无":
				this.port.Parity = Parity.None;
				break;
			case "奇效验":
				this.port.Parity = Parity.Odd;
				break;
			case "偶效验":
				this.port.Parity = Parity.Even;
				break;
			default:
				this.port.Parity = Parity.None;
				break;
			}
			this.port.ReadTimeout = 5000;
			Control.CheckForIllegalCrossThreadCalls = false;
			this.port.DataReceived  = this.port_DateReceived;
		}

		private void Displaystatport(SetPort SetPort)
		{
			this.toolStripLabel1.Text = this.cbxportname.Text   "端口处于"   SetPort   "状态";
		}

		private void AgeinPort()
		{
			if (this.port.IsOpen)
			{
				try
				{
					this.port.Close();
					this.setportexproperty();
					this.isSetProperty = true;
					this.port.Open();
				}
				catch (Exception)
				{
					this.isSetProperty = false;
					this.Displaystatport(SetPort.关闭);
					this.btOpenport.Text = "打开串口";
					MessageBox.Show("串口未打开,串口错误或被占用!", "错误");
					return;
				}
				this.Displaystatport(SetPort.打开);
			}
			else
			{
				this.Displaystatport(SetPort.关闭);
			}
		}

		public Form1()
		{
			this.InitializeComponent();
		}

		private void textBox2_TextChanged(object sender, EventArgs e)
		{
		}

		private void label4_Click(object sender, EventArgs e)
		{
		}

		private void Form1_Load(object sender, EventArgs e)
		{
			Hashtable ht = new Hashtable();
			this.MaximumSize = base.Size;
			this.MinimumSize = base.Size;
			base.MaximizeBox = false;
			this.cmbt.Items.Add("1200");
			this.cmbt.Items.Add("2400");
			this.cmbt.Items.Add("4800");
			this.cmbt.Items.Add("9600");
			this.cmbt.Items.Add("19200");
			this.cmbt.Items.Add("38400");
			this.cmbt.Items.Add("43000");
			this.cmbt.Items.Add("56000");
			this.cmbt.Items.Add("57600");
			this.cmbt.Items.Add("115200");
			if (ht.ContainsKey("cmbt"))
			{
				this.cmbt.SelectedIndex = this.cmbt.Items.IndexOf(ht["cmbt"].ToString());
			}
			else
			{
				this.cmbt.SelectedIndex = 3;
			}
			this.cmbt.DropDownStyle = ComboBoxStyle.DropDownList;
			this.cbtDataBit.Items.Add("8");
			this.cbtDataBit.Items.Add("7");
			this.cbtDataBit.Items.Add("6");
			this.cbtDataBit.Items.Add("5");
			if (ht.ContainsKey("cbtDataBit"))
			{
				this.cbtDataBit.SelectedIndex = this.cmbt.Items.IndexOf(ht["cbtDataBit"].ToString());
			}
			else
			{
				this.cbtDataBit.SelectedIndex = 0;
			}
			this.cbtDataBit.DropDownStyle = ComboBoxStyle.DropDownList;
			this.cbxparity.Items.Add("无");
			this.cbxparity.Items.Add("奇效验");
			this.cbxparity.Items.Add("偶效验");
			if (ht.ContainsKey("cbxparity"))
			{
				this.cbxparity.SelectedIndex = this.cmbt.Items.IndexOf(ht["cbxparity"].ToString());
			}
			else
			{
				this.cbtDataBit.SelectedIndex = 0;
			}
			this.cbtDataBit.DropDownStyle = ComboBoxStyle.DropDownList;
			this.cbxportname.Items.Clear();
			this.cbxportname.Items.AddRange(Methods.ActivePorts());
			if (ht.ContainsKey("cbxportname") && this.cbxportname.Items.Contains(ht["cbxportname"].ToString()))
			{
				this.cbxportname.SelectedIndex = this.cbxportname.Items.IndexOf(ht["cbxportname"].ToString());
			}
			else
			{
				this.cbxportname.SelectedIndex = 0;
			}
			this.cbxportname.DropDownStyle = ComboBoxStyle.DropDownList;
			this.tbSend.Text = "0";
			this.tbSend.ReadOnly = true;
			this.tbreceivedcount.Text = "0";
			this.tbreceivedcount.ReadOnly = true;
			this.tlablTime.Text = DateTime.Now.ToString();
			this.toolStripLabel1.ForeColor = Color.Blue;
			if (!this.isSetProperty)
			{
				this.setportexproperty();
				this.isSetProperty = true;
			}
			try
			{
				this.port.Open();
				this.btOpenport.Text = "关闭串口";
				this.Displaystatport(SetPort.打开);
			}
			catch
			{
				this.isSetProperty = false;
				MessageBox.Show("串口打开失败!", "错误");
			}
			if (ht.ContainsKey("cb16re") && ht["cb16re"].ToString() == "True")
			{
				this.cb16re.Checked = true;
			}
			else
			{
				this.cb16re.Checked = false;
			}
			if (ht.ContainsKey("cbSend") && ht["cb16re"].ToString() == "True")
			{
				this.cbSend.Checked = true;
			}
			else
			{
				this.cbSend.Checked = false;
			}
			if (ht.ContainsKey("tbSend16Date") && ht.ContainsKey("tbSendDate"))
			{
				this.tbSend16Date = ht["tbSend16Date"].ToString();
				this.tbSendDate = ht["tbSendDate"].ToString();
				if (this.cbSend.Checked)
				{
					this.rtbSend.Text = ht["tbSend16Date"].ToString();
				}
				else
				{
					this.rtbSend.Text = ht["tbSendDate"].ToString();
				}
			}
			this.rtbSend.Focus();
		}

		private void timer1_Tick(object sender, EventArgs e)
		{
			this.tlablTime.Text = DateTime.Now.ToString();
		}

		private void btOpenport_Click(object sender, EventArgs e)
		{
			if (!this.port.IsOpen)
			{
				if (!this.isSetProperty)
				{
					this.setportexproperty();
					this.isSetProperty = true;
				}
				try
				{
					this.port.Open();
					this.btOpenport.Text = "关闭串口";
					this.Displaystatport(SetPort.打开);
				}
				catch (Exception)
				{
					this.isSetProperty = false;
					MessageBox.Show("串口错误!", "错误");
				}
			}
			else
			{
				try
				{
					this.port.Close();
					this.isSetProperty = false;
					this.btOpenport.Text = "打开串口";
					this.Displaystatport(SetPort.关闭);
				}
				catch (Exception)
				{
					MessageBox.Show("串口错误!", "错误");
				}
			}
		}

		private void button3_Click(object sender, EventArgs e)
		{
			if (this.rtbSend.Text.Trim() == "")
			{
				MessageBox.Show("发送数据不能为空!");
			}
			else if (this.port.IsOpen)
			{
				this.DataSend();
			}
			else
			{
				MessageBox.Show("串口未打开!");
			}
		}

		private void cbxportname_SelectedIndexChanged(object sender, EventArgs e)
		{
			this.AgeinPort();
		}

		private void cmbt_SelectedIndexChanged(object sender, EventArgs e)
		{
			this.AgeinPort();
		}

		private void cbtDataBit_SelectedIndexChanged(object sender, EventArgs e)
		{
			this.AgeinPort();
		}

		private void cbxparity_SelectedIndexChanged(object sender, EventArgs e)
		{
			this.AgeinPort();
		}

		private void button2_Click(object sender, EventArgs e)
		{
			this.ReceivedData.Clear();
			this.rtbreceivsd.Text = "";
		}

		private void cb16re_CheckedChanged(object sender, EventArgs e)
		{
			if (this.cb16re.Checked)
			{
				this.rtbreceivsd.Text = Methods.ByteTo16Str(this.ReceivedData.ToArray());
			}
			else
			{
				this.rtbreceivsd.Text = Encoding.Default.GetString(this.ReceivedData.ToArray());
			}
		}

		private void cbSend_CheckedChanged(object sender, EventArgs e)
		{
			if (this.cbSend.Checked)
			{
				this.tbSend16Date = this.rtbSend.Text;
			}
			else
			{
				this.tbSendDate = this.rtbSend.Text;
			}
		}

		private void rtbSend_TextChanged(object sender, EventArgs e)
		{
		}

		private void rtbSend_KeyPress(object sender, KeyPressEventArgs e)
		{
			if (this.cbSend.Checked)
			{
				string patter = "[0-9a-fA-F]|\b";
				Match i = Regex.Match(e.KeyChar.ToString(), patter);
				if (i.Success)
				{
					if (e.KeyChar != '\b')
					{
						if (this.rtbSend.Text.Length % 3 == 2)
						{
							this.rtbSend.Text = "";
							this.rtbSend.SelectionStart = this.rtbSend.Text.Length;
						}
						e.Handled = false;
					}
					else
					{
						e.Handled = true;
					}
				}
				else
				{
					e.Handled = false;
				}
			}
		}

		private void btclearSend_Click(object sender, EventArgs e)
		{
			this.rtbSend.Text = "";
			if (this.cbSend.Checked)
			{
				this.tbSend16Date = "";
			}
			else
			{
				this.tbSendDate = "";
			}
		}

		private void button1_Click(object sender, EventArgs e)
		{
			this.tbSend.Text = "0";
			this.tbreceivedcount.Text = "0";
		}

		protected override void Dispose(bool disposing)
		{
			if (disposing && this.components != null)
			{
				this.components.Dispose();
			}
			base.Dispose(disposing);
		}

		private void InitializeComponent()
		{
			this.components = new Container();
			this.cmbt = new ComboBox();
			this.lbport = new Label();
			this.labBaudrate = new Label();
			this.btOpenport = new Button();
			this.cbtDataBit = new ComboBox();
			this.cbxparity = new ComboBox();
			this.label1 = new Label();
			this.label2 = new Label();
			this.panel1 = new Panel();
			this.panel2 = new Panel();
			this.button1 = new Button();
			this.tbreceivedcount = new TextBox();
			this.tbSend = new TextBox();
			this.label5 = new Label();
			this.label4 = new Label();
			this.label3 = new Label();
			this.rtbreceivsd = new RichTextBox();
			this.panel3 = new Panel();
			this.button2 = new Button();
			this.cb16re = new CheckBox();
			this.label6 = new Label();
			this.panel4 = new Panel();
			this.button3 = new Button();
			this.cbSend = new CheckBox();
			this.label7 = new Label();
			this.rtbSend = new RichTextBox();
			this.panel5 = new Panel();
			this.serialPort1 = new SerialPort(this.components);
			this.cbxportname = new ComboBox();
			this.toolStrip1 = new ToolStrip();
			this.toolStripLabel1 = new ToolStripLabel();
			this.toolStrip2 = new ToolStrip();
			this.tlablTime = new ToolStripLabel();
			this.timer1 = new Timer(this.components);
			this.btclearSend = new Button();
			this.panel1.SuspendLayout();
			this.panel2.SuspendLayout();
			this.panel3.SuspendLayout();
			this.panel4.SuspendLayout();
			this.panel5.SuspendLayout();
			this.toolStrip1.SuspendLayout();
			this.toolStrip2.SuspendLayout();
			base.SuspendLayout();
			this.cmbt.FormattingEnabled = true;
			this.cmbt.Location = new Point(71, 100);
			this.cmbt.Name = "cmbt";
			this.cmbt.Size = new Size(121, 23);
			this.cmbt.TabIndex = 1;
			this.cmbt.SelectedIndexChanged  = this.cmbt_SelectedIndexChanged;
			this.lbport.AutoSize = true;
			this.lbport.Font = new Font("Microsoft Sans Serif", 11f);
			this.lbport.Location = new Point(-3, 44);
			this.lbport.Name = "lbport";
			this.lbport.Size = new Size(53, 18);
			this.lbport.TabIndex = 2;
			this.lbport.Text = "串口:";
			this.labBaudrate.AutoSize = true;
			this.labBaudrate.Font = new Font("Microsoft Sans Serif", 11f);
			this.labBaudrate.Location = new Point(-3, 105);
			this.labBaudrate.Name = "labBaudrate";
			this.labBaudrate.Size = new Size(68, 18);
			this.labBaudrate.TabIndex = 3;
			this.labBaudrate.Text = "波特率:";
			this.btOpenport.Location = new Point(71, 270);
			this.btOpenport.Name = "btOpenport";
			this.btOpenport.Size = new Size(75, 32);
			this.btOpenport.TabIndex = 5;
			this.btOpenport.Text = "打开串口";
			this.btOpenport.UseVisualStyleBackColor = true;
			this.btOpenport.Click  = this.btOpenport_Click;
			this.cbtDataBit.FormattingEnabled = true;
			this.cbtDataBit.Location = new Point(71, 156);
			this.cbtDataBit.Name = "cbtDataBit";
			this.cbtDataBit.Size = new Size(121, 23);
			this.cbtDataBit.TabIndex = 6;
			this.cbtDataBit.SelectedIndexChanged  = this.cbtDataBit_SelectedIndexChanged;
			this.cbxparity.FormattingEnabled = true;
			this.cbxparity.Location = new Point(71, 211);
			this.cbxparity.Name = "cbxparity";
			this.cbxparity.Size = new Size(121, 23);
			this.cbxparity.TabIndex = 7;
			this.cbxparity.SelectedIndexChanged  = this.cbxparity_SelectedIndexChanged;
			this.label1.AutoSize = true;
			this.label1.Font = new Font("Microsoft Sans Serif", 11f);
			this.label1.Location = new Point(-3, 157);
			this.label1.Name = "label1";
			this.label1.Size = new Size(68, 18);
			this.label1.TabIndex = 8;
			this.label1.Text = "数据位:";
			this.label2.AutoSize = true;
			this.label2.Font = new Font("Microsoft Sans Serif", 11f);
			this.label2.Location = new Point(-3, 216);
			this.label2.Name = "label2";
			this.label2.Size = new Size(68, 18);
			this.label2.TabIndex = 9;
			this.label2.Text = "效验位:";
			this.panel1.BorderStyle = BorderStyle.FixedSingle;
			this.panel1.Controls.Add(this.cbxportname);
			this.panel1.Controls.Add(this.lbport);
			this.panel1.Controls.Add(this.label2);
			this.panel1.Controls.Add(this.label1);
			this.panel1.Controls.Add(this.cmbt);
			this.panel1.Controls.Add(this.cbxparity);
			this.panel1.Controls.Add(this.labBaudrate);
			this.panel1.Controls.Add(this.cbtDataBit);
			this.panel1.Controls.Add(this.btOpenport);
			this.panel1.Location = new Point(18, 14);
			this.panel1.Name = "panel1";
			this.panel1.Size = new Size(231, 324);
			this.panel1.TabIndex = 10;
			this.panel2.Controls.Add(this.button1);
			this.panel2.Controls.Add(this.tbreceivedcount);
			this.panel2.Controls.Add(this.tbSend);
			this.panel2.Controls.Add(this.label5);
			this.panel2.Controls.Add(this.label4);
			this.panel2.Controls.Add(this.label3);
			this.panel2.Font = new Font("Microsoft Sans Serif", 10f);
			this.panel2.Location = new Point(19, 368);
			this.panel2.Name = "panel2";
			this.panel2.Size = new Size(230, 153);
			this.panel2.TabIndex = 11;
			this.button1.Location = new Point(62, 118);
			this.button1.Name = "button1";
			this.button1.Size = new Size(75, 32);
			this.button1.TabIndex = 10;
			this.button1.Text = "清空计数器";
			this.button1.UseVisualStyleBackColor = true;
			this.button1.Click  = this.button1_Click;
			this.tbreceivedcount.Location = new Point(89, 77);
			this.tbreceivedcount.Name = "tbreceivedcount";
			this.tbreceivedcount.Size = new Size(100, 23);
			this.tbreceivedcount.TabIndex = 4;
			this.tbreceivedcount.TextChanged  = this.textBox2_TextChanged;
			this.tbSend.Location = new Point(89, 38);
			this.tbSend.Name = "tbSend";
			this.tbSend.Size = new Size(100, 23);
			this.tbSend.TabIndex = 3;
			this.label5.AutoSize = true;
			this.label5.Location = new Point(14, 77);
			this.label5.Name = "label5";
			this.label5.Size = new Size(69, 17);
			this.label5.TabIndex = 2;
			this.label5.Text = "接收(byt):";
			this.label4.AutoSize = true;
			this.label4.Location = new Point(14, 41);
			this.label4.Name = "label4";
			this.label4.Size = new Size(69, 17);
			this.label4.TabIndex = 1;
			this.label4.Text = "发送(byt):";
			this.label4.Click  = this.label4_Click;
			this.label3.AutoSize = true;
			this.label3.Location = new Point(7, 0);
			this.label3.Name = "label3";
			this.label3.Size = new Size(36, 17);
			this.label3.TabIndex = 0;
			this.label3.Text = "计数";
			this.rtbreceivsd.Location = new Point(14, 15);
			this.rtbreceivsd.Name = "rtbreceivsd";
			this.rtbreceivsd.Size = new Size(411, 265);
			this.rtbreceivsd.TabIndex = 12;
			this.rtbreceivsd.Text = "";
			this.panel3.Controls.Add(this.button2);
			this.panel3.Controls.Add(this.cb16re);
			this.panel3.Controls.Add(this.label6);
			this.panel3.Controls.Add(this.rtbreceivsd);
			this.panel3.Location = new Point(273, 14);
			this.panel3.Name = "panel3";
			this.panel3.Size = new Size(444, 324);
			this.panel3.TabIndex = 13;
			this.button2.Location = new Point(350, 297);
			this.button2.Name = "button2";
			this.button2.Size = new Size(75, 24);
			this.button2.TabIndex = 10;
			this.button2.Text = "清除数据";
			this.button2.UseVisualStyleBackColor = true;
			this.button2.Click  = this.button2_Click;
			this.cb16re.AutoSize = true;
			this.cb16re.Location = new Point(14, 297);
			this.cb16re.Name = "cb16re";
			this.cb16re.Size = new Size(98, 19);
			this.cb16re.TabIndex = 13;
			this.cb16re.Text = "十六进值显示";
			this.cb16re.UseVisualStyleBackColor = true;
			this.cb16re.CheckedChanged  = this.cb16re_CheckedChanged;
			this.label6.AutoSize = true;
			this.label6.Location = new Point(11, -3);
			this.label6.Name = "label6";
			this.label6.Size = new Size(55, 15);
			this.label6.TabIndex = 11;
			this.label6.Text = "接收数据";
			this.panel4.Controls.Add(this.btclearSend);
			this.panel4.Controls.Add(this.button3);
			this.panel4.Controls.Add(this.cbSend);
			this.panel4.Controls.Add(this.label7);
			this.panel4.Controls.Add(this.rtbSend);
			this.panel4.Location = new Point(273, 368);
			this.panel4.Name = "panel4";
			this.panel4.Size = new Size(444, 180);
			this.panel4.TabIndex = 14;
			this.button3.Location = new Point(350, 121);
			this.button3.Name = "button3";
			this.button3.Size = new Size(75, 24);
			this.button3.TabIndex = 14;
			this.button3.Text = "发送数据";
			this.button3.UseVisualStyleBackColor = true;
			this.button3.Click  = this.button3_Click;
			this.cbSend.AutoSize = true;
			this.cbSend.Location = new Point(14, 125);
			this.cbSend.Name = "cbSend";
			this.cbSend.Size = new Size(98, 19);
			this.cbSend.TabIndex = 14;
			this.cbSend.Text = "十六进值发送";
			this.cbSend.UseVisualStyleBackColor = true;
			this.cbSend.CheckedChanged  = this.cbSend_CheckedChanged;
			this.label7.AutoSize = true;
			this.label7.Location = new Point(11, -3);
			this.label7.Name = "label7";
			this.label7.Size = new Size(55, 15);
			this.label7.TabIndex = 11;
			this.label7.Text = "发送数据";
			this.rtbSend.Cursor = Cursors.PanNE;
			this.rtbSend.Location = new Point(14, 15);
			this.rtbSend.Name = "rtbSend";
			this.rtbSend.Size = new Size(411, 85);
			this.rtbSend.TabIndex = 12;
			this.rtbSend.Text = "";
			this.rtbSend.TextChanged  = this.rtbSend_TextChanged;
			this.rtbSend.KeyPress  = this.rtbSend_KeyPress;
			this.panel5.Controls.Add(this.panel1);
			this.panel5.Controls.Add(this.panel4);
			this.panel5.Controls.Add(this.panel2);
			this.panel5.Controls.Add(this.panel3);
			this.panel5.Location = new Point(12, 12);
			this.panel5.Name = "panel5";
			this.panel5.Size = new Size(743, 553);
			this.panel5.TabIndex = 15;
			this.cbxportname.FormattingEnabled = true;
			this.cbxportname.Location = new Point(71, 44);
			this.cbxportname.Name = "cbxportname";
			this.cbxportname.Size = new Size(121, 23);
			this.cbxportname.TabIndex = 10;
			this.cbxportname.SelectedIndexChanged  = this.cbxportname_SelectedIndexChanged;
			this.toolStrip1.Dock = DockStyle.Bottom;
			this.toolStrip1.Items.AddRange(new ToolStripItem[1]
			{
				this.toolStripLabel1
			});
			this.toolStrip1.Location = new Point(0, 563);
			this.toolStrip1.Name = "toolStrip1";
			this.toolStrip1.Size = new Size(775, 25);
			this.toolStrip1.TabIndex = 16;
			this.toolStrip1.Text = "toolStrip1";
			this.toolStripLabel1.Name = "toolStripLabel1";
			this.toolStripLabel1.Size = new Size(96, 22);
			this.toolStripLabel1.Text = "toolStripLabel1";
			this.toolStrip2.Anchor = (AnchorStyles.Bottom | AnchorStyles.Right);
			this.toolStrip2.Dock = DockStyle.None;
			this.toolStrip2.Items.AddRange(new ToolStripItem[1]
			{
				this.tlablTime
			});
			this.toolStrip2.Location = new Point(646, 562);
			this.toolStrip2.Name = "toolStrip2";
			this.toolStrip2.Size = new Size(108, 25);
			this.toolStrip2.TabIndex = 17;
			this.toolStrip2.Text = "toolStrip2";
			this.tlablTime.Name = "tlablTime";
			this.tlablTime.Size = new Size(96, 22);
			this.tlablTime.Text = "toolStripLabel1";
			this.timer1.Tick  = this.timer1_Tick;
			this.btclearSend.Location = new Point(350, 151);
			this.btclearSend.Name = "btclearSend";
			this.btclearSend.Size = new Size(75, 24);
			this.btclearSend.TabIndex = 14;
			this.btclearSend.Text = "清除数据";
			this.btclearSend.UseVisualStyleBackColor = true;
			this.btclearSend.Click  = this.btclearSend_Click;
			base.AutoScaleDimensions = new SizeF(7f, 15f);
			base.AutoScaleMode = AutoScaleMode.Font;
			base.ClientSize = new Size(775, 588);
			base.Controls.Add(this.toolStrip2);
			base.Controls.Add(this.toolStrip1);
			base.Controls.Add(this.panel5);
			this.Font = new Font("Microsoft Sans Serif", 9f);
			base.Margin = new Padding(3, 4, 3, 4);
			base.Name = "Form1";
			this.Text = "Form1";
			base.Load  = this.Form1_Load;
			this.panel1.ResumeLayout(false);
			this.panel1.PerformLayout();
			this.panel2.ResumeLayout(false);
			this.panel2.PerformLayout();
			this.panel3.ResumeLayout(false);
			this.panel3.PerformLayout();
			this.panel4.ResumeLayout(false);
			this.panel4.PerformLayout();
			this.panel5.ResumeLayout(false);
			this.toolStrip1.ResumeLayout(false);
			this.toolStrip1.PerformLayout();
			this.toolStrip2.ResumeLayout(false);
			this.toolStrip2.PerformLayout();
			base.ResumeLayout(false);
			base.PerformLayout();
		}
	}
}

实例下载地址

串口调试工具源码(串口之间通讯,支持字符串和16进制)

不能下载?内容有错? 点击这里报错 + 投诉 + 提问

好例子网口号:伸出你的我的手 — 分享

网友评论

发表评论

(您的评论需要经过审核才能显示)

查看所有0条评论>>

小贴士

感谢您为本站写下的评论,您的评论对其它用户来说具有重要的参考价值,所以请认真填写。

  • 类似“顶”、“沙发”之类没有营养的文字,对勤劳贡献的楼主来说是令人沮丧的反馈信息。
  • 相信您也不想看到一排文字/表情墙,所以请不要反馈意义不大的重复字符,也请尽量不要纯表情的回复。
  • 提问之前请再仔细看一遍楼主的说明,或许是您遗漏了。
  • 请勿到处挖坑绊人、招贴广告。既占空间让人厌烦,又没人会搭理,于人于己都无利。

关于好例子网

本站旨在为广大IT学习爱好者提供一个非营利性互相学习交流分享平台。本站所有资源都可以被免费获取学习研究。本站资源来自网友分享,对搜索内容的合法性不具有预见性、识别性、控制性,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,平台无法对用户传输的作品、信息、内容的权属或合法性、安全性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论平台是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二与二十三条之规定,若资源存在侵权或相关问题请联系本站客服人员,点此联系我们。关于更多版权及免责申明参见 版权及免责申明

;
报警