public bool bool1;
public Thread three1;
private void button4_Click(object sender, EventArgs e) {
bool1 = true;
three1 = new Thread(test);
three1.Start();
}
private void button5_Click(object sender, EventArgs e) {
try {
bool1 = false;
three1.Abort();
//关闭资源
} catch (Exception ex) { }
}
public void test() {
while (bool1) {
//资源使用
}
}
欢迎光临 CSkin博客 (http://bbs.cskin.net/) | Powered by Discuz! X3.2 |