之后在重新打開這個線程?
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;
}
}
下一篇你喜歡山東嗎