Problem: Legend layer name and checkboxes do not display correctly when using VB .NET with MapObjects


When using VB .NET with MapObjects for the display legend control, the legend layer name and checkboxes do not display correctly.


References are not passed correctly.

Solution or Workaround

Select an option from below.

  • Use the GetOCX method. Call AxMap1.CtlRefresh() within AfterSetLayerVisible event when passing a reference to one wrapped COM .OCX to a member on another wrapped COM .OCX in .NET, such as when calling SetMapSource on the Legend and pass the Map control:

    Private Sub Form1_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
    End Sub

    Private Sub Axlegend1_AfterSetLayerVisible(ByVal sender As Object, ByVal e As AxSampleLegendControl.__legend_AfterSetLayerVisibleEvent) Handles Axlegend1.AfterSetLayerVisible

    End Sub

  • If AxMap1.Refresh() is used instead of CtlRefresh() method, the map control does not repaint. Refer to the MapObjects SDK for .NET help under the 'Refresh Method' topic for more information.