- GUIs in the Modern Age
- Creating a Simple GUI
- GUIs and Different Views
- Improving the GUI Code
- Conclusion
Creating a Simple GUI
Figure 1 illustrates the application GUI, which consists of a single window containing a menu and three visual elementsa drop-down list, a button, and a web browser control.
Figure 1 The basic GUI.
In Figure 1, we have an overall container called a form, which contains all the visual elements. Inside the form is a Navigate menu (or menu strip), a drop-down list (the control is called a ComboBox), a button, and a web browser control. Notice that the web browser control contains a live web pagein Figure 1, the website is the Yahoo! home page.
If I click open the ComboBox in the middle of Figure 1, the list drops down to show a second website on the list (see Figure 2).
Figure 2 Another website in the ComboBox control.
If I click the second URL on the list and then click the Go button, I should see the Microsoft home page, as illustrated in Figure 3.
Figure 3 The ComboBox selection has been activated.
The Navigate control has similar capabilities, in that it allows the user to go back, forward, and home (in this example, home is the Yahoo! page). From Figure 3, if I select Navigate > Go Back, I end up back at Figure 1.
Clearly, this is just a tiny snapshot of the GUI-creation capabilities of Microsoft Visual C# 2008 Express Edition. Pages can contain many more controls of arbitrary complexity, but this example is just designed to get us started in working with GUIs.