Exercise 2.6 Changing the Font Size Property
In this and the next two exercises, you change the properties of the form used in Exercise 2.5.
- Choose File, Open Project, if necessary, and select View, Project Explorer, or click the Project Explorer icon to open the Project window. Click View Form.
- Click the form to give it the focus, and press F4 to open the Properties dialog box.
- Click font and change the font size to 18 points (or to another size if the size is not available on your system).
- Run the program. Click to display the first sentence. Press a key to display the second sentence.
- Exit to continue with the next exercise.
Exercise 2.7 Changing the Font Style Properties
In this exercise, use the form from Exercise 2.5 once again.
- Open the Properties dialog box and open the Font dialog box by double clicking the Font property. Change the Font to Bookman Old Style (or another font if your system does not have this font installed).
- Change the style to bold and italic.
- Run the revised program. Click to display the first sentence (it should be in bold and italic). Press a key to display the second sentence.
- Exit and save your project at this time. The next exercise asks you to begin a new project.
Exercise 2.8 Adding a Message to a Form and Changing Property Settings
In this exercise, you write a new procedure and change properties.
- Open a new project.
- Add the following Form_Click() Visual Basic procedure to the form:
Private Sub Form_Click() 'This procedure will display a Happy Birthday message Print " HAPPY" Print " BIRTHDAY" End Sub- Change the following form properties:
Property Setting Backcolor Palette = &H00FF00FF& (light purple) BorderStyle = 1 'Fixed Single Caption = Today is the day Font Style = Italic Font = Arial Font Size = 24 ForeColor Palette = &H00FF0000& (blue) WindowState = 2 'Maximized - Run your program.
- Exit and save your program. Give the form a unique name, such as BDAY.FRM. Give the project a similar name, such as BDAY.VBP.