Windows Form

C# and .Net give in depth support for building windows application. The most important point about windows application is that they are 'event driven'. All windows applications gift a graphical interface to their users and answer user interaction. This graphical user interface is called a 'Windwos Form' or 'WinForm'.

In sort A windows form may contain Text, Labels, Push Buttons, Text Boxes, List Boxes, Images, Menus and vast range of other controls. Infact, a WinForm is also a windows control just like a Text Box, Label etc.

In .Net, all windows controls square measure described by base category objects contained within the System.Windows.Forms namespace.

The first step is to begin a brand new project and build a type.

Open our 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 rock bottom of the dialouge box and click on OK button. The following image shows the way to produce a brand new type in Visual Studio.

Create New Project-UK Academe

Select Windows Forms Application from New Project window.

Win from application-UK Academe

After selecting Windows Forms Application , We can see a default Form (i.e. Form1) in our new C# project. The Windows Form we see in Designer view is a visual representation of the window that will open when our application is opened. We can switch between this view and code view at any time by right-clicking the design surface or code window and then clicking View Code or View Designer.

WinForm-UK Academe

At the highest of the shape there's a title bar that displays the forms title. "Form1" is that the default name, and we can change the name to our convenience. The title bar additionally includes the management box, which holds the minimize, maximize, and close buttons.

If we want to set any properties of the Form, wou can use Visual Studio Property Window to change it. If we do not see the Properties window, go to View Menu on the Top menu ,then click Properties Window.
This window lists the properties of the currently selected Windows Form or control, and here we can change the existing values of control.

Properties Windows-UK Academe

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 we can see the Title of the form is changed. We can set any other properties of Form through Properties Window.

We can additionally set the properties of the Form1 through committal to writing. For coding, we should go to right-click the planning surface or code window so clicking View Code.

Form Text Property-UKAcademe

When we right click on Form then we will get code behind window, there we can write our code..

For Example
If we want to change the back color of the form current color (Default) to Brown , then we can code in the Form1_Load event like the following.

 
private void Form1_Load(object sender, EventArgs e)
{
    this.BackColor = Color.Brown;
}

We can change other properties of Form1 through coding.

Video Tutorial