I need to access nodes that are grouped together. The nodes I need to access are of various types. There is a background rectangle node, a bmp picture in the upper corner, and two text nodes. Think of it as an Org Chart object when all grouped together.
I'm able to cycle through the nodes in the diagram but I can only see my groups and lines.
How do I get access to my 'children'. This part works great.
Here is my construction process.
Private Sub tbAddContact_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tbAddContact.Click
Dim X As Integer = 215
Dim Y As Integer = 50
Dim nodeGroup As Group = New Group()
With nodeGroup
.Name = "nodeGroupContact"
.Tag = "nodeGroupContact"
.DrawPorts = False
.EnableCentralPort = True
.PinPoint = New Point(X, Y)
End With
Dim nodeShape As Syncfusion.Windows.Forms.Diagram.FilledPath = Nothing
nodeShape = New Syncfusion.Windows.Forms.Diagram.RoundRect(0, 0, 200, 60, MeasureUnits.Pixel)
With nodeShape
.Tag = "nodeShapeContact"
.Name = "nodeShapeContact"
.ShadowStyle.Visible = True
.ShadowStyle.OffsetX = 6
.ShadowStyle.OffsetY = 6
.LineStyle.LineColor = Color.SteelBlue
.LineStyle.LineWidth = 2
.FillStyle.Color = Color.WhiteSmoke
.EditStyle.AllowSelect = True
.EnableCentralPort = True
'.PinPoint = New Point(X - 100, Y)
End With
nodeGroup.AppendChild(nodeShape)
Dim nodeNameText As Syncfusion.Windows.Forms.Diagram.TextNode = Nothing
nodeNameText = New Syncfusion.Windows.Forms.Diagram.TextNode("New Contact")
With nodeNameText
.Tag = "nodeNameTextContact"
.Name = "nodeNameTextContact"
.Size = New SizeF(200, 25)
.FontStyle.Style = System.Drawing.FontStyle.Regular
.FontStyle.Family = "Arial"
.FontStyle.Size = 10
.HorizontalAlignment = StringAlignment.Center
.LineStyle.LineColor = Color.Transparent
.PinPoint = New Point(100, Y - 30)
End With
nodeGroup.AppendChild(nodeNameText)
Dim nodeTitleText As Syncfusion.Windows.Forms.Diagram.TextNode = Nothing
nodeTitleText = New Syncfusion.Windows.Forms.Diagram.TextNode("Title")
With nodeTitleText
.Tag = "nodeTitleTextContact"
.Name = "nodeTitleTextContact"
.Size = New SizeF(200, 25)
.FontStyle.Style = System.Drawing.FontStyle.Regular
.FontStyle.Family = "Arial"
.FontStyle.Size = 10
.HorizontalAlignment = StringAlignment.Center
.LineStyle.LineColor = Color.Transparent
.PinPoint = New Point(100, Y)
End With
nodeGroup.AppendChild(nodeTitleText)
Dim nodebmp As BitmapNode = New BitmapNode(CType(Me.pbContact.Image, Bitmap))
With nodebmp
.Tag = "nodebmpContact"
.Name = "nodebmpContact"
.LineStyle.LineColor = Color.Transparent
.PinPoint = New Point(X - 210, Y - 40)
End With
nodeGroup.AppendChild(nodebmp)
nodeGroup.AppendChild(nodeShape)
nodeGroup.AppendChild(nodeNameText)
nodeGroup.AppendChild(nodeTitleText)
nodeGroup.AppendChild(nodebmp)
Me.Diagram1.Model.AppendChild(nodeGroup)
End Sub
My problem is then attempting to cycle through all of the diagram contacts that have been created and access the nodeNameText and nodeTitleText values.
This would be a piece of cake in the world of classic TreeView structures. Traversing hierarchial nodes in a tree is snap.
In the world of Syncfusion, it's not obvious.
MS
Martin Szymczak
November 14, 2007 09:14 PM UTC
...and here is the process I use to cycle through the objects.
The next step is still - how do I get to my Text nodes within the groups?
Please help.
Dim originalNode As Node
For Each originalNode In Me.Diagram1.Model.Nodes
Case "nodeGroupContact"
Dim NewNode As TreeNode = New TreeNode(originalNode.Tag)
NewNode.Name = originalNode.Name
NewNode.Tag = originalNode.Tag
NewNode.Text = originalNode.Name
NewNode.ImageIndex = 28
NewNode.SelectedImageIndex = 28
nodeOrgChartRoot.Nodes.Add(NewNode)
'IterateTreeNodesToPrint(originalNode, NewNode)
End Select
Next
Me.tvOrgChart.ExpandAll()
Me.tvOrgChart.EndUpdate()
... so on and so forth - all building up to converting the diagram to a Tree object
How do I get to my original Text Nodes for this object I found as a "nodeGroupContact"?
Please help.
AD
Administrator
Syncfusion Team
November 15, 2007 04:44 PM UTC
Hi Martin,
Thank you for using syncfusion products.
You can access the child node by using GetChild method.
Please refer the following code snippet.
Dim childNode As Node
For I As Integer = 0 To nodeGroup.ChildCount – 1
childNode = nodeGroup.GetChild(I)
'You can access textnode details here
Next I
Please let me know if this help
Thanks,
Prakash.