AnsweredAssumed Answered

vrf Windows Forms Controls - PrintPreviewControl

Question asked by VRFuser on Aug 21, 2006
> There is no example about using PrintPreviewControl in VEEPro 7.52!

Well according to the browser, the Document prop's type is System.Drawing.Printing.PrintDocument. The SDK says:

"Typically, you create an instance of the PrintDocument class, set the properties that describe how to print, and call the Print method to start the printing process. Handle the PrintPage event where you specify the output to print, by using the Graphics included in the PrintPageEventArgs."

This more or less mimics the standard printing process (at the Win32 API level). IOW, you have to render the page (manually) in the PrintPage event.
This is probably a lot more trouble than it's worth - although admittedly I don't know squat about rendering in dotNET. I suspect it also mimics the standard rendering process: You draw the output directly on a device context.

The SDK has further instruction:

"Use the PrintPageEventArgs.Graphics property to specify the output to print. If you are printing a text file, use StreamReader in the following
manner: read one line at a time from the stream and call the DrawString method to draw the line in the graphics object. For more information on this process, see the Graphics and StreamReader classes."

The Graphics object also has a DrawImage function to render images. Rest assured you'll be responsible for placing components, specifying margins, making sure text does not overprint graphics, etc. (rendering is a *really* tedious thing).

It's probably a lot easier to write RTF to a RichText control. Depending on just what it is you want to display, it's probably easier still to use an Automation capable targeted application, like Word or Excel (or Corel Draw or whatever).
-SHAWN-


---
To subscribe please send an email to: "vrf-request@lists.it.agilent.com" with the word subscribe in the message body.
To unsubscribe send a blank email to "leave-vrf@it.lists.it.agilent.com".
To send messages to this mailing list,  email "vrf@agilent.com". 
If you need help with the mailing list send a message to "owner-vrf@it.lists.it.agilent.com".
Search the "unofficial vrf archive" at "www.oswegosw.com/vrf_archive/".

Outcomes