<pre name="code" class="cpp"><pre name="code" class="csharp"><pre name="code" class="csharp">using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace AreaOf_Circle
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();//窗体初始化
}
private void label2_Click(object sender, EventArgs e)
{
}
private void textBox2_TextChanged(object sender, EventArgs e)
{
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
double r, l, s, v;
r = Convert.ToSingle(textBox1.Text);//获取输入半径
l = Math.PI * 2 * r;//计算周长
s = Math.PI * r * r;//计算面积
v = Math.PI * 3.0 / 4.0 * r * r * r;//计算体积
textBox2.Text = Convert.ToString(l);//显示周长
textBox3.Text = Convert.ToString(s);//显示面积
textBox4.Text = Convert.ToString(v);//显示体积
}
private void button2_Click(object sender, EventArgs e)
{
Application.Exit();//退出
}
}
}