菜鸟入门照葫芦画瓢的一段完整简单C#代码,有笑错误,请教帮我看下,谢谢!
using System;using System.Collections.Generic;
using System.WinForms;
using System.Windows.Forms;
namespace WindowsApplication4
{
static class Program
{
public class Form1 :Form
{
public Form1()
{
//this.SetSize(180, 90);
this.Size = new System.Drawing.Size(180, 190);
//this.BorderStyle = FormBorderStyle.FixedDialog;
this.Text = " +C -> +F / +F -> +C ";
this.StartPosition = FormStartPosition.CenterScreen;
// this.HelpButton = false;
this.MaximizeBox = false;
public class TempConverter : System.Form
{
Label lTempFah = new Label();
Label lTempCel = new Label();
TextBox tTempFah = new TextBox();
TextBox tTempCel = new TextBox();
Button bnCtoF = new Button();
Button bnFtoC = new Button();
public TempConverter()
{
this.SetSize(180,90);
this.BorderStyle = FormBorderStyle.FixedDialog;
this.Text =" +C -> +F / +F -> +C ";
this.StartPosition = FormStartPosition.CenterScreen;
this.HelpButton = false;
this.MaximizeBox = false;
tTempCel.TabIndex = 0;
tTempCel.SetSize(50,25);
tTempCel.SetLocation(13,5);
lTempCel.TabStop = false;
lTempCel.Text = "+C ";
lTempCel.SetSize(25, 25);
lTempCel.SetLocation(65,5);
tTempFah.TabIndex = 1;
tTempFah.SetSize(50,25);
tTempFah.SetLocation(90,5);
lTempFah.TabStop = false;
lTempFah.Text = "+F ";
lTempFah.SetSize(25,25);
lTempFah.SetLocation(142,5);
bnCtoF.TabIndex = 2;
bnCtoF.Text = "+C to +F ";
bnCtoF.SetSize(70,25);
bnCtoF.SetLocation(13,35);
bnFtoC.TabIndex = 3;
bnFtoC.Text = "+F to +C ";
bnFtoC.SetSize(70,25);
bnFtoC.SetLocation(90,35);
this.Controls. Add(tTempCel);
this.Controls. Add(lTempCel);
this.Controls. Add(tTempFah);
this.Controls. Add(lTempFah);
this.Controls. Add(bnCtoF);
this.Controls. Add(bnFtoC);
}
}
}
public static void Main()
{
Application.Run(new Form1());
}
}
}
}
错误信息是:1 应输入}
2 应输入类型、命名空间定义或文件尾