Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Custom Print Preview (Read 1286 times)
Achus
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 1
Joined: Sep 5th, 2007
Custom Print Preview
Sep 6th, 2007 at 2:59am
Print Post  
Hi I’m trying to show a print preview of flowchart in an internal tab window.
PrintPreview(), PrintPreviewEx() makes a model popup but this is not what I need.
I need to show the preview using a System.Windows.Forms.PrintPreviewControl.

I tried the following:
Used FlowChart.CreateImage() to create a Bitmap
and use this image to do graphics.DrawImage() inside the PrintDocument.PrintPage
This works but the resolution of the preview/print is not good enough. The built in PrintPreview/Print function makes far better print.
I am assuming this is because the limitation of Bitmap image opposed to vector graphics?
Is there a way get around the problem ???
Thanks in advance Kiss
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Custom Print Preview
Reply #1 - Sep 6th, 2007 at 6:37am
Print Post  
Hi,

That might be possible using the PrintPreviewEx(Form previewForm) overloaded method. Take a look at how it is implemented:

Code
Select All
public void PrintPreviewEx(Form previewForm)
{
	// setup the .NET print document
	PrintDocument doc = new PrintDocument();
	doc.DocumentName = printOptions.DocumentName;
	doc.DefaultPageSettings.Margins = printOptions.Margins;

	printDoc = doc;

	doc.BeginPrint += new PrintEventHandler(BeginPrint);
	doc.PrintPage += new PrintPageEventHandler(PrintPage);

	if (previewForm is IPrintPreview)
		(previewForm as IPrintPreview).Document = doc;
	previewForm.ShowDialog(this);

	doc.PrintPage -= new PrintPageEventHandler(PrintPage);
	doc.BeginPrint -= new PrintEventHandler(BeginPrint);
}
 



You must create a new form that implements IPrintPreview, and whose Document property sets the PrintDocument of the PrintPreviewControl from your tab window. FlowChart.NET will automatically open the form by calling its ShowDialog method, so you will need to close it, e.g. by calling Close from the OnLoad event handler.

I haven't tried if that works. If it doesn't, we could add a new PrintPreview overload that takes a PrintPreviewControl as an argument.

Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint