private void display()
{
while (ff == true)
{
}
}
void button1_Click(object sender, EventArgs e)
{
if (button1.Text == "开始监控")
{
ff=true;
Thread a = new Thread(new ThreadStart(display));
a.Start();
button1.Text = "停止监控";
}
else
{
a.Abort();
serialPort1.Close();
button1.Text = "开始监控";
ff = false;
}
}
温馨提示:内容为网友见解,仅供参考