Ad Code

Responsive Advertisement

WINDOWS PROGRAMMING

WINDOWS PROGRAMMING

In development of any application we have required a user interface (UI) to communicate with end user. We have two different types of User Interface
1.      CUI ( Character User Interface)
2.      GUI ( Graphical User Interface)
- Traditionally we have CUI eg: dos, UNIX, os etc. This application suffers from little criticism like:
1. They are not user-friendly. As we need to learn the commands first to use them.
2. They do not allow navigating from one place to other place.
- To solve the above problems in early 90’s GUI applications are introduced by Microsoft with its windows operation system, which has a beautiful feature known as “Look & Feel “ To develop them Microsoft has introduced an language also into the market in 90’s i.e. VB , letter when .net was introduced the support for GUI has been given in all .net languages.
- To develop windows application we required a set of component known as controls provided as classes to us, with in the namespace system.windows.forms

Controls are categorized into 2

Container Controls

these controls are capable of holding other controls on them eg: Form, Panel, GroupBox, SplitContainer, TabControl etc.

Non-Container Controls

These controls are not capable of holding any controls on them moreover they can be used only after being placed on a container. Eg: Button, Label, TextBox, CombBox, ChekBox, TreeView, ListView, DataGridView etc. 

 - Whatever the control it was every control has 3 things in common.
  1. Property: - these are attributes of a control which have their impact on look of the control. Eg: Width, Height, Back Color, for color etc.
  2. Method: - these are action performed by the controls eg: Clear(), Focus(), Close() etc.
  3. Events: - these are time period which specify when an action has to be perform. Eg: Click Load, Keypress, mouse over etc.

Note – All the controls we are going to work with or derived from a default parent i.e. class control, which contains the properties methods and events which are common for all the controls like: Form, Button, TextBox etc.

Que. How to develop a windows application?
Ans. if we want to develop a windows application, the base control which has to be created first is – Form. To create it we follow the blow process.

Step 1: Define a class inheriting from the predefined class form so that the new class is also a form.
Step 2: now to run the form we have created, create an object of it and passed it as parameter to the rum method of application class, which is responsible in execution of a windows application.

Que. from where can we develop a windows application.
Ans. we can develop a windows application in two different ways:
        I.            Using notepad following the above process.
      II.            Using windows forms application project template, under Visual Studio.

  1. Developing windows application under notepad: - open notepad  write the following code init then save, compile and execute.
    using System;
    using System.windows.forms;

    public class MyForm : Form
    {

    static void Main()
     {
       MyForm f = new MyForm ();
        Application. Run(f); 
     } 
     }
.      Developing windows application under Visual Studio:- To develop a windows application under visual studio,
  • Open new project window select windows form application project templates and specify the name to the project, eg- WindowsProject. 
  • By default the project comes with two class’s init.
  • Program.cs
  • form1.cs
  • The execution of windows application starts from the static class program, under this class we find a main method creating the object of Form class that has to be executed.
  • Eg: Application. Run(new Form1());
  • Form1.cs is the file in which the class Form1 is defined inheriting from pre-defined class Form and this is the class that has to be executed.
  • Eg: public partial class Form1 : Form
  • Windows application develops under Visual studio has two places to work with.
  • Design view
  • Code view 
  • Design view is the place where we design the application; this is accessible to both programmers and end users.
  • Code view is the place where we write the code for execution of application, this is accessible only to programmer. 
Note- because of the design view, what VS provides it is known as WYSIWYG editor- (What You See Is What You Get)
Reactions

Post a Comment

0 Comments