C # study (1)

xiaoxiao2021-03-05  26

Start learning C # FORM programming.

Using system; using system.drawing; using system.windows.forms; // Reference Some required to use class libraries

Namespace _ // Name Space {Public Class Mainform: Form // Inherits a Form Form Class from System.Windows.forms {Public MainForm () // Constructor of New Inherited FORM Forms {THIS.AUTOSCALEBASESIZE = New System .Drawing.size (5, 13); this.clientsize = new system.drawing.size (640, 480); this.text = "mainform"; this.name = "mainform"; // More 4 lines set new Some properties of the defined FORM form class} public static void main (String [] args) // Applications {Application.Run (new mainform ()); // With System.Windows.Forms Application Class RUN method creates a use

Instance of new inherited FORM form class, and start it

}}}

The first FORM program, a form is also a class:

1 Inheriting a window class from the class library, then rewriting the constructor, setting some properties from the parent class in this constructor,

That is, the properties that we have created the window classes need to be set;

2 Establish the main () entry function, use the new key to generate an instance of the window class we created in this function, and use one I now

The RUN method that is not understood begins to start this instance, and this new FORM window program is established and started to run.

The concept of the class speaking before reading the book is very abstract, after reading this class of formal structure, it is a bit feeling.

Note: The rookie begin school C #, there are a lot of mistakes, please prawn the old birds, the rookie first thank you.

转载请注明原文地址:https://www.9cbs.com/read-37170.html

New Post(0)