Step 3: Set Your Form Properties

Next, you use the Properties window to change the way your form looks.

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

To set your form properties

  1. Be sure you're looking at Windows Forms Designer. In the IDE, click the Form1.cs [Design] tab (or the Form1.vb [Design] tab in Visual Basic).

  2. Click anywhere inside the form to select it. Look at the Properties window, which should now be showing the properties for the form. Forms have various properties. For example, you can set the foreground and background color, title text that appears at the top of the form, size of the form, and other properties.

    Note

    If the Properties window doesn't appear, stop your program by clicking the square Stop Debugging button (or just close the window).

  3. After the form is selected, scroll down to the bottom of the Properties window, and find the Text property. Click Text, type Picture Viewer, and then press ENTER. Your form should now have the text Picture Viewer in its title bar, and the Properties window should look like the following picture.

    Properties window

    Properties window

    Note

    Properties can be ordered by a Categorized or Alphabetical view. You can switch between these two views by using the buttons on the Properties window. In this tutorial, it's easier to find properties through the Alphabetical view.

  4. Go back to Windows Forms Designer. Click the form's lower-right drag handle, which is the small white square in the lower-right of the form and appears as follows.

    Drag handle

    Drag handle

    Drag it to resize the form so the form is wider and a bit taller.

  5. Look at the Properties window, and notice that the Size property has changed. The Size property changes each time you resize the form. Try dragging the form to resize it to a form size of approximately 550, 350, which should work well for this project.

  6. Run your program again. Press the F5 key or click the Start Debugging toolbar button, which appears as follows.

    Start Debugging toolbar button

    Start Debugging toolbar button

    Just like before, the IDE builds and runs your program, and a window appears.

  7. Before going to the next step, stop your program, because the IDE won't let you change your program while it's running.

To continue or review