Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Printing a diagram: How to change the font of the header (Read 4373 times)
Jan Meyer
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 23
Joined: Feb 26th, 2012
Printing a diagram: How to change the font of the header
Aug 14th, 2012 at 9:15am
Print Post  
How can I change the font of the header text cause the font size is too big. I thought that DiagramView.setFont() might help, but it doesn't.

Is there something like PrintOptions.setHeaderFont()

Regards,
Jan
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Printing a diagram: How to change the font of the header
Reply #1 - Aug 14th, 2012 at 12:27pm
Print Post  
It cannot be changed at this time. We'll implement a header font property for the next release.

Stoyan
  
Back to top
 
IP Logged
 
Jan Meyer
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 23
Joined: Feb 26th, 2012
Re: Printing a diagram: How to change the font of the header
Reply #2 - Aug 14th, 2012 at 1:54pm
Print Post  
Thanks, that's good news.

May I add a second wish to the list?

It would be most helpful if the Diagram class has a function like

Diagram.setShowPageMargins(PageFormat pageFormat).

Like in excel, simple dotted lines indicating the current page breaks would be a great help for the user to arrange diagram items in a big diagram.

Using the preview then moving some items and invoking the preview again to control than an item would be printed on a specific page is a bit inconvenient.

Regrads
Jan
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Printing a diagram: How to change the font of the header
Reply #3 - Aug 17th, 2012 at 8:18am
Print Post  
At this time you can implement that by drawing page breaks from the DrawBackground event handler:

Code
Select All
public void drawBackground(DiagramEvent e)
{
	Rectangle2D r = diagram.getBounds();
	double unitScale = 25.4 / 72;	// if MeasureUnit is millimeters

	double w = defaultFormat.getImageableWidth() * unitScale;
	double h = defaultFormat.getImageableHeight() * unitScale - 15 * unitScale /* header area */;

	Graphics2D g = e.getGraphics();
	g.setPaint(new Color(128, 128, 128, 100));

	// draw vertical page delimiters
	for (double x = r.getMinX(); x < r.getMaxX(); x += w)
		g.draw(new Line2D.Double(x, r.getMinY(), x, r.getMaxY()));


	// draw horizontal page delimiters
	for (double y = r.getMinY(); y < r.getMaxY(); y += h)
		g.draw(new Line2D.Double(r.getMinX(), y, r.getMaxX(), y));
}; 



You might want to check some boolean flag and not draw the lines when actually printing. Also if your diagrams are large, you could limit line drawing to the e.getVisibleRect() rectangle to avoid unnecessary drawing in the off-screen part of the diagram.

The current 15-points height subtracted for the header area will depend on the header font when we add property for it.

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