Xtreme Visual Basic Talk

Xtreme Visual Basic Talk (http://www.xtremevbtalk.com/)
-   Code Library (http://www.xtremevbtalk.com/code-library/)
-   -   MCL Print Form Helper component (http://www.xtremevbtalk.com/code-library/279707-mcl-print-form-helper-component.html)

Merrion 02-15-2007 08:48 AM

MCL Print Form Helper component
1 Attachment(s)
One of the most common questions is "how can I print / print preview my form"? This is quite easily done by getting the form to "draw itself" on the printed page but this is often unsatisfactory because:
* The location of components on the form may not be where you want them on the printed page
* Text is drawn at screen resolution
* Every control is drawn (e.g. buttons, the form border etc.)

The attached component addresses the problem in a different manner.
What you do is drop a FormPrintHelperComponent component onto your form an it extends each control with a bunch of new properties (look in the properties window for each control in the section named "MCL Form Print Helper"). You then set these to indicate:
* Whether the control should be printed
* Whether to print it as Text, Image or Owner Drawn
* The boundary rectangle to print it in
* The vertical / horizontal alignment within that area
* Font and background/foreground colour to use etc.

You can then preview the result in design time (the component has a smart tag menu) and preview or print it at run time.

Additionally if you set the print mode for a control to be "owner drawn" the control will raise an event when the form is being printed to allow you to print the form however you feel ...

(This is an early release - I'm going to add the niceties of grid printing and multi-page printing etc. at a later release)

Merrion 05-08-2007 11:13 AM

New release - now has a PageSetup and PrinterSettings method which brings up the respective dialog boxes to allow the user to view or change the page and priunter settings at run time.

Merrion 06-13-2007 11:02 AM

New release with multi page printing - basically you can decide at design time how many logical pages to turn your form into and then use the extended properties on each control to set which page(s) it prints on.

Options are:
  • Print on every page
  • Print on odd pages
  • print on even pages
  • print on selected pages - whioch in turn has an array of boolean that you set to True for the page you want to print the control on.

Merrion 06-19-2007 02:48 PM

PM with response that might be of interest to others...


first of all i would like to say that I'm pretty impressed by the program :)

I have two (probably simple) questions:

1. Is it possible to create multiple pages when there is only one form in the project?

I have a program with only one form but I would like to make a 2 page report from items on the form.

2. How can I put a certain control on a page?
From the website: "print on selected pages - which in turn has an array of boolean that you set to True for the page you want to print the control on."

Where and how to set this?

Thanks in advance,

Yes you can - first you need to set the "LogicalPages" property of the component to 2.

Then select the controls you want printed on just the first page and set the multi page print mode to :
PrintOnSelectedPages and select the PrintOnPages property set the first to true and the second to false - thus the control will only print on page one.

And the converse for the controls you only want on the second page.

Of course any controls you want on all pages you can set to the multi page print mode: PrintOnAllPages

Hope this helps,

Merrion 10-12-2007 07:03 AM

1 Attachment(s)
New release - added RichTextBoxPrintMethod which allows you to print a rich text box either (a) as just the text content or (b) using the rich text box API to generate what-you-see-is-what-you-get printing.

Merrion 05-07-2008 02:04 AM

A couple of video demos:

1. Adding a reference to the component

2. Setting the RTF print mode

3. Showing gridlines on preview to help layout controls

All times are GMT -6. The time now is 07:55 AM.

Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
Search Engine Optimisation provided by DragonByte SEO v2.0.15 (Lite) - vBulletin Mods & Addons Copyright © 2018 DragonByte Technologies Ltd.
All site content is protected by the Digital Millenium Act of 1998. Copyright©2001-2011 MAS Media Inc. and Extreme Visual Basic Forum. All rights reserved.
You may not copy or reproduce any portion of this site without written consent.