Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Text padding (Read 1185 times)
jf2020
Junior Member
**
Offline


I love FlowChart!

Posts: 63
Joined: Feb 23rd, 2006
Text padding
Jun 3rd, 2010 at 5:50am
Print Post  
Good morning,

I'm using rectangular ShapeNodes to create let the user create text areas on the diagram. I'm trying to achieve the same behavior for those text areas than in PowerPoint.
My first question is about text padding. If the user sets text align left, the text is drawn right next to the border and the look is not so great so I need to have some padding. I have been thinking of using  the text Area definition, but as it is in percent, the padding width will vary when the user resizes the node. At that time I could recompute the size of the text area but is there's a simpler way to achieve this?

JF
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Text padding
Reply #1 - Jun 3rd, 2010 at 8:08am
Print Post  
Hi,

Our developers have recently added a TextPadding property to the WPF version; we'll try to port it to Windows Forms for the next release.

Now you could implement that by custom-drawing the text inside the rectangle returned by RectangleF.Inflate(node.Bounds, -padding, -padding). E.g. you could create a custom node type TextNode and call that from its Draw implementation. Or use ShapeNodes with their CustomDraw property set to Additional and handle the DrawNode event.

Another option is to display the text inside a Transparent ShapeNode attached to the main node using the AttachTo(GroupAnchorStyles) overloaded method, anchored to all sides of the main rect with initial offset from them set to the padding value.

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