Chapter 12-GUI Concepts I
Chapter 12-GUI Concepts I
Chapter 12-GUI Concepts I
GUI Concepts I
Outline
12.1 Introduction
12.2 Windows Forms
12.3 Event-Handling Model
12.3.1 Basic Event Handling
12.4 Control Properties and Layout
12.5 Labels, TextBoxes and Buttons
12.6 GroupBoxes and Panels
12.7 CheckBoxes and RadioButtons
12.8 PictureBoxes
12.9 Mouse-Event Handling
12.10 Keyboard-Event Handling
12.1 Introduction
• GUI
– Graphical User Interface
• Allows visual interaction
• Event driven
– User interaction generates events
• Distinctive “look” and “feel”
• Learn new applications more quickly
12.1 Introduction
12.1 Introduction
• GUI Components
– Objects with which user interacts
• Event generation
– Contained in Toolbox
• Control
– Visible by graphical representation at runtime.
– ex: Label control.
• Component
– Are not visible during runtime.
– ex: Timer component
12.1 Introduction
Comp o ne nt De sc rip tio n
Label An area in which icons or uneditable text can be displayed.
Textbox An area in which the user inputs data from the keyboard. This area
also can display information.
Button An area that triggers an event when clicked.
CheckBox A component that is either selected or not selected.
ComboBox A drop-down list of items from which the user can make a selection
either by clicking an item in the list or by typing into a box.
ListBox An area in which a list of items is displayed. The user can make a
selection from the list by clicking on any element. Multiple elements
can be selected.
Panel A container in which components can be placed.
Scrollbar A component that allows the user to access a range of values that
normally cannot fit in the controller’s container.
Fig. 12.2 Som e b a sic GUI c om p one nts.
– Image property
• Image to be displayed
12.8 PictureBoxes
PictureBox De sc rip tio n / De le g a te a nd Event Arg ume nts
p rop erties a nd events
Common
Properties
Image Sets the image to display in the PictureBox.
SizeMode Enumeration that controls image sizing and positioning. Values are
Normal (default), StretchImage, AutoSize and
CenterImage. Normal places image in top-left corner of
PictureBox, and CenterImage puts image in middle (both cut
image off if it is too large). StretchImage resizes image to fit in
PictureBox. AutoSize resizes PictureBox to hold image.
Common Events (Delegate EventHandler, event arguments
EventArgs)
Click Raised when user clicks the control. Default event when this control is
double clicked in the designer.
Fig. 12.30 PictureBox p rop erties a nd e vents.