📄 form1.cs
字号:
//using表示程序引用的库,以下的System,System.Collections.Generic,System.ComponentModel,System.Data,
//System.Drawing,System.Windows.Forms和System.Text为Windows窗体应用应用程序默引用的库,这几个
//库由.NET Framework 2.0中提供。
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
//此处命名空间的作用于前面实例中的命名空间相同。
namespace WindowsHelloWorld
{
//此处为Visual Studio 2005创建的窗体类,其中partial是分部的意思,在后面的章节中会讲到分部类。后面
//的冒号和Form表示Form1继承于Form类,继承的概念在后面的章节也会讲解。
public partial class Form1 : Form
{
//此处是构造函数,在该窗体初始化的时候会执行构造函数中的代码。构造函数也是面向对象中的一个重
//要内容,在后面的章节中会仔细描述。
public Form1()
{
InitializeComponent();
}
//此处是【button1】按钮被点击时触发的事件,即当【button1】按钮被点击时,程序将会执行此处的代码,
//对于本例来说,即显示一个对话框,该对话框的内容是“中间按钮被点击”。
private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show("中间按钮被点击!");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -