textBox1.Text = "欢迎使用简易的串口助手!";
groupBox3.Enabled = false;//LED控制界面变灰色
groupBox6.Enabled = false;
groupBox7.Enabled = false;
groupBox8.Enabled = false;
button3.Enabled = false;
button6.Enabled = false;
timer1.Start();
try
{
foreach (string in System.IO.Ports.SerialPort.GetPortNames())
//自动获取串行口名称
this.comboBox1.Items.Add();
//默认设置
comboBox1.SelectedIndex = 0;//选择第一个com口
comboBox2.SelectedIndex = 4;//波特率4800
comboBox3.SelectedIndex = 0;//校验位NONE
comboBox4.SelectedIndex = 0;//停止位为1
comboBox5.SelectedIndex = 0;//数据位为8
}
catch
{
MessageBox.Show("找不到通讯端口!", "串口调试助手");
}
}
private void timer1_Tick(object sender, EventArgs e)
{
label6.Text = DateTime.Now.ToString();
}
private void button2_Click(object sender, EventArgs e)
{
try {
if (button2.Text == "开启")
{
groupBox6.Enabled = true;
radioButton1.Checked = false;
radioButton2.Checked = false;
radioButton3.Checked = false;
radioButton4.Checked = false;
checkBox1.Checked = false;
checkBox2.Checked = false;