Académique Documents
Professionnel Documents
Culture Documents
Microsoft 2
Part 1
Microsoft 3
Visual Studio .NET (VS.NET)
Microsoft 4
Basic operation
break
Microsoft 5
Example: a GUI-based calculator
Microsoft 6
Step 1
Microsoft 7
Step 2 — GUI design
Microsoft 8
GUI design cont’d…
• A simple calculator:
Microsoft 9
Step 3 — "code behind"
Microsoft 10
Step 4 — run mode
• Run!
Microsoft 11
Break mode?
Microsoft 12
Working with Visual Studio
Microsoft 13
Part 2
• Event-driven programming…
Microsoft 14
Event-driven applications
GUI App
Microsoft 15
GUI-based events
• Mouse move
• Mouse click
• Mouse double-click
• Key press
• Button click
• Menu selection
• Change in focus
• Window activation
• etc.
Microsoft 16
Code-behind
Microsoft 17
Call-backs
Microsoft 18
Part 3
• WinForms…
Microsoft 19
WinForms
Microsoft 20
Abstraction
instance of
object System.Windows.Forms.Form
FCL class
CLR
Windows OS
Microsoft 21
Form events
Microsoft 22
Example #1
Microsoft 23
Example #2
Microsoft 24
Part 4
• Controls…
Microsoft 25
Controls
– labels
– buttons
– text boxes
– menus
– list & combo boxes
– option buttons
– check boxes
– etc.
Microsoft 26
Abstraction
object
object
object
object
Microsoft 27
Who creates all these objects?
Microsoft 28
Naming conventions
Microsoft 29
Labels
• No events
• Interesting properties:
– Text: what user sees
– Font: how user sees it
Microsoft 30
Command buttons
• Interesting properties:
– Text: what user sees
– Font: how user sees it
– Enabled: can it be clicked
• Interesting events:
– Click: occurs when button is "pressed"
Microsoft 32
Text box events
• Interesting events:
– Enter, Leave: occurs on change in focus
– KeyPress: occurs on ascii keypress
– KeyDown, KeyUp: occurs on any key combination
– TextChanged: occurs whenever text is modified
Microsoft 33
Example
Microsoft 34
List Boxes
Customer[] customers;
.
. // create & fill array with objects...
.
– Example!
• MS Web Browser control
Microsoft 36
Summary
Microsoft 37
Lab?
Microsoft 38