Class中多定义了一些属性。 
1)."this"关键字,我想大家都注意到了这个关键字,那么到底该如何理解他。举例如下:当我在自我介绍的时候(其实就是在定义我的属性),我会说"我的名字叫xx","我的年龄是xx","我的邮箱是xx"……你可能注意到"我的"这二个字,他就是指我本人--王天。同样的道理在程序设计中,"this"关键字就是指向一个对象的实例。所有在上面代码中"this.Font"、"this.Text"就是在设定当前或者正在运行的Form2实例的属性。 
2).再看看上面的代码,在程序中又导入了一名称空间--System.Drawing。通过这个名称空间定义的类,就可以更好的设计对象,处理颜色和大小。 
3).下面通过下表来具体说明一下在上面程序中设立的属性的具体含义。 
属性 描述 
Location 初始化WinForm的位置,就是当应用程序运行的时候,显示WinFrom的固定位置 
Cursor 当光标在WinForm上面的时候显示的光标状态 
Text 设定WinForm的标题 
StartPosition 这个属性有点类似于"Location"属性,"Location"属性定义的是WinForm的绝对位置,而本属性定义的是WinForm的相对属性。本属性的值定义为"CenterScreen"、"Manual"、"WindoowsDefaultLocation"、 "WindowsDefaultBounds"、"CenterParent" 
FormBorderStyle 定义窗体的边界的样式。通常设定为,"FixedSingle"、"Sizable"、"FixedDialog"、 "FixedToolWindow"、"SizableToolWindow" 
ForeColor 定义窗体的前景色彩 
Font 定义放在WinForm上的字体的类型和大小 
BackColor 定义窗体的背景色彩 
ClientSize 定义WinForm的大小 
Opacity 这个属性是定义WinForm的透明程度,并且这个属性只能用在视窗2000。属性的区值0-1,代表从完全透明到不透明。 

四.做一个带一个组件的WinForm 
本例子主要是介绍如何在WinForm中加入一个组件。如果你想在窗体中加入任何组件,首先,你必须要初始化这个组件(见下面程序中初始化Label一样)。并且使用"Controls.Add"方法加入到窗体中,以下是程序运行的界面和源代码。 

using System ; 
 using System.Windows.Forms ; 
 using System.Drawing ; 
 public class Form3 : Form 
 { 
 //定义一个标签 
 private Label label1 ; 
 public static void Main( ) 
 { 
 Application.Run( new Form3( ) ) ; 
 } 
 // 构造 
 public Form3( ) 
 { 
 // 建立标签并且初始化 
 this.label1 = new System.Windows.Forms.Label( ) ; 
 //先继承一个Label 类 
 label1.Location = new System.Drawing.Point( 24 , 16 ) ; 
 //设定 Label的显示位置 
 label1.Text = "这是一个WinForm中的标签"; 
 label1.Size = new System.Drawing.Size ( 200, 50 ); 
 //设定标签的大小 
 label1.TabIndex = 0 ; 
 label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; 
 // 设定标签的对齐方式 
 this.Text = "在WinForm中加入一个标签!"; 
 this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; 
 this.AutoScaleBaseSize = new System.Drawing.Size( 8 , 16 ) ; 
 this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D; 
 // 设定窗体的边界类型 
 this.ForeColor = System.Drawing.SystemColors.Desktop; 
 this.Font = new System.Drawing.Font ("宋体", 10 , System.Drawing.FontStyle.Bold ) ; 
 // 设定字体、大小就字体的式样 
 this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; 
 this.BackColor = System.Drawing.Color.Blue; 
 // 设定背景色 
 this.ClientSize = new System.Drawing.Size( 250 , 250 ) ; 
 //把标签加到窗体中 
 this.Controls.Add ( this.label1 ) ; 
 } 
 }

五.总结 
以上是对用Visual C#开发WinForm应用程序进行了着重的介绍,由于在.Net FrameWork Sdk中的System.Windows.Froms名称空间中封装了许多关于界面设计的Class(类)。本文只能通过介绍一个基本的类--Form来了解一下Visual C#的强大功能和.Net Class Library(类库)丰富的开发资源。通过本文也可以看出,要想充分利用Visual C#的强大功能,就必须了解并掌握.Net Class Library。也只有掌握了.Net Class Library,你所开发的.Net程序功能才会强大,生命力才更强。