How to Print VB Form Borders and Menus

ID: Q80409


The information in this article applies to:


SUMMARY

The methods to print a form provided by Visual Basic print only the client area, not the non-client area of a form. This is a design feature of Visual Basic. The client area of a form includes the form's controls and picture. The non-client area includes the form's borders and menus, which cannot be printed directly from Visual Basic.

To print both the client and non-client areas of a form, copy an image of the form into the Clipboard, paste it into a graphics editor such as Paintbrush, and print. Two methods for this procedure are provided below.


MORE INFORMATION

The Print option from the File menu, and the Visual Basic statement [form.]PrintForm only print the client area of a form. The client area includes the form's picture and controls. Both methods of printing do not print the non-client area, which includes the form's title bar, Minimize and Maximize buttons, borders and menus. To print both the client and non-client areas, you must print the form from an application outside of Visual Basic. If you want to print a form that either

then use Method 1 below to print the form.

If you want to print a form that contains submenus in their pulled-down state, use Method 2 below.

Method 1

To print a form without pulled-down submenus, do the following:
  1. From the Visual Basic editing environment, create the form you want to print. Include all controls, titles, menus, pictures, borders, and so on that you want to print, and size them appropriately.


  2. Set focus to the form you want to print.


  3. Press ALT+PRINT SCREEN. This key combination is an operation in Windows that copies the active window (your form in this case) to the Windows Clipboard.


  4. From the Windows Program Manager, launch Paintbrush (or the graphics editor of your choice) and maximize it.


  5. From the Paintbrush Edit menu, choose Paste. The image of your form should appear in Paintbrush. If the form is too large for Paintbrush, try either a larger screen resolution (such as 800-by-600 or 1024-by-768), another editor with a larger work screen, or slightly decrease the size of your form for the printing process.


  6. Once the form is correctly pasted into Paintbrush, from the File menu, choose Print to print it.


Method 2

To print a form with pulled-down submenus, do the following:
  1. In the Visual Basic editing environment, create the form you want to print. Include all controls, titles, menus, pictures, borders, and so on that you want to print and size them appropriately.


  2. Set focus to the form to be printed.


  3. Move the form to the upper left corner of the screen. When the Clipboard pastes its image into Paintbrush, it starts at the upper left corner. If the image is too large for the Paintbrush edit screen, the image is truncated on the right and bottom edges. Placing the form in the upper left corner helps to ensure that the full form fits into Paintbrush.


  4. Choose the menu option you want to be pulled down when the form is printed. The menu option should appear pulled down on the screen. Only one menu option can be pulled down at a time, but submenu options can be selected.


  5. Press SHIFT+PRINT SCREEN. This keystroke is an option in Windows that copies an image of the entire screen into the Windows Clipboard. When the pull-down menus are open, Visual Basic traps the ALT key and closes the menus, thus making the ALT+PRINT SCREEN keystroke in Method 1 ineffective when printing pull-down menus on a form.


  6. From Program Manager, launch Paintbrush (or the graphics editor of your choice) and maximize it.


  7. From the Paintbrush Edit menu, choose Paste. Your form should appear in Paintbrush. If the form is too large for Paintbrush, try either a larger screen resolution (for example, 800-by-600 or 1024-by-768), another editor with a larger work screen, or slightly decrease the size of your form for the printing process.


  8. Using one of the cutting tools at the top of the Paintbrush toolbox, outline your form.


  9. From the Edit menu, choose Copy. This places the graphics area contained in the cutting region into the Clipboard.


  10. From the File menu, choose New to bring up a new editor screen. A dialog box will appear to ask if you want to save the current image. You will need to select Yes or No before a new editor screen will appear.


  11. Once the editor screen is empty, from the Edit menu, choose Paste to paste your form into the editor.


  12. From the File menu, choose Print to print the image.


Additional query words: 2.00 3.00


Keywords          : 
Version           : 
Platform          : 
Issue type        : 

Last Reviewed: June 18, 1999