This document outlines how to develop a simple calculator application using C# and Windows Forms. It begins by explaining the purpose is to learn how to create Windows applications, not specifically to build a calculator. It then contrasts DOS and Windows operating systems. Next, it describes key concepts for Windows applications like graphical user interfaces, forms, and controls. It provides examples of common controls like buttons and text boxes. The document recommends building a simple calculator to practice these concepts and provides steps for designing the calculator interface and logic.
2. Out Lines Purpose of this session Dos vs Windows Windows applications concepts Example (make calculator using win forms app)
3. Purpose What’s this session for ? For making a calculator using C# False False !!, for What ?!! I will tell you This session for begin using C# to develop our first windows application Purpose Not to make a calculator (Simply it’s nothing) To learn how to make windows apps (I got it)
4. Dos vs Win Dos Very poor operating system Every thing is text Based on commands Windows The most popular operating system More friendly to user Based on graphical user interfaces (GUIs) Absolutely there is other differences but this what we need right now
5. Windows Applications Windows apps It’s applications used for windows OS Graphical user interface apps Allows a user to interact visually Buttons , text-boxes , labels , … Windows forms Used to create the GUIs
6. Forms Graphical element that appears on your computer's desktopas Dialogs SDI Window (single document interface) MDI Window (multiple document interface) The place where we can but GUI controls
7. Controls Windows app as said before consist of Buttons , labels , text-boxes , … etc. These is called GUI controls GUI controls are objects that can Display information on the screen Enable users to interact with an app via mouse, keyboard Some other form of input as voice commands
8. Common Controls Each control has its own Properties & Events Property as: Background color Event as: Click
9. Events Event is “Something occur” When we click the mouse this is an event When we type on the keyboard this is an event GUIs are event driven which mean Each event, must have its own handler Handler Method perform a task in response to events
11. What For ? What type of calculators user need? for what ? Simple, Basic calculations Advanced, Complex calculations Custom, Custom type of calculations Mix All of them Simply if you made one you can make all Because its only “idea”
12. Let’s Program We will make the simple one Simply because there isn’t remaining time It’s the root of all others We will use Visual Studio As IDE Simply because it’s the best We will use C# as PL Simply because it’s the Strongest Now Let’s Program Okay let’s do it
13. Let’s Think & Imagine Need to get input from the user Can use some buttons to read numbers & operations Can use text-box to show operands, results Convert the input in text box to numbers Can use parse( ) method Store this input in variables for making calculations double fNum , sNum ; Make operations on the values stored in variables double result = fNum ( Operation [+,-,*,/] ) sNum ; Show the final result to user Show it in the text-box
14. Let’s Code We should now start to code At this stage we will convert our thinking & imagination into real world application This could be done by writing some steps based on our thinking & imagination
15. Summary Dos Vs Win Windows Applications Forms (Windows Forms) GUI Controls Events Example on Simple Calculator