By some process I am creating a polygon feature layer. Before adding the layer in the map, I want to set polygon's fill color to no color and set polygon's outline color and width. I am working with C#.

Is there a way to set polygon feature layer's fill color or outline in ArcObjects?

  • do you want to set up a UniqueValue renderer, i.e. different symbols for all polygons or the same symbol for all polygons? – Devdatta Tengshe Nov 22 '12 at 7:08
  • @Devdatta Tengshe: same symbol for all polygons – Emi Nov 22 '12 at 7:10

You need to set the renderer for your layer. Since you want to use the same symbology for all, you will have to use a ISimpleRenderer

Using an IFillSymbol, you can set the border and the color for your polygons. Set this as the symbol for your ISimpleRenderer and set that as the FetureRenderer on your IFeatureLayer.

Also have a look at this article: How to define a renderer for your layer



public void RenderLayer_color(IFeatureLayer pFeatureLayer, IRgbColor pMamau)
            IGeoFeatureLayer pGeoFeatureLayer;
            pGeoFeatureLayer = (IGeoFeatureLayer)pFeatureLayer;
            IFeatureRenderer pFeatureRender;
            pFeatureRender = (IFeatureRenderer) new SimpleRenderer();                        
            IFillSymbol pFillSymbol;
            pFillSymbol = (IFillSymbol) new SimpleFillSymbol();            
            pFillSymbol.Color = pMamau;

            ISimpleRenderer pSimpleRenderer;
            pSimpleRenderer = new SimpleRenderer();            
            pSimpleRenderer.Symbol = (ISymbol) pFillSymbol;

            pGeoFeatureLayer.Renderer =  IFeatureRenderer)pSimpleRenderer;            

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.