Visual C # is an important component of the Microsoft. Ner FrameWork and a new generation of programming languages strongly recommended by Microsoft. WinForm is a title for Windows Form on the. Net development platform .. Net provides a wide range of Class libraries for WinForm applications ). These WinFrom class libraries support RAD (fast application development). These class libraries are encapsulated in a namespace, which is System. Windows. Forms. Many classes are defined in this namespace. When developing a. Net-based GUI application, we inherit and extend these classes so that our program has a variety of user interfaces. This article attempts to use the most basic class-Form to describe the specific process of developing the WinForm program with Visual C.
I. Development and running environment and general introduction
All debugging programs in this question are based on Microsoft Windows 2000 Professional Edition and. Net FrameWork Beta 2.
II. The first WinForm
If your machine has reached the running environment required by our program, open a text editor
Copy the program code to the editor and save it as the first. cs file. Use the following compilation statement:
Csc/t: winexe/r: system. dll first. cs
After compilation. Run the program and you will see the following interface:
Source code: first. cs
Using System;
// Import the WinForms namespace
Using System. Windows. Forms;
// Class Form1 inherits and extends the class Form in the System. Windows. Forms namespace
Public class Form1: Form
{
Public static void Main ()
{
// Run the program
Application. Run (new Form1 ());
}
}
Summary:
1) first, use the "using System. Windows. Forms" statement to import the WinForm namespace.
2). Declare the Form1 class. This class inherits and extends the Form class in the using System. Windows. Forms namespace.
3). "Application" class, which is also defined in the using System. Windows. Forms namespace. Because of this class of closed, we cannot inherit anything. The "Application" class is mainly used to run and exit Windows applications and process Windows messages. Calling the "Run" method of the "Application" class indicates that the Application will start to Run.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service