下面代码是书上的。但程序中没有Main()方法,也可执行,为何呢?没有程序的入口啊。
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace ex3_1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string r = textBox1.Text.Trim();
double DouR = Convert.ToDouble(r);
const double PI = 3.1415926;
label1.Text = "圆的面积为:"+PI*DouR*DouR;
}
}
}