Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic How to Create a Box as label attached to Arrow? (Read 1800 times)
Link
Guest


How to Create a Box as label attached to Arrow?
Jan 15th, 2006 at 12:00pm
Print Post  
and Could I specify a ControlPoint or Segmenet which is attached the label box ?
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: How to Create a Box as label attached to Arrow
Reply #1 - Jan 16th, 2006 at 7:22am
Print Post  
You could use a similar function to create a label box attached to a segment:

[code]
Private Function addSegmentLabel(ByVal link As Arrow, ByVal index As Integer) As Box
  Dim pos As PointF
  If link.Style <> ArrowStyle.Bezier Then
    'a segment is defined by 2 points
    Dim pos1 As PointF = link.ControlPoints(index)
    Dim pos2 As PointF = link.ControlPoints(index + 1)
    pos = New PointF((pos1.X + pos2.X) / 2, (pos1.Y + pos2.Y) / 2)
  Else
    'a segment is defined by 4 points
    Dim pos1 As PointF = link.ControlPoints(index * 3 + 1)
    Dim pos2 As PointF = link.ControlPoints(index * 3 + 2)
    pos = New PointF((pos1.X + pos2.X) / 2, (pos1.Y + pos2.Y) / 2)
  End If

  Dim label As Box = flcMain.CreateBox(pos.X - 15, pos.Y - 5, 30, 10)
  label.AttachTo(link, AttachToArrow.Segment, index)
  label.IgnoreLayout = True
  Return label
End Function

[/code]

Optionally set

label.Locked = true

to prevent users from moving the label around and

label.Transparent = true

to specify that only the box text should be visible.

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