public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
int banjing = Convert.ToInt32(this.textBox1.Text);
//定义有参数的线程
ParameterizedThreadStart pts = new ParameterizedThreadStart(jisuan);
Thread t = new Thread(pts);
t.Start(banjing);//这里给参数赋值
}
//定义给计算面积的方法
private void jisuan(object r)
{
int r1=Convert.ToInt32(r);
string mianji = (Math.PI * r1 * r1).ToString();
MessageBox.Show(mianji);
}
}