Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Method AttachTo (Read 1592 times)
alesdario
Junior Member
**
Offline



Posts: 71
Joined: Mar 7th, 2007
Method AttachTo
Mar 7th, 2007 at 8:05am
Print Post  
When i use the method AttachTo, i use this contructor:
AttachTo(Arrow arrow, AttachToArrow attType,int index).

Can yuo explain me what is index?

Tanks.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Method AttachTo
Reply #1 - Mar 7th, 2007 at 9:23am
Print Post  
Depending on the attachType argument, the index value refers either to the index of an arrow segment, or to the index of a control point.

If your arrows have only one segment, you can calculate its center like this:

PointCollection pts = arrow.ControlPoints;
PointF center = new PointF((pts[0].X + pts[1].X) / 2, (pts[0].Y + pts[1].Y) / 2);

Then create a box at the centerPoint location so the image center point coincides with the arrow center:

Box imgBox = fc.CreateBox(center.X - imgSize / 2, center.Y - imgSize / 2, imgSize, imgSize);
imgBox.Image = ...;
imgBox.Transparent = true;

Finally attach to the only arrow segment:

imgBox.AttachTo(arrow, AttachToArrow.Segment, 0);

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
alesdario
Junior Member
**
Offline



Posts: 71
Joined: Mar 7th, 2007
Re: Method AttachTo
Reply #2 - Mar 7th, 2007 at 11:30am
Print Post  
very tanks.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint