马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
C#高速串口通讯方案winform实例
- using System;
- using System.IO.Ports;
- using System.Threading;
- using System.Windows.Forms;
- public class SerialPortForm : Form
- {
-
-
- private ComboBox cboPorts;
- private Button btnConnect;
- private Button btnSend;
- private TextBox txtMessage;
- private RichTextBox rtbReceiver;
- private SerialPort serialPort;
- private System.Threading.Timer uiUpdateTimer;
- public SerialPortForm()
- {
-
-
- this.Text = "串口通讯窗体";
- this.Size = new System.Drawing.Size(400, 300);
- cboPorts = new ComboBox();
- cboPorts.Location = new System.Drawing.Point(20, 20);
- cboPorts.DropDownStyle = ComboBoxStyle.DropDownList;
- btnConnect = new Button();
- btnConnect.Text = "连接";
- btnConnect.Location = new System.Drawing.Point(150, 20);
- btnConn
复制代码 |