2011-03-22
今天第一天学习线程知识,顺便来做下笔记~~
以下是代码:
using System;
using System.Windows.Forms;
using System.Threading;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
private Thread thread1 = new Thread(new ThreadStart(FormShow1));
public Form1()
{
InitializeComponent();
}
private void Threa1Start_Click(object sender, EventArgs e)
{
thread1.Start();
buttom();
textBox1.Text += "thread1.IsAlive:" + thread1.IsAlive + "/r/n";
}
private void Threa1Stop_Click(object sender, EventArgs e)
{
thread1.Abort();
thread1.Join();
FormShowStop1();
buttom();