2.3 Fill in the blanks in each of the following statements:
When an ellipsis button is clicked, a(n) is displayed.
Using help immediately displays a relevant help article.
GUI is an acronym for .
The property specifies which image a PictureBox
displays.
The menu contains commands for arranging and displaying windows.
2.4 State whether each of the following is true or false. If false, explain why.
You can add a control to a Form
by double clicking its control icon in the Toolbox.
The Form
, Label
and PictureBox
have identical properties.
If your machine is connected to the Internet, you can browse websites from the Visual Studio IDE.
Visual C# app developers usually create complex apps without writing any code.
Sizing handles are visible during execution.
2.5 Some features that appear throughout Visual Studio perform similar actions in different contexts. Explain and give examples of how the ellipsis buttons, down-arrow buttons and tool tips act in this manner. Why do you think the Visual Studio IDE was designed this way?
2.6 Briefly describe each of the following terms:
toolbar
menu bar
Toolbox
control
Form
solution
In the following exercises, you’re asked to create GUIs using controls that we have not yet discussed in this book. These exercises give you practice with visual app development only—the apps do not perform any actions. You place controls from the Toolbox on a Form
to familiarize yourself with what each control looks like. If you follow the step-by-step instructions, you should be able to recreate the sample GUIs we show.
2.7 (Notepad GUI) Create the GUI for the notepad as shown in Fig. 2.36.
Manipulating the Form’s properties. Change the Text
property of the Form
to My Note-pad
. Change the Font
property to 9pt Segoe UI
—the recommended font for Windows apps.
Adding a MenuStrip
control to the Form
. Add a MenuStrip
to the Form
. After inserting the MenuStrip
, add items by clicking the Type Here section, typing a menu name (for example, File, Edit, View and About) and then pressing Enter.
Adding a RichTextBox
to the Form.
Drag this control onto the Form
. Use the sizing handles to resize and position the RichTextBox
as shown in Fig. 2.36. Change the Text
property to Enter text here
.
2.8 (Calendar and Appointments GUI) Create the GUI for the calendar as shown in Fig. 2.37.
Manipulating the Form
’s properties. Change the Text
property of the Form
to My Scheduler
. Change the Font
property to 9pt Segoe UI
. Set the Form
’s Size
property to 275
, 400
.
Adding Label
s to the Form.
Add two Label
s to the Form
. Both should be of equal size (231
, 23
; remember to set the AutoSize
property to False
) and should be centered in the Form
horizontally, as shown. Set the Label
’s Text
properties to match Fig. 2.37. Use 12-point font size. Also, set the BackColor
property to Yellow
.
Adding a MonthCalendar
control to the Form
. Add this control to the Form
and center it horizontally in the appropriate place between the two Label
s.
Adding a RichTextBox
control to the Form
. Add a RichTextBox
control to the Form
and center it below the second Label
. Resize the RichTextBox
accordingly.
2.9 (Calculator GUI) Create the GUI for the calculator as shown in Fig. 2.38.
Manipulating the Form
’s properties. Change the Text
property of the Form
to Calculator
. Change the Font
property to 9pt Segoe UI
. Change the Size
property of the Form
to 258
, 210
.
Adding a TextBox
to the Form
. Set the TextBox
’s Text
property in the Properties window to 0
. Stretch the TextBox
and position it as shown in Fig. 2.38. Set the TextAlign
property to Right
—this right aligns text displayed in the TextBox
.
Adding the first Panel
to the Form
. Panel
controls are used to group other controls. Add a Panel
to the Form
. Change the Panel
’s BorderStyle
property to Fixed3D
to make the inside of the Panel
appear recessed. Change the Size
property to 90
, 120
. This Panel
will contain the calculator’s numeric keys.
Adding the second Panel
to the Form
. Change the Panel
’s BorderStyle
property to Fixed3D
. Change the Size
property to 62
, 120
. This Panel
will contain the calculator’s operator keys.
Adding the third (and last) Panel
to the Form
. Change the Panel
’s BorderStyle
property to Fixed3D
. Change the Size
property to 54
, 62
. This Panel
contains the calculator’s C (clear) and C/A (clear all) keys.
Adding Button
s to the Form
. There are 20 Button
s on the calculator. Add a Button
to the Panel
by dragging and dropping it on the Panel
. Change the Text
property of each Button
to the calculator key it represents. The value you enter in the Text
property will appear on the face of the Button
. Finally, resize the Button
s, using their Size
properties. Each Button
labeled 0–9
, *
, /
, -
, =
and .
should have a size of 23, 23
. The 00 Button
has size 52
, 23
. The OFF Button
has size 54
, 23
. The + Button
is sized 23
, 81
. The C (clear) and C/A (clear all) Button
s are sized 44
, 23
.
2.10 (Alarm Clock GUI) Create the GUI for the alarm clock as shown in Fig. 2.39.
Manipulating the Form
’s properties. Change the Text
property of the Form
to Alarm Clock
. Change the Font
property to 9pt Segoe UI
. Change the Size
property of the Form
to 438
, 170
.
Adding Button
s to the Form
. Add seven Button
s to the Form
. Change the Text
property of each Button
to the appropriate text. Align the Button
s as shown.
Adding a GroupBox
to the Form
. GroupBox
es are like Panel
s, except that GroupBox
es display a title. Change the Text
property to AM/PM
, and set the Size
property to 100
, 50
. Center the GroupBox
horizontally on the Form
.
Adding AM/PM RadioButton
s to the GroupBox
. Place two RadioButton
s in the GroupBox
. Change the Text
property of one RadioButton
to AM
and the other to PM
. Align the RadioButton
s as shown.
Adding the time Label
to the Form
. Add a Label
to the Form
and change its Text
property to 00:00:00
. Change the BorderStyle
property to Fixed3D
and the BackColor
to Black
. Use the Font
property to make the time bold and 12pt. Change the ForeColor
to Silver
(located in the Web tab) to make the time stand out against the black background. Position the Label
as shown.
2.11 (Radio GUI) Create the GUI for the radio as shown in Fig. 2.40. [Note: The image used in this exercise is located in this chapter’s examples folder.]
Manipulating the Form
’s properties. Change the Font
property to 9pt Segoe UI
. Change the Form
’s Text
property to Radio
and the Size
to 427
, 194
.
Adding the Pre-set Stations GroupBox
and Button
s. Set the GroupBox
’s Size
to 180, 55
and its Text
to Pre-set Stations
. Add six Button
s to the GroupBox
. Set each one’s Size
to 23
, 23
. Change the Button
s’ Text
properties to 1
, 2
, 3
, 4
, 5
, 6
, respectively.
Adding the Speakers GroupBox
and CheckBox
es. Set the GroupBox
’s Size
to 120, 55
and its Text
to Speakers
. Add two CheckBox
es to the GroupBox
. Set the Text
properties for the CheckBox
es to Rear
and Front
.
Adding the Power On/Off Button
. Add a Button
to the Form
. Set its Text
to Power On/ Off
and its Size
to 75
, 55
.
Adding the Volume Control GroupBox
, the Mute CheckBox
and the Volume TrackBar
. Add a GroupBox
to the Form
. Set its Text
to Volume Control
and its Size
to 180, 70
. Add a CheckBox
to the GroupBox
. Set its Text
to Mute
. Add a TrackBar
to the GroupBox
.
Adding the Tuning GroupBox
, the radio station Label
and the AM/FM RadioButton
s. Add a GroupBox
to the Form
. Set its Text
to Tuning
and its Size
to 120, 70
. Add a Label
to the GroupBox
. Set its AutoSize
to False
, its Size
to 50, 44
, its BackColor
to Black
, its ForeColor
to Silver
, its font to 12pt bold and its TextAlign
to MiddleCenter
. Set its Tex
t to 92.9
. Place the Label
as shown in the figure. Add two RadioButton
s to the GroupBox
. Set the Text
of one to AM
and of the other to FM
.
Adding the image. Add a PictureBox
to the Form
. Set its SizeMode
to StretchImage
and its Size
to 55
, 70
. Set the Image
property to MusicNote.gif
(located in this chapter’s examples folder).