Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Problem with ShapeNode.ResizeToFitText (Read 2746 times)
Vladimir Semenov
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 5
Joined: May 12th, 2012
Problem with ShapeNode.ResizeToFitText
May 12th, 2012 at 8:17am
Print Post  
I created simple diagram with several nodes and tried to layout it automaticaly. FlowcharLayout works fine, but resizing nodes to fit text is urgly. None option KeepWidth, KeepHeight works as expected: nodes becomes too narrow. The best results obtained with FitSize.KeepRatio but calling it twice also split words.
What is the best way to automatically resize ShapeNodes to keep complete words inside? 
I assigned text via Text property.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Problem with ShapeNode.ResizeToFitText
Reply #1 - May 14th, 2012 at 6:29am
Print Post  
Try setting node.TextFormat.Trimming = StringTrimming.Word;

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


I Love MindFusion!

Posts: 5
Joined: May 12th, 2012
Re: Problem with ShapeNode.ResizeToFitText
Reply #2 - May 15th, 2012 at 9:05am
Print Post  
Thank you. Actually it was my fault: paddings were incorrect and took all height.
  
Back to top
 
IP Logged
 
Vladimir Semenov
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 5
Joined: May 12th, 2012
Re: Problem with ShapeNode.ResizeToFitText
Reply #3 - May 15th, 2012 at 2:30pm
Print Post  
FitSize.KeepRation works. KeepHeight - doesn't. Are there sample how to use FitSize.KeepHeight option? Currently its results are unpredicatble.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Problem with ShapeNode.ResizeToFitText
Reply #4 - May 15th, 2012 at 5:49pm
Print Post  
ResizeToFitText returns false with KeepHeight if it can't fit the text at all in the current node's height. E.g. if the Text is "line1" + Environment.NewLine + "line2", and the node's height is as big as the font size, it won't be possible to fit both lines without increasing the node's height.

If you need to fit the text as tightly as possible and don't care about maintaining some aspect ratio, you could start with a very large size and call ResizeToFitText twice - once with KeepWidth and next time with KeepHeight.

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


I Love MindFusion!

Posts: 5
Joined: May 12th, 2012
Re: Problem with ShapeNode.ResizeToFitText
Reply #5 - May 16th, 2012 at 7:56am
Print Post  
Wow! It's tricky, but it works!
Thank you very much.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint