VERIFIED SOLUTION i
X

How to disable the movement of labels associated to a feature in MapXtreme

UPDATED: March 24, 2017


This behavior can be achieved by setting LabelsAreEditable property value to false
Refer code snippet:
 
Table tab = MapInfo.Engine.Session.Current.Catalog.OpenTable(@"C:\Program Files\MapInfo\MapXtreme\7.2.0\Samples\Data\usa.tab", "USA");
            FeatureLayer fl = new FeatureLayer(tab);
            this.mapControl1.Map.Layers.Add(fl);

            MapInfo.Mapping.LabelLayer labelLayer = new MapInfo.Mapping.LabelLayer("LabelUS");
            LabelSource labelSource = new LabelSource(tab);
            //LayerHelper.SetSelectable(labelLayer, false); --- won't work

            //This is the way to disable label movement as long as you don't click on label tool in toolbar of map control.
            mapControl1.Tools.SelectMapToolProperties.LabelsAreEditable = false; 
            
            labelLayer.Sources.Append(labelSource);
            mapControl1.Map.Layers.Add(labelLayer);

 

Environment Details

Product Feature: Installation / Upgrade

 

Downloads

  • No Downloads