VERIFIED SOLUTION i
X

Turning the visibility off for a feature layer and its labels

UPDATED: April 5, 2017


Since labels are in a separate layer from the feature layer it's associated with, it is necessary to adjust Enabled properties on both the Label Source and the Feature Layer.
C# Code:
MapInfo.Mapping.LabelLayer lblLyr = (MapInfo.Mapping.LabelLayer)mapControl1.Map.Layers[0]; 
//The LabelLayer is the first layer in this workspace
MapInfo.Mapping.LabelSource lblSource = lblLyr.Sources["USA"];
lblSource.DefaultLabelProperties.Visibility.Enabled = false;
MapInfo.Mapping.FeatureLayer lyrUSA = (MapInfo.Mapping.FeatureLayer)mapControl1.Map.Layers["USA"];
lyrUSA.Enabled = false;

VB.NET Code:
Dim lblLyr As MapInfo.Mapping.LabelLayer = MapControl1.Map.Layers.Item(0) 'The LabelLayer is the first 
'layer in this workspace
Dim lblSource As MapInfo.Mapping.LabelSource = lblLyr.Sources.Item("USA")
lblSource.DefaultLabelProperties.Visibility.Enabled = False
Dim lyrUSA As MapInfo.Mapping.FeatureLayer = MapControl1.Map.Layers.Item("USA")
lyrUSA.Enabled = False



 

Downloads

  • No Downloads