Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic newbie - how to put arrow inside box (Read 2444 times)
dflux
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 5
Joined: Sep 5th, 2006
newbie - how to put arrow inside box
Sep 5th, 2006 at 4:54pm
Print Post  
Hello. I need to create a legend of arrow types and have wrestled with Anchorp points, etc but no luck. any help is appreciated.

legend will look like:

Arrow type Key
-------------------

strong bind
------->> (ahTriangle)

weak bind
-------> (ahArrow)

no bind
----------- (ahNone)

basically, something that looks similar to
the "Arrow Types" box in the FCDemo

thanks.
  
Back to top
 
IP Logged
 
dflux
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 5
Joined: Sep 5th, 2006
Re: newbie - how to put arrow inside box
Reply #1 - Sep 5th, 2006 at 5:06pm
Print Post  
Btw, I have code that looks like:

    Objbox.SetTextStyle(tsTop);
    Objbox.SetText(_T("Key"));


    ArrowItem keyArrow = m_FlowChartPallete.CreateArrow(Objbox, Objbox);
    keyArrow.SetStyle(asPolyline);
    keyArrow.SetText(_T("High"));
    keyArrow.SetArrowHead(ahTriangle);

THe result is a box with a centered arrow (on top of
box), beginning and ending from the same point.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: newbie - how to put arrow inside box
Reply #2 - Sep 6th, 2006 at 6:33am
Print Post  
One way you could do that is by using two Transparent boxes inside the legend box and create the arrows between them. Another way is by using anchor points as shown below.

Code
Select All
' define the legend box points where the arrows should connect
Dim legendAnchors As New AnchorPattern
legendAnchors.AddAnchorPoint 5, 25, True, True, msCircle, vbRed
legendAnchors.AddAnchorPoint 95, 25, True, True, msCircle, vbRed
legendAnchors.AddAnchorPoint 5, 50, True, True, msCircle, vbRed
legendAnchors.AddAnchorPoint 95, 50, True, True, msCircle, vbRed
legendAnchors.AddAnchorPoint 5, 75, True, True, msCircle, vbRed
legendAnchors.AddAnchorPoint 95, 75, True, True, msCircle, vbRed
legendAnchors.AddAnchorPoint 5, 25, True, True, msCircle, vbRed
legendAnchors.PatternId = "legend"

Dim labels(3) As String
labels(0) = "strong bind"
labels(1) = "weak bind"
labels(2) = "no bind"

Dim shapes(3) As EArrowHead
shapes(0) = ahTriangle
shapes(1) = ahArrow
shapes(2) = ahNone

' create the legend box
Dim legendBox As box
Set legendBox = fcx.CreateBox(50, 50, 200, 200)
legendBox.AnchorPattern = legendAnchors

' create the legend arrows
Dim legendArrow As arrow
Dim i As Integer
For i = 0 To 2
    Set legendArrow = fcx.CreateArrow(legendBox, legendBox)
    legendArrow.Text = labels(i)
    legendArrow.ArrowHead = shapes(i)

    ' clear any anchor points chosen by CreateArrow
    legendArrow.OrgnAnchor = -1
    legendArrow.DestAnchor = -1

    ' specify anchor points from the pattern define above
    legendArrow.OrgnAnchor = i * 2
    legendArrow.DestAnchor = i * 2 + 1

    ' reflexive arrows are created as Bezier
    ' so align their middle control points to the end points
    legendArrow.CtrlPtY(1) = legendArrow.CtrlPtY(0)
    legendArrow.CtrlPtY(2) = legendArrow.CtrlPtY(0)
    legendArrow.Update
Next i
 



It seems the control does not let you to create a reflexive "polyline" arrow that has only one segment, so the code above just uses the default Bezier style and aligns the middle points to the end points.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
sdflux
Guest


Re: newbie - how to put arrow inside box
Reply #3 - Sep 6th, 2006 at 10:28am
Print Post  
thanks for the help;  I'll
give the anchor point method a
try in c++

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