I've created a function which sets the IColor
to a specific ILayer
, the value of transparency is between 0 and 255. When I set the value to 0, it gives me a transparent layer which is OK, but when I set it to 1,2,3,4,5,....255 it gives me the color as if it has 255 transparency. I don't understand, what's wrong with my code:
public static void setLayerColor(ILayer layer, IColor fillColor, IColor outlineColor, short width = 1)
{if (layer == null || fillColor == null || outlineColor == null) return;
IGeoFeatureLayer geoFeatureLayer = (IGeoFeatureLayer)layer;
ISimpleRenderer simpleRenderer = (ISimpleRenderer)geoFeatureLayer.Renderer;
ISimpleFillSymbol symbol = new SimpleFillSymbolClass();
ILineSymbol lineSymbol = new SimpleLineSymbolClass();
lineSymbol.Width = width;
lineSymbol.Color = outlineColor;
symbol.Color = fillColor;
symbol.Outline = lineSymbol;
simpleRenderer.Symbol = (ISymbol)symbol;}
My function has 4 parameters:
ILayer
, the layer of which I want to change its color.IColor
, fillColor.IColor
, outlineColor.short
, the width of the outline.