Visual Basic 2005 for Programmers (2nd Edition)

13.1. Introduction

A graphical user interface (GUI) allows a user to interact visually with a program. A GUI (pronounced "GOO-ee") gives a program a distinctive look-and-feel.

Look-and-Feel Observation 13.1

Consistent user interfaces enable a user to learn new applications faster because the applications have the same look-and-feel.

As an example of a GUI, consider Fig. 13.1, which shows an Internet Explorer Web browser window containing various GUI controls. Near the top of the window, there is a menu bar containing the menus File, Edit, View, Favorites, Tools and Help. Below the menu bar is a set of buttons, each with a defined task in Internet Explorer, such as returning to the previously viewed Web page, printing the current page or refreshing the page. Below these buttons lies a combobox, in which users can type the locations of Web sites they wish to visit. To the left of the combobox is a label (Address) that indicates the combobox's purpose (in this case, entering the location of a Web site). Scrollbars are located at the right side and bottom of the window. Usually, scrollbars appear when a window contains more information than can be displayed in its viewable area. Scrollbars enable a user to view different portions of the window's contents. These controls form a user-friendly interface through which the user interacts with Internet Explorer.

Figure 13.1. GUI controls in an Internet Explorer window.

GUIs are built from GUI controls (which are sometimes called components or widgetsshort for window gadgets). GUI controls are objects that can display information on the screen or enable users to interact with an application via the mouse, keyboard or some other form of input (such as voice commands). Several common GUI controls are listed in Fig. 13.2. In the sections that follow and in Chapter 14, Graphical User Interface Concepts: Part 2, we discuss each of these in detail. Chapter 14 also explores the features and properties of additional GUI controls.

Figure 13.2. Some basic GUI controls.

Control

Description

Label

Displays images or uneditable text.

TextBox

Enables the user to enter data via the keyboard. Also can be used to display editable or uneditable text.

Button

Triggers an event when clicked with the mouse.

CheckBox

Specifies an option that can be selected (checked) or unselected (not checked).

ComboBox

Provides 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 in a box.

ListBox

Provides a list of items from which the user can make a selection by clicking an item in the list. Multiple elements can be selected.

Panel

A container in which controls can be placed and organized.

NumericUpDown

Enables the user to select from a range of numeric input values.

Категории