Introduction To Windows Forms Applications: E E U F F
Introduction To Windows Forms Applications: E E U F F
Introduction To Windows Forms Applications: E E U F F
U
F
INTRODUCTION TO
WINDOWS FORMS APPLICATIONS
Faculty of IT - UEF
E
U
F Table of contents
1. GUI
3. Windows Forms
4. Demo
2
E
U
F GUI
3
E
U
F GUI
Interact through a
high resolution
graphical interface
4
E
U
F Building GUI
5
E
U
F Event- Driven Programming
6
E
U
F Event-Driven Programming
• Events:
7
E
U
F Event-Driven Programming
Event E
subscribe
publish
B
A
C
Handler B for E
A fires event E Delegate for E
Handler C for E
8
E
U
F Event-Driven Programming
Click
User input some
texts on texbox →
invoke
click Button to add
data into listbox
9
E
U
F Event-Driven Programming
Event
• GUI-based events
• Mouse move
• Mouse click
• Mouse double-click
List of events
• Key press for the Form
• Button click
• Menu selection
• Change in focus
• Window activation
• …
10
E
U
F
11
E
U
F Windows Form App
• Based on GUI
• Use event-driven programming
• Windows forms app contains some common items
• Menu
• Toolbar
• StatusBar
• TextBox, Label, Button…
• Base class for using in WFA is Form class
System.Windows.Forms. Form
Namespace Class
12
E
U
F Windows Form App
13
E
U
F GUI Components/Controls
• Component/control defines
• Method
• Event
15
E
U
F Simple Windows Forms App
Form1.cs
Base class
Label
16
E
U
F Basic steps to create Windows Forms
4. Write codes
17
E
U
F Form and control
• System.Windows.Forms.TextBox object
• System.Windows.Forms.Button
object
• …
18
E
U
F Form
Property Description Default
Name Indicates the name used in code to identify the object Form1, Form2…
Text The test associated with the control Form1, Form2, Form3
Method Description
Close Closing form and free resource
Event Description
Load Occurs before a form is displayed for the first time.
19
E
U
F Naming Controls
20
E
U
F Naming Controls
21
E
U
F
Create Windows Forms App from VS
22
E
U
F
Demo
23
E
U
F
Demo
24
E
U
F
Demo
25
E
U
F
Demo
26
E
U
F
Demo
27
E
U
F
Demo
28
E
U
F
Demo
29
E
U
F
Demo
30
E
U
F
Demo
31
E
U
F
Demo
32