*获取或设置中断信号状态
this.serialPort1.BreakState = true;
*获取或设置串行波特率
int i = this.serialPort1.BaudRate;
*获取serialPort父类
System.IO.Stream str = this.serialPort1.BaseStream;
*获取接收缓冲区中数据字节数
int k = this.serialPort1.BytesToRead;
*获取发送缓冲区中数据字节数
int s = this.serialPort1.BytesToWrite;
*获取端口载波检测行的状态
bool b = this.serialPort1.CDHolding;
*将控件的指定边界为指定位置和指定大小
this.SetBounds(0, 0, 800, 800);
*获取"可以发送"行的状态
bool sta = this.serialPort1.CtsHolding;
*获取每个字节的标准数据位长度
int l = this.serialPort1.DataBits;
*将处理System.Io.Ports.serialPort 的数据接收的事件的方法
*this.serialPort1.DataReceived();
*丢弃来自串行驱动程序接收缓存区的数据
this.serialPort1.DiscardInBuffer();
*丢弃来自串行驱动程序传输缓存区的数据
this.serialPort1.DiscardOutBuffer();
*获取或设置一个值 该值指示null字节在端口和接收缓存区之间传送时是否被忽略
this.serialPort1.DiscardNull = false;
*获取数据设置就绪 (DSR) 信号的状态
bool status = this.serialPort1.DsrHolding;
*获取或设置一个值 该值在串行通信过程中启用数据终端就绪 (DTR) 信号
this.serialPort1.DtrEnable = false;
*获取或设置传输前后文本转换的字节编码
this.serialPort1.Encoding = Encoding.UTF8;
*获取一个值 该值指示System.Io.Ports.SerialPort的打开或关闭状态
bool open = this.serialPort1.IsOpen;
*打开一个新的串行端口连接
this.serialPort1.Open();
*获取或设置通信端口
this.serialPort1.PortName = "8888";
*从System.Io.Ports.SerialPort输入缓冲区读取一些字节 并将那些字节放到字节数组指定的偏移量中
Byte[] by = new byte[8092];
this.serialPort1.Read(by, 0, by.Length);
*设置System.Io.Ports.SerialPort输入缓冲区的大小
this.serialPort1.ReadBufferSize = 8092;
*从输入缓冲区中同步读取一个字节
int one = this.serialPort1.ReadByte();
*从输入缓冲区中同步读取一个字符
int oneChar = this.serialPort1.ReadChar();
*在编码基础上 读取System.Io.Ports.SerialPort对象的流和输入缓冲区的所有立即可用字节
this.serialPort1.ReadExisting();
*一直读取System.Io.Ports.SerialPort.NewLine值
string line = this.serialPort1.ReadLine();
*读取或设置读取操作未完成时发生超时之前的毫秒数
this.serialPort1.ReadTimeout = 1000;
*获取或设置写入操作未完成时发生超时之前的毫秒数
this.serialPort1.WriteTimeout = 1000;
*一直读取到输入缓冲区中的指定内容的字符串
string ss = this.serialPort1.ReadTo("");
*读取或设置System.Io.Ports.SerialPort.DataReceived事件发生前内部输入缓冲区的字节数
int count = this.serialPort1.ReceivedBytesThreshold;
*设置或获取一个值 该值指示在串行通信中是否启用请求发送 (RTS) 信号
this.serialPort1.RtsEnable = false;
*将指定的字节写入串行端口
this.serialPort1.Write("");
Byte[] bs = new Byte[8092];
this.serialPort1.Write(bs, 0, bs.Length);
*设置或获取串行端口输出缓冲区的大小
this.serialPort1.WriteBufferSize = 8092;
*将指定字符串 或System.Io.Ports.SerialPort.NewLine写入输出缓冲区
this.serialPort1.WriteLine("");
*关闭端口连接 释放System.IO.Stream对象
this.serialPort1.Close();
*释放所有使用的资源
this.serialPort1.Dispose();
MessageBox.Show("");
this.serialPort1.BreakState = true;
*获取或设置串行波特率
int i = this.serialPort1.BaudRate;
*获取serialPort父类
System.IO.Stream str = this.serialPort1.BaseStream;
*获取接收缓冲区中数据字节数
int k = this.serialPort1.BytesToRead;
*获取发送缓冲区中数据字节数
int s = this.serialPort1.BytesToWrite;
*获取端口载波检测行的状态
bool b = this.serialPort1.CDHolding;
*将控件的指定边界为指定位置和指定大小
this.SetBounds(0, 0, 800, 800);
*获取"可以发送"行的状态
bool sta = this.serialPort1.CtsHolding;
*获取每个字节的标准数据位长度
int l = this.serialPort1.DataBits;
*将处理System.Io.Ports.serialPort 的数据接收的事件的方法
*this.serialPort1.DataReceived();
*丢弃来自串行驱动程序接收缓存区的数据
this.serialPort1.DiscardInBuffer();
*丢弃来自串行驱动程序传输缓存区的数据
this.serialPort1.DiscardOutBuffer();
*获取或设置一个值 该值指示null字节在端口和接收缓存区之间传送时是否被忽略
this.serialPort1.DiscardNull = false;
*获取数据设置就绪 (DSR) 信号的状态
bool status = this.serialPort1.DsrHolding;
*获取或设置一个值 该值在串行通信过程中启用数据终端就绪 (DTR) 信号
this.serialPort1.DtrEnable = false;
*获取或设置传输前后文本转换的字节编码
this.serialPort1.Encoding = Encoding.UTF8;
*获取一个值 该值指示System.Io.Ports.SerialPort的打开或关闭状态
bool open = this.serialPort1.IsOpen;
*打开一个新的串行端口连接
this.serialPort1.Open();
*获取或设置通信端口
this.serialPort1.PortName = "8888";
*从System.Io.Ports.SerialPort输入缓冲区读取一些字节 并将那些字节放到字节数组指定的偏移量中
Byte[] by = new byte[8092];
this.serialPort1.Read(by, 0, by.Length);
*设置System.Io.Ports.SerialPort输入缓冲区的大小
this.serialPort1.ReadBufferSize = 8092;
*从输入缓冲区中同步读取一个字节
int one = this.serialPort1.ReadByte();
*从输入缓冲区中同步读取一个字符
int oneChar = this.serialPort1.ReadChar();
*在编码基础上 读取System.Io.Ports.SerialPort对象的流和输入缓冲区的所有立即可用字节
this.serialPort1.ReadExisting();
*一直读取System.Io.Ports.SerialPort.NewLine值
string line = this.serialPort1.ReadLine();
*读取或设置读取操作未完成时发生超时之前的毫秒数
this.serialPort1.ReadTimeout = 1000;
*获取或设置写入操作未完成时发生超时之前的毫秒数
this.serialPort1.WriteTimeout = 1000;
*一直读取到输入缓冲区中的指定内容的字符串
string ss = this.serialPort1.ReadTo("");
*读取或设置System.Io.Ports.SerialPort.DataReceived事件发生前内部输入缓冲区的字节数
int count = this.serialPort1.ReceivedBytesThreshold;
*设置或获取一个值 该值指示在串行通信中是否启用请求发送 (RTS) 信号
this.serialPort1.RtsEnable = false;
*将指定的字节写入串行端口
this.serialPort1.Write("");
Byte[] bs = new Byte[8092];
this.serialPort1.Write(bs, 0, bs.Length);
*设置或获取串行端口输出缓冲区的大小
this.serialPort1.WriteBufferSize = 8092;
*将指定字符串 或System.Io.Ports.SerialPort.NewLine写入输出缓冲区
this.serialPort1.WriteLine("");
*关闭端口连接 释放System.IO.Stream对象
this.serialPort1.Close();
*释放所有使用的资源
this.serialPort1.Dispose();
MessageBox.Show("");