Share via


Step 11: Run Your Program and Try Other Features

Your program is finished and ready to run. You can run your program and set the background color. To learn more, try to improve the program by changing the color of the form, customizing the buttons and check box, and changing the properties of the form.

link to videoFor a video version of this topic, see Tutorial 1: Create a Picture Viewer in Visual Basic - Video 5 or Tutorial 1: Create a Picture Viewer in C# - Video 5.

To run your program and set the background color

  1. Press F5 or click the Start Debugging toolbar button.

  2. Before you open a picture, click the Set the background color button. The Color dialog box opens.

    Color dialog box

    Color dialog box

  3. Select a color to set the PictureBox background color. Look closely at the backgroundButton_Click() method to understand how it works.

    Note

    You can load a picture from the Internet by pasting its URL into the Open File dialog box. Try to find an image with a transparent background, so your background color shows.

  4. Click the Clear the picture button to make sure it clears. Then, exit the program by clicking the Close button.

To try other features

  • Change the color of the form and the buttons using the BackColor property.

  • Customize your buttons and check box using the Font and ForeColor properties.

  • Change your form's FormBorderStyle and ControlBox properties.

  • Use your form's AcceptButton and CancelButton properties so that buttons are automatically clicked when the user presses the ENTER or ESC key. Make the program open the Open File dialog box when the user presses ENTER and close the box when the user presses ESC.

To continue or review