Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Attaching one node to another (Read 1832 times)
jcollins@scires
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 53
Joined: Feb 17th, 2009
Attaching one node to another
Feb 19th, 2009 at 7:22pm
Print Post  
Hello, I am trying to attach one small newly created node to a parent node. I do this on postback as follows:

Protected Sub btnAttachIssue_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAttachIssue.Click
       If diagView.Diagram.Selection.Nodes.Count = 1 Then
           Dim oNode As DiagramNode

           Dim oSelNode As DiagramNode
           oSelNode = diagView.Diagram.Selection.Nodes(0)
           oNode = diagView.Diagram.Factory.CreateShapeNode(0, 0, 2, 2)
           oNode.Pen.Color = Drawing.Color.Yellow
           oNode.AttachTo(oSelNode, AttachToNode.BottomLeft)
       End If
    End Sub


However, the child node always seems to position itself at (0,0) and not at the bottom left of the parent node. It seems the AttachToNode.BottomLeft specification never gets taken into account. Do I have to specify the cooridinates for this child node in relation to the parent? If so, what does the atttype do exactly? Thanks.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Attaching one node to another
Reply #1 - Feb 19th, 2009 at 7:42pm
Print Post  
AttachTo does not move the node to the specified corner. It records the original distance between this node and the specified corner of the parent node, and when the parent is moved or resized, the attached node is offset to preserve that distance. This works similar to the Anchor property in Windows Forms.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint