Nevron Forum

Map legend - autosizing the legend within a panel

https://www.nevron.com/Forum/Topic6144.aspx

By Kevin Harrison 1 - Monday, February 20, 2012

Hi

I use  mapLegend.Create((Panel)legendControl) to add my legend to the map. I notice that the help says that the panel is automatically resized to the height of the legend.  However, I want the legend to resize within the panel, so that its size is automatically adjusted as I resize the control hosting the map and the legend, rather than being partialy hidden.  How can I achieve this?

Thanks, Kevin

By Nevron Support - Thursday, March 1, 2012

Hi,

You will have to manually create you legend. For example you may create a bitmap from the legend info and then put the bitmap in an image box. You should create your own legend class that inherits the NMapLegendValue or the NMapLegendRangle class. Then you will be able to use the protected GetColor and GetValue methods to create your image.

By Kevin Harrison 1 - Thursday, March 1, 2012

Can you provide an example please?
By Nevron Support - Friday, March 2, 2012

To receive a code example, you will have to submit a support ticket or contact Nevron Support.