Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic LinkLabel position (Read 1364 times)
Steve_VG
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 10
Joined: May 21st, 2013
LinkLabel position
Aug 7th, 2013 at 7:15am
Print Post  
Hi,

I am exporting my diagram to visio, and am needing to replace my LinkLabels with ShapeNodes containing the label text for the export. I want to place the ShapeNodes at the same location as the LinkLabels however I cannot find a way to get this information.

How do I find the location, either PointF or RectangleF of a LinkLabel?

Thanks,

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


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: LinkLabel position
Reply #1 - Aug 7th, 2013 at 8:04am
Print Post  
Hi,

It seems you can get it only through the inplace-edit interface method GetEditRect, which returns the rectangle inflated by Font.Size to give it enough space for an extra text line. You could deflate it back by the font size to get the original rectangle:

Code
Select All
foreach (var label in link.Labels)
{
	var labelRect = label.GetEditRect(link, PointF.Empty);
	labelRect.Inflate(-link.EffectiveFont.Size, -link.EffectiveFont.Size);

	var replacement = tempDiag.Factory.CreateShapeNode(labelRect);
	replacement.Transparent = true;
	replacement.Text = label.Text;
	replacement.Font = link.EffectiveFont;
	replacement.TextFormat = new StringFormat();
} 



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