syxxlove

C#第一个windows窗体应用程序

Form1.cs

using System;

……

namespace self_1_1
{
  public partial class Form1 : Form
  {

    public Form1()
    {
      InitializeComponent();
      Button button1 = new Button();
      button1.Click += new System.EventHandler(this.button1_Click);
      button1.Text = "加油";
      this.Controls.Add(button1);
    }
    private void button1_Click(object sender, EventArgs e)
    {
      MessageBox.Show("自学第一天,很努力很努力,很开心很开心");
    }
  }
}

 

Program.cs

using System;

……

namespace self_1_1
{
  static class Program
  {
    /// <summary>
    /// 应用程序的主入口点。
    /// </summary>
    [STAThread]
    static void Main()
    {
      Application.EnableVisualStyles();
      Application.SetCompatibleTextRenderingDefault(false);
      Application.Run(new Form1());
    }
  }
}

发表于 2014-03-25 23:34  fusheng  阅读(302)  评论(0编辑  收藏  举报
 

分类:

技术点:

相关文章:

  • 2021-07-22
  • 2021-11-23
  • 2021-12-03
  • 2021-11-23
  • 2021-12-11
  • 2021-10-09
  • 2022-01-17
猜你喜欢
  • 2021-11-23
  • 2021-04-14
  • 2021-05-21
  • 2021-12-20
  • 2022-12-23
  • 2021-11-23
  • 2021-05-05
相关资源
相似解决方案