PROBLEM

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

Last Published: April 25, 2020

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.

Article ID:000008222

Software:
  • Legacy Products

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Discover more on this topic