A dotted ILineElement with a width greater than 1 is not dotted

Discussion created by smunoz on Mar 20, 2012
Latest reply on Apr 23, 2014 by deriven
Hello everyone,

I am trying to add a dotted line to mi map, and the code I am using is the following:

                //Define a polyline between the two given points 
                IPolyline polyline = new PolylineClass();
                polyline.FromPoint = from_point;
                polyline.ToPoint = to_point;

                //Define the color of the line (black)
                IRgbColor colorEsri = new RgbColorClass();
                colorEsri.Red = color.R;
                colorEsri.Green = color.G;
                colorEsri.Blue = color.B;

                //Create the final simple line, setting its properties
                ISimpleLineSymbol simpleLineSymbol = new SimpleLineSymbol();

                simpleLineSymbol.Color = colorEsri;
                simpleLineSymbol.Style = lineStyle;
                simpleLineSymbol.Width = width;

                //Create abd set the element that will contain the defined line
                //It's geometry will be the one of the polyline
                ILineElement element = new LineElementClass();
                element.Symbol = simpleLineSymbol as ILineSymbol;
                IElement lineElement = (IElement)element;
                lineElement.Geometry = (IGeometry)polyline;

When I add the line to the map, it is drawn correctly. But there is one case in which this is not working properly: if "lineStyle" is esriSimpleLineStyle.esriSLSDot and "width" is greater than 1, the line is not dotted, but a normal line. However, if "width" is equal to 1, then the line is perfectly dotted.

Does anyone know why I cannot create a dotted line with a width greater than 1?

Thank you very much in advance.