ComponentOne VSView 8.0
Step 6: Final touches

Our sample project is almost done. We will finish it with a little more code to initialize the form caption when the program starts and to make the control resize when the form is resized. Here is the code:

Example Title
Copy Code
Private Sub Form_Load()

 

  ' initialize form caption

  ShowCaption

 

End Sub

When the form loads, we call the SetCaption routine defined earlier.

Example Title
Copy Code
Private Sub Form_Resize()

 

  On Error Resume Next

  With vp

    .Move .Left, .Top, _

           ScaleWidth - 2 * .Left, _

           ScaleHeight - .Top - .Left

  End With

 

End Sub

This is the resizing code. Note the error handling to prevent errors in case the user makes the form extremely small and some of the calculated dimensions become negative.

That's it. The QuickPrinter application is done. Run it and pick a few files. Don't forget to try some RTF and HTML files. Here's a snapshot of the final application in action:

If you want a challenge, extend QuickPrinter so it lets you choose the font, header, footer, number of columns, or select several files for printing at once.

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback