Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic DiagramLink between two specific cells (Read 1515 times)
marie
Full Member
***
Offline



Posts: 147
Joined: Nov 11th, 2008
DiagramLink between two specific cells
Jan 7th, 2009 at 4:55pm
Print Post  
Hi,

I have tableNodes with 2 anchorpoints on each row. Those anchorpoints allow both incoming & outgoing links:
Code
Select All
AnchorPoint ptin = new AnchorPoint(50, 50, true, true, Color.Red, 0);
AnchorPoint ptout = new AnchorPoint(50, 50, true, true, Color.Red, 3); 


How can I create a link from a specific cell to another ??? ? I can do this using the User Interface, but I don't know how using code.

I used the Entities sample modifiying the above code and adding a button that does:
Code
Select All
private void button2_Click(object sender, EventArgs e)
{
    TableNode node1 = null, node2 = null;
    foreach (DiagramNode node in this.diagram.Nodes)
    {
        if (node is TableNode)
        {
            if (node1 == null)
                node1 = (TableNode)node;
            else if (node2 == null)
            {
                node2 = (TableNode)node;
                break;
            }
        }
    }

    if (node1 != null && node2 != null)
    {
        // Create link between 2 specific cells
        this.diagram.Factory.CreateDiagramLink(node1, 0, node2, 0);
    }
} 

By default, it uses the column 2 for node1 and column 1 for node2. I would like to specifiy which columns, by example from column 2 to column 2.

Thanks,
Marie
« Last Edit: Jan 8th, 2009 at 5:28pm by marie »  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: DiagramLink between two specific cells
Reply #1 - Jan 7th, 2009 at 8:19pm
Print Post  
Set the link's OriginAnchor and DestinationAnchor properties after creating it.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
marie
Full Member
***
Offline



Posts: 147
Joined: Nov 11th, 2008
Re: DiagramLink between two specific cells
Reply #2 - Jan 8th, 2009 at 5:28pm
Print Post  
Thanks again Stoyo! You're a big help Smiley.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint