We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Access Text Nodes within a Group

Thread ID:





69855 Nov 14,2007 04:10 PM Nov 15,2007 11:44 AM Windows Forms 2
Tags: Diagram
Martin Szymczak
Asked On November 14, 2007 04:10 PM

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

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

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

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

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.

Martin Szymczak
Replied On November 14, 2007 04:14 PM

...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
'IterateTreeNodesToPrint(originalNode, NewNode)

End Select


... 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.

Administrator [Syncfusion]
Replied On November 15, 2007 11:44 AM

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



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.