Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic GetContentBounds vs. DesiredSize (Read 1916 times)
riemaecker
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 8
Joined: Jul 31st, 2009
GetContentBounds vs. DesiredSize
Aug 19th, 2009 at 10:10am
Print Post  
I had several problems with the implementation of a custom paginator to print the diagram in the past. I first used the DesiredSize of the documentplane, but it always resulted in a blurry print output.
Now, I use GetContentBounds(true,true) (which resolves the problem) and get lightly different sizes. Also setting the "for print" parameter to false or true differ in the result.
Why do I get different sizes from the DesiredSize of the DocumentPlane, GetContentBounds(false,true) and GetContentBounds(true,true) ?
What is the logical explanation?
The ratio between x/y is also sightly different, which leads me to the hypothese that the wrong aspect ratio leads the content of the diagram within the visualbrush to be rasterized by the WPF Print System, resulting in the blurry output.

MindFusionDiagram.GetContentBounds(true,true)
{-75,-75,2505.55905511811,1663.55905511811}
System.Windows.Rect
X/Y Ratio: 1.5061437388768980990586171679491

MindFusionDiagram.GetContentBounds(false,true)
{-58.5590551181102,-58.5590551181102,2489.11811023622,1647.11811023622}
System.Windows.Rect
X/Y Ratio:1.5111958849625211807392204841253


MindFusionDiagram.DocumentPlane.DesiredSize
{2502,1660}
System.Windows.Size
X/Y Ratio:1.5072289156626506024096385542169
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: GetContentBounds vs. DesiredSize
Reply #1 - Aug 19th, 2009 at 12:15pm
Print Post  
DocumentPlane.MeasureOverride simply returns diagram.Bounds.Size, so you are getting as DesiredSize value either what you have assigned to Bounds, or what was automatically calculated by the ResizeToFitItems method.

When you call GetContentBounds with forPrint enabled, it ensure diagram.Bounds.X and Y are included in the returned rectangle. That's done so that if you have placed some items at a specific offset from the diagram origin, they would be printed with the same offset relatively to the origin of the first page.

GetContentBounds(false) returns the union of the bounding rectangles of all items.

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


I love YaBB 1G - SP1!

Posts: 8
Joined: Jul 31st, 2009
Re: GetContentBounds vs. DesiredSize
Reply #2 - Aug 20th, 2009 at 7:13am
Print Post  
Thanks for your reply.

In this case, shouldn't  MindFusionDiagram.DocumentPlane.DesiredSize and  MindFusionDiagram.GetContentBounds(false,true) be the exact same value?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: GetContentBounds vs. DesiredSize
Reply #3 - Aug 20th, 2009 at 8:03am
Print Post  
In our opinion most people would want to set the diagram size (its scrollable area) to be larger than the area occupied by items, and this is done by setting Diagram.Bounds. Eg. the user might start drawing from an empty diagram, and if DesiredSize returns Size(0,0) when there are no items, you wouldn't even have where to draw new elements. DesiredSize returns the Bounds value, so if you want it to be the same as the content size, just set Bounds = GetContentBounds().

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