Sep 3, 2008 at 1:08 AM
Edited Sep 3, 2008 at 7:11 AM
I'm afraid I can't get your code to compile, and it's not clear to me what the code is doing. Among other things, if "NetworkMapper" is the name of your NetMapControl instance, then it doesn't have a property or method called "oVertices".
Or is NetworkMapper something else?
In any case, the code is complicating something that is actually quite simple. Here is the sample code translated to VB.NET, which works fine on my machine:
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
' The default vertex drawer draws all vertices with the same
' color, radius, and shape. Replace it with one that will vary
' the appearance of each vertex based on metadata values stored in
' the vertices.
NetMapControl1.VertexDrawer = New PerVertexWithLabelDrawer()
' Replace the default edge drawer with one that will vary the color
' and width of each edge based on metadata values stored in the edges.
NetMapControl1.EdgeDrawer = New PerEdgeWithLabelDrawer()
' Get the graph's vertex collection.
Dim oVertices As IVertexCollection
oVertices = NetMapControl1.Graph.Vertices
' Add three vertices.
Dim oVertexA, oVertexB, oVertexC As IVertex
oVertexA = oVertices.Add()
oVertexB = oVertices.Add()
oVertexC = oVertices.Add()
' Change the color, radius, and shape of vertex A.
' Draw vertex B as a primary label instead of a shape. A primary
' label is a box containing text.
' Set the primary label's text and fill colors.
' Add a secondary label to vertex C. A secondary label is text that
' is drawn outside the vertex. It can be added to a shape, image, or
' primary label.
' Get the graph's edge collection.
Dim oEdges As IEdgeCollection
oEdges = NetMapControl1.Graph.Edges
' Connect the vertices with directed edges.
Dim oEdge1, oEdge2, oEdge3 As IEdge
oEdge1 = oEdges.Add(oVertexA, oVertexB, True)
oEdge2 = oEdges.Add(oVertexB, oVertexC, True)
oEdge3 = oEdges.Add(oVertexC, oVertexA, True)
' Customize their appearance.