Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Customizing PrintOptions (Read 2408 times)
Aaron
YaBB Newbies
*
Offline


Looking for support

Posts: 44
Joined: Nov 9th, 2007
Customizing PrintOptions
Nov 15th, 2007 at 5:34am
Print Post  
Hi, I'm using FlowChart.NET 4.3.1

What I want to do is add an object to the flowchart whenever the user wants to print it, some sort of header table. What I'm doing now is catching the PrintPage event of the PrintDocument and adding the object to the chart before printing. Which works fine.

However, when I scale to page, I would like it to be scaled without taking into account the added object. I was going to do this by inheriting the "PrintPreviewForm" class, but that class is internal so I can't modify the behavior. Second thing I tried was inheriting first the FlowChart and then PrintOptions, to customize the ScaleToPage() method. But PrintOptions is sealed.

Is there a good reason why it is sealed? (I might change that, having the source code and a license, but I'd prefer not to.)

Does anybody know an alternative way of achieving my goal that I haven't thought of?

Thanks!
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Customizing PrintOptions
Reply #1 - Nov 15th, 2007 at 7:29am
Print Post  
Hi,

You could use the Graphics argument that is passed to PrintPage to draw the header table yourself. E.g. call the DrawLine method of Graphics to draw the cell borders and DrawString to draw the cells' text.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Aaron
YaBB Newbies
*
Offline


Looking for support

Posts: 44
Joined: Nov 9th, 2007
Re: Customizing PrintOptions
Reply #2 - Nov 15th, 2007 at 11:57am
Print Post  
Thanks for the reply. Using the Graphics object would have made it difficult to move the chart down, as parts might have been cut of I think (no new page is made when you draw further than the first page...).

Nonetheless, I've found a different solution that is most convenient. In the PrintPage event, I check to see if the Scale value of my chart is 100. If it is not, then I'm asuming "Scale To Page" was pressed (as I don't allow users to zoom, this can only happen with the scale to page).

If it is not scaled, I just do what I did before. I remove the header (if present), I pull down the chart (select all and move down) and draw a header on top.

If it is scaled to page however, I remove my header (which is always drawn by default on the print preview), recall fc.PrintOptions.ScaleToPage() and then I redraw the header with the correct sizes again.

This makes the header the same size on the paper in any case.

It doesn't work as well when you change to landscape from portrait... but for now I'm happy with this workable result.

(Incidently, is there any documentation on here about compiling and using the FlowChart.NET source code? I was failing pretty bad at that ...)
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Customizing PrintOptions
Reply #3 - Nov 15th, 2007 at 4:38pm
Print Post  
We've made the FC.NET version 5 solution easier to build. For the old version, try the following:

1) remove the current flowchart.net.dll references from all projects
2) use the "add reference" command and select FlowChart.NET in the Project tab, for all dependent projects
3) set the reference paths of the projects to a folder where mindfusion.common.dll and mindfusion.pdf.dll are located

Now the Rebuild All command should rebuild the project without problems.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint