MapControl1.map.clear ();
MapGeoseetLoader GL = New MapGeoseetLoader (@ "f: /test.gst");
MapControl1.map.Load (GL);
// Open map
MapControl1.map.Load (New MaptableLoader (@ "f: /test.tab"));
/ / Open Test.Tab Map File
Featurelayer lyrpnt = mapControl1.map.Layers ["test"] as featurelayer;
RangedTheme THM = New RangedTheme (LyrPnt, "Ph__1999", "Ph", 3, DistributionMethod.equalcountperRange;
lyrpnt.modifiers.insert (0, THM);
// Define a RangedTheme
ThemelegendFrame Frame = LegendFrameFactory.createthemelegendFrame ("pH__1999", "PP", THM)
Legend legend = mapcontrol1.map.Legends.createlegend (New size (5, 5));
Legend.frames.Append (frame);
/ / Define a Legend
//MapControl1.map.adornments.Append (legend);
// If this sentence is retained, Legend will be displayed in MapControl1.
LegendControl1.map = mapControl1.map;
IF (MapControl1.map.Legends.count> 0)
{
LegendControl1.Legend = mapControl1.map.Legends [0];
}
/ / Display Legend in LegendControl1 control
Description: This is just a simple example. For different map files, the specific code is different, and some places should be modified.