Microsoft Visual Basic 2010 Step by Step eBook

(Tina Meador) #1

Chapter 17 Working with Printers 419


Now you’re ready to run the program. Before you do so, you might want to locate a few
graphics files on your system that you can print. (Just jot down the paths for now and type
them in when you test the project .)

Run the Print Graphics program

Tip The complete Print Graphics program is located in the C:\Vb10sbs\Chap17\Print
Graphics folder.


  1. Click the Start Debugging button on the Standard toolbar.


Your program runs in the IDE. You see this form:


  1. Turn on your printer, and then verify that it is online and has paper.

  2. If you installed your sample files in the default C:\Vb10sbs folder, click the Print
    Graphics button now to print the Sun .ico icon graphic.
    If you didn’t use the default sample file location, or if you want to print a different
    artwork file, modify the text box path accordingly, and then click the Print Graphics
    button.
    The DrawImage method expands the graphic to the maximum size your printer can
    produce on one page and then sends the graphic to the printer. (This “expansion
    feature” fills up the page and gives you a closer look at the image .) Admittedly, this
    might not be that interesting for you, but we’ll get more sophisticated in a moment.
    (If you want to modify the location or size of your output, search the Visual Studio
    Help documentation for the “Graphics .DrawImage Method” topic, study the different
    argument variations available, and then modify your program code .)

Free download pdf