Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Shape node text margin (Read 3325 times)
tusharpateluk
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 37
Joined: Sep 3rd, 2008
Shape node text margin
Oct 8th, 2008 at 1:29pm
Print Post  
How can i specify margin in shape node text. I need to show multiple lines in a shape node. When I fire ResizeToFitText() method, shape node text does not look good.

Please let me know what can be done to add margin to the text inside the shape node.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Shape node text margin
Reply #1 - Oct 8th, 2008 at 2:03pm
Print Post  
Text margins are not supported at this time, but you might define text-area for your shape that is slightly smaller than the shape's outline.
  
Back to top
 
IP Logged
 
tusharpateluk
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 37
Joined: Sep 3rd, 2008
Re: Shape node text margin
Reply #2 - Oct 10th, 2008 at 12:46pm
Print Post  
Can you please give me some sample code for the same.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Shape node text margin
Reply #3 - Oct 12th, 2008 at 10:01am
Print Post  
Add this code to the Window_Loaded handler and draw some nodes to see how it works:

Code
Select All
new Shape(
	Shapes.Rectangle.Outline, // reuse the outline definition of Rectangle
	null, // no decorations
	new ElementTemplate[]
	{
		new LineTemplate(5, 5, 95, 95),
		new LineTemplate(95, 5, 95, 95),
		new LineTemplate(95, 95, 5, 95),
		new LineTemplate(5, 95, 5, 5)
	},
	FillRule.EvenOdd, "RectWithTextMargins");

diagram.DefaultShape = Shape.FromId("RectWithTextMargins");
diagram.ShapeText = "test test test test test test test test test ";
diagram.ShapeText += diagram.ShapeText + diagram.ShapeText;
 



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


I love YaBB 1G - SP1!

Posts: 37
Joined: Sep 3rd, 2008
Re: Shape node text margin
Reply #4 - Oct 14th, 2008 at 1:50pm
Print Post  
Thanks for you help. Their is one small change in your code.

new Shape(
Shapes.Rectangle.Outline, // reuse the outline definition of Rectangle
null, // no decorations
new ElementTemplate[]
{
new LineTemplate(5, 5, 95, 5),
new LineTemplate(95, 5, 95, 95),
new LineTemplate(95, 95, 5, 95),
new LineTemplate(5, 95, 5, 5)
},
FillRule.EvenOdd, "RectWithTextMargins");

diagram.DefaultShape = Shape.FromId("RectWithTextMargins");
diagram.ShapeText = "test test test test test test test test test ";
diagram.ShapeText += diagram.ShapeText + diagram.ShapeText;


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