English

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

Description

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

Cause

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:

    Code:
    Private Sub Form1_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
    ...................
    Axlegend1.setMapSource(AxMap1.GetOcx)
    Axlegend1.LoadLegend(True)
    End Sub

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

    AxMap1.CtlRefresh()
    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.