Laborator 1 PDF
Laborator 1 PDF
From the above screen, select Visual C# Projects in Project types and Windows
Application in Templates. Write the name of the new project (LearningWinForm in the
above figure) in the text box labeled Name. Select the location where you wish to store the
project using the Browse... Button and click OK. It will show you an empty form in the
designer view similar to the figure below:
You can see the toolbox window at the left hand side and the properties window at the
right hand side of the above snapshot. The toolbox allows you to add different controls to
your form. Once the control is placed on the form, you can change its various properties
from the Properties window. You can also change the location and size of the controls using
the mouse. Event properties can be changed by switching to the Event Poperties pane ( )
in the Properties Window.
Setting various properties of the form
You can change the default properties of the form using the Properties window. For this,
select (click) the form and select the properties window (If the properties window is not
visible in the right hand pane, select ViewProperties Window). Now change the title of the
form and the name of the forms class in the code by changing the Text and Name
properties, as shown in the following figure.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Laborator1
{
public partial class MyForm : Form
{
public MyForm()
{
InitializeComponent();
}
private void btnExit_Click(object sender, EventArgs e)
{
}
}
}
Write the code to close the application (Application.Exit()) in the event handler. The IDE has
not only created the event handler but also has registered it with the Exit buttons Click
event.
To close the application, click the Exit button or the close button on the title bar of the
window.