Windows Application
Windows Application
The first step is to start a new project and build a form. Open your
Visual Studio and select File->New Project and from the new project
dialog box select Other Languages->Visual C# and select Windows Forms
Application. Enter a project name at the bottom of the dialouge box and
click OK button. The following picture shows how to create a new Form in
Visual Studio.
At the top of the form there is a title bar which displays the forms
title. Form1 is the default name, and you can change the name to your
convenience . The title bar also includes the control box, which holds the
minimize, maximize, and close buttons.
If you want to set any properties of the Form, you can use Visual
Studio Property window to change it. If you do not see the Properties
window, on the View menu, click Properties window. This window lists the
properties of the currently selected Windows Form or control, and its here
that you can change the existing values.
For example , to change the forms title from Form1 to MyForm, click
on Form1 and move to the right side down Properties window, set Text
property to MyForm. Then you can see the Title of the form is changed.
Likewise you can set any properties of Form through Properties window.
You can also set the properties of the Form1 through coding. For coding,
you should right-click the design surface or code window and then clicking
View Code.
When you right click on Form then you will get code behind window,
there you can write your code
For example , if you want to change the back color of the form to Brown ,
you can code in the Form1_Load event like the following.
private void Form1_Load(object sender, EventArgs e)
{
this.BackColor = Color.Brown;
}
Properties
All controls have a number of properties that are used to manipulate
the behavior of the control. The base class of most controls, Control, has a
number of properties that other controls either inherit directly or override
to provide some kind of custom behavior.
The table below shows some of the most common properties of the
Control class. These properties will be present in most of the controls .