Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic TextPadding and ResizeToFitText issue (Read 2681 times)
jlj30
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 183
Joined: Sep 4th, 2011
TextPadding and ResizeToFitText issue
Nov 6th, 2012 at 10:28pm
Print Post  
Hi,

I am successfully using ResizeToFitText, but I'd like some padding at either the right or left side of the text.
I've tried placing the TextPadding before and after the ResizeToFitText without luck.

Any ideas on how I can get the padding I'm looking for.
See attached screenshot.
I've also included the code that generates the nodes.
The diagram has a centered TreeLayout applied to it.

Thanks in advance

Jim

Code
Select All
protected ShapeNode createNode(Diagram diagram, String nodeText, Boolean expandable, StringAlignment textAlign)
    {
        Factory factory = diagram.Factory;
        ShapeNode node = factory.CreateShapeNode(0, 0, 100, 10, Shapes.RoundRect);
        node.Text = nodeText;
        node.Font = new Font("Arial", 12, System.Drawing.FontStyle.Bold);
        node.TextFormat.Alignment = textAlign; // Far = right; Near = left
        node.TextFormat.LineAlignment = StringAlignment.Center;
        node.TextFormat.FormatFlags = StringFormatFlags.NoWrap;
        node.Pen.Color = Color.White;
        node.ShadowOffsetX = 0;
        node.ShadowOffsetY = 0;
        node.Brush = new MindFusion.Drawing.SolidBrush(Color.WhiteSmoke);
        node.Expandable = expandable;
        node.TextPadding = new MindFusion.Diagramming.Thickness(10f, 1f, 10f, 1f);
        //node.ResizeToFitText(FitSize.KeepWidth);
        node.ResizeToFitText(FitSize.KeepHeight);
        return node;
    } 

  

NetDiagram_-_ShapeNode_Text_Issues_-_06nov2012.png (Attachment deleted)
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: TextPadding and ResizeToFitText issue
Reply #1 - Nov 7th, 2012 at 11:34am
Print Post  
We haven't implemented text padding in Java. For the time being, set Alignment to Center and text should look correctly padded for your nodes.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
jlj30
Full Member
***
Offline


I love YaBB 1G - SP1!

Posts: 183
Joined: Sep 4th, 2011
Re: TextPadding and ResizeToFitText issue
Reply #2 - Nov 7th, 2012 at 2:16pm
Print Post  
Hi,

Yes, you're right.
Since I am resizing the shape to "fit" the text, using a center'd alignment works as I wanted.

Thanks for pointing out the obvious to me Smiley

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