Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Arrow labels (Read 2165 times)
mike
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 2
Joined: Oct 14th, 2005
Arrow labels
Oct 18th, 2005 at 5:57pm
Print Post  
Sort of following on from my previous question (node + label and layout), I just cant seem to get the following to work.  I want to have a box attached to the end (or center) of an arrow so I use the following...

Box labelbox = null;
labelbox= Map.CreateBox(5, 5, 30, 10); // dont care where it goes for now
labelbox.Locked = true;
labelbox.IgnoreLayout = true;
labelbox.Text = str;
labelbox.FitSizeToText();

Group grp = Map.CreateGroup(currentarrow);
grp.AutoDeleteItems = true;
grp.AttachToArrowPoint(labelbox, 1);


So, the label box gets created fine, and it's attached to the arrow because when the arrow moves, so does the text, but it's no-where near the end of the arrow.

Thanks in advance for your help as always.

Cheers,
Mike.

PS. I am using KeepGroupLayout as well :)
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Arrow labels
Reply #1 - Oct 19th, 2005 at 4:35am
Print Post  
When you call the AttachTo method, the group saves the initial distance between the box and the arrow. Afterwards, that distance is preserved when the arrow point is moved by moving the box by the same dx,dy offset. So that line:

labelbox= Map.CreateBox(5, 5, 30, 10); // dont care where it goes for now

should become something like

PointF pt = currentarrow.ControlPoints[1];
labelbox= Map.CreateBox(pt.X-15, pt.Y-5, 30, 10);

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