Quantcast
Channel: MapWinGIS ActiveX Map and GIS Component
Viewing all articles
Browse latest Browse all 2341

New Post: Creating Legend in VB.net

$
0
0
Hi Yim,

first of make sure you can add the legend control from your toolbox, to do this simply add the mapwininterfaces.dll into your project by referencing the dll
once the legend control is available in the toolbox simply drog and drop the control into your form, after that,

look at the code below

in your form load

MyLegendl.Map = Map.GetOcx()

then in your load layer

MyShape.Open(Application.StartupPath & "\AppData\Whole\Sample.shp")
    Map.AddLayer(MiniShape, True)
    MainHandler = MyLegend.Layers.Add(MyShape, False) 'False=it will not be visible, but once you check the layer in your legend control it will be available
    MyLegend.Map.LayerName(MainHandler) = System.IO.Path.GetFileNameWithoutExtension(MyShape.Filename)
    MyLegend.Layers.ItemByHandle(MyLegend.SelectedLayer).Refresh()
hope it helps

Viewing all articles
Browse latest Browse all 2341

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>