I'm trying to create a transparent Polygon in ArcMap; however, it's never transparent. Here's the code I have.
// Create polygon
IPolygon polygon = new PolygonClass();
// create & add points,......
// Create lineSymbol
ISimpleLineSymbol lineSymbol = new SimpleLineSymbolClass();
// set color & style,....
// Create fillSymbol
ISimpleFillSymbol fillSymbol = new SimpleFillSymbolClass();
fillSymbol.Outline = lineSymbol;
fillSymbol.Color = //set to color red//;
fillSymbol.Color.Transparent = 0;
fillSymbol.Style = esriSimpleFillStyle.esriSFSSolid;
// Draw Shape
myMap.DrawShape(polygon, fillSymbol);
RESULT ==> A solid red polygon is drawn. The Transparent setting is ignored.
Thoughts?
Answer
As per ArcObjects docs
IColor.Transparency Property: Transparency is the degree to which a color is opaque. True transparency is only supported at the layer level. For graphic elements, 0 for transparent and 255 for opaque are the only supported values. Use either the ILayerEffects or ITransparencyRenderer interfaces to set layer transparency. For layer transparency to work properly the display device must be set to "True Color (32 bit)".
No comments:
Post a Comment