PROBLEM

Changing label visibility programmatically

Description

At ArcGIS 9.3 and 9.3 Service Pack 1, ForceElementLayer implements the IEnumAttributeLabel interface. Therefore, to change label visibility programmatically at 9.3 and 9.3 SP1 on a ForceElementLayer, implement the code given below.

Cause

The cause is due to an API change.

Solution or Workaround

Implement the following code:
Code:

// Example (C#) : Turn on all labels off a ForceElementLayer CoClass named “MoleForceElementLayer”
// Changed at 9.3

IEnumAttributeLabel pEnumLabel = MoleForceElementLayer as IEnumAttributeLabel;
pEnumLabel.Reset();
for (int i = 0; i < pEnumLabel.Count; i++)
{
IAttributeLabel pAttrib = pEnumLabel.NextLabel();
pAttrib.IsVisible = true;
}

((ICachedGraphicLayer) MoleForceElementLayer).Refresh();

    Article ID:000010084

    Software:
    • Legacy Products

    Get help from ArcGIS experts

    Contact technical support

    Download the Esri Support App

    Go to download options

    Related Information

    Discover more on this topic