我用c#编了一个小程序,调试有问题,请帮忙看看 谢谢
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;namespace HelloGUI
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
public class FormHello : System.Windows.Forms.Form
{
private System.Windows.Forms.Button button1;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public FormHello()
{

//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
            this.button1.Click+=new System.EventHandler(button1_Click);
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
} /// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null) 
{
components.Dispose();
}
}
base.Dispose( disposing );
} #region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
// 
// button1
// 
this.button1.Location = new System.Drawing.Point(192, 216);
this.button1.Name = "button1";
this.button1.TabIndex = 0;
this.button1.Text = "button1";
this.button1.Click += new System.EventHandler(this.button1_Click);
// 
// FormHello
// 
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(292, 266);
this.Controls.Add(this.button1);
this.Name = "FormHello";
this.Text = "Form1";
this.Load += new System.EventHandler(this.FormHello_Load);
this.ResumeLayout(false); }
#endregion /// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main() 
{
Application.Run(new FormHello());
Application.Run(new ControlForm());
} private void FormHello_Load(object sender, System.EventArgs e)
{
this.Text="Hello C# GUI";
button1.Text="Hello";
} private void button1_Click(object sender, System.EventArgs e)
{
DialogResult diaRes;
//MessageBOX的按钮类型为YesNo
MessageBoxButtons buttons=MessageBoxButtons.YesNo;
//MessageBox的缺省值为yes
MessageBoxDefaultButton defaultButton=MessageBoxDefaultButton.Button1; //MessageBox的图标为问号
MessageBoxIcon icon=MessageBoxIcon.Question; //MessageBox的对齐方式为右对齐 MessageBoxOptions options=MessageBoxOptions.RightAlign; //MessageBox要显示的内容为字符串
string ask ="Do you want to show\"Hello C#\"?";
 
//MessageBox的标题 string caption="show string";
diaRes=
MessageBox.Show (this,ask,caption,buttons,icon,defaultButton,options);
//如果用户按了按钮yes,则弹出另外一个MessageBox,显示“Hello C#”
if (diaRes==DialogResult.Yes)
{
MessageBox.Show("Hello C#");
}
} private void label1_Click(object sender, System.EventArgs e)
{

}
}
public class ControlForm: System.Windows.Forms.Label 
 {
private System.Windows.Forms.Label Label1;  
public ControlForm()
{
InitializeComponent();
}
private void InitializeComponent()
{
//创建一个Label控件
this.label1=new System.Windows.Forms.Label ();
//临时挂起控件的逻辑布局
this.SuspendLayout();
//Label1的属性定制
//设定label1在窗体上的位置
this.label1.Location=new System.Drawing.Point(72,56); //设定label1的名字
this.label1.Name="label1";
//设定label1的大小
this.label1.Size=new System.Drawing.Size (128,16); //设定label1的文字 this.label1.Text="label控件的使用演示";
//controlform窗体的制定
this.AutoScaleBaseSize=new System.Drawing.Size(6,14);
this.ClientSize=new System.Drawing.Size(292,273);
//将控件加入控件组
this.Controls.AddRange(new System.Windows.Forms.Control[]
   {this.label1});
//设定控件名
this.Name="ControlForm";
//设定默认显示文本
this.Text="Control"; //恢复控件的逻辑布局
this.ResumeLayout(false);
}
}
}