Saturday, 10 October 2015

arcmap - ArcObjects - Create and Draw a Transparent Polygon


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

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...