|
[quote author=Stoyo link=1240216596/0#3 date=1240406869]Create links to tables without specifying anchor points; first connect them to a specific row, and set the OriginAnchor/DestinationAnchor only after that.
I hope that helps, Stoyan[/quote] Hi, I want to add links to anchorpoints in tablenodes programmitacally after creating two tables (also programmatically). I tried different codes but didn't get it working, so I searched for a solution in the forum and found this thread. I tried to add a link from Table2-Output (row0) to Table1-Input (row0) using your solution but the link still goes from Table2-Output2 (row1).
When I deselect the table, the link is hidden. Is there any solution to show the link always? When I select one table and delete it by pressing the "Del"-Key the link is still available but should be deleted also.
Do you have any solution for it? Maybe you can provide a sample or correct my code.
Thanks a lot. [code] Dim rh As Single = diaSystem.TableRowHeight Dim th As Single = diaSystem.TableCaptionHeight Dim totalh As Single = th + (1 + 1) * rh Dim totalh2 As Single = th + (2 + 1) * rh
Dim t1 As TableNode = diaSystem.Factory.CreateTableNode(5, 5, 30 + 2 * rh, totalh) Dim t2 As TableNode = diaSystem.Factory.CreateTableNode(5, 5, 30 + 2 * rh, totalh2)
' set table properties t1.RowCount = 1 t1.ColumnCount = 4 t1.Scrollable = False t1.EnabledHandles = AdjustmentHandles.Move t1.CellFrameStyle = CellFrameStyle.None t1.HandlesStyle = HandlesStyle.HatchHandles3 t1.Columns(0).Width = rh t1.Columns(3).Width = rh t1.Columns(1).Width = 15 t1.Columns(2).Width = 15 t1.Style = TableStyle.RoundedRectangle t1.CaptionColor = Color.White
t2.RowCount = 2 t2.ColumnCount = 4 t2.Scrollable = False t2.EnabledHandles = AdjustmentHandles.Move t2.CellFrameStyle = CellFrameStyle.None t2.HandlesStyle = HandlesStyle.HatchHandles3 t2.Columns(0).Width = rh t2.Columns(3).Width = rh t2.Columns(1).Width = 15 t2.Columns(2).Width = 15 t2.Style = TableStyle.RoundedRectangle t2.CaptionColor = Color.White
' set connection points Dim ptin_t1 As New AnchorPoint(50, 50, True, False, Color.Red, 0) Dim ptout_t1 As New AnchorPoint(50, 50, False, True, Color.Red, 3) Dim ptin_t2 As New AnchorPoint(50, 50, True, False, Color.Red, 0) Dim ptout_t2_1 As New AnchorPoint(50, 50, False, True, Color.Red, 3) Dim ptout_t2_2 As New AnchorPoint(50, 50, False, True, Color.Red, 3)
Dim al_t1 As New ArrayList Dim al_t2_row0 As New ArrayList Dim al_t2_row1 As New ArrayList
'Table with 1 Input and 1 Output t1.Caption = "Table 1" 'Row 0 - Input al_t1.Clear() t1(0, 0).ImageAlign = ImageAlign.Center t1(0, 0).Image = images.Images(0) t1(1, 0).Text = "Input" al_t1.Add(ptin_t1) t1.Rows(0).AnchorPattern = New AnchorPattern(al_t1.ToArray(GetType(AnchorPoint))) 'Row 0 - Output t1(3, 0).ImageAlign = ImageAlign.Center t1(3, 0).Image = images.Images(1) t1(2, 0).Text = "Output" t1(2, 0).TextFormat.Alignment = StringAlignment.Far al_t1.Add(ptout_t1) t1.Rows(0).AnchorPattern = New AnchorPattern(al_t1.ToArray(GetType(AnchorPoint)))
'Table with 1 Input and 2 Outputs t2.Caption = "Table 2" 'Row0 - Input al_t2_row0.Clear() t2(0, 0).ImageAlign = ImageAlign.Center t2(0, 0).Image = images.Images(0) t2(1, 0).Text = "Input" al_t2_row0.Add(ptin_t2) t2.Rows(0).AnchorPattern = New AnchorPattern(al_t2_row0.ToArray(GetType(AnchorPoint))) 'Row0 - Output t2(3, 0).ImageAlign = ImageAlign.Center t2(3, 0).Image = images.Images(1) t2(2, 0).Text = "Output" t2(2, 0).TextFormat.Alignment = StringAlignment.Far al_t2_row0.Add(ptout_t2_1) t2.Rows(0).AnchorPattern = New AnchorPattern(al_t2_row0.ToArray(GetType(AnchorPoint))) 'Row1 - Output al_t2_row1.Clear() t2(3, 1).Image = images.Images(1) t2(2, 1).Text = "Output 2" t2(2, 1).TextFormat.Alignment = StringAlignment.Far al_t2_row1.Add(ptout_t2_2) t2.Rows(1).AnchorPattern = New AnchorPattern(al_t2_row1.ToArray(GetType(AnchorPoint)))
'Create DiagramLink and set to specific row of the tables Dim DL As New DiagramLink(diaSystem, t2, t1) t1.Rows(0).IncomingLinks.Add(DL) t2.Rows(0).OutgoingLinks.Add(DL)
DL.OriginAnchor = 0 DL.DestinationAnchor = 0 [/code]
|