예제 #1
0
        /// <summary>
        /// 插入线标记 并且将线标记移动到后面
        /// </summary>
        /// <param name="mapControl"></param>
        /// <param name="pGeometry"></param>
        /// <returns></returns>
        public static IElement DrawLineSymbol(AxMapControl mapControl, IGeometry pGeometry)
        {
            IRgbColor pColor = GetColor(0, 255, 255);

            pColor.Transparency = 255;
            //产生一个线符号对象
            ILineSymbol pOutline = new SimpleLineSymbolClass();

            pOutline.Width = 4;
            pOutline.Color = pColor;
            ILineElement pLineElement = new LineElementClass();

            pLineElement.Symbol = pOutline;
            IElement pElement = pLineElement as IElement;

            pElement.Geometry = pGeometry;
            //添加标注
            InsertElement(mapControl, pElement, 0);
            IGraphicsContainerSelect tmpGSelect = (IGraphicsContainerSelect)mapControl.Map;

            //将元素移动到后面
            tmpGSelect.SelectElement(pElement);
            IGraphicsContainer pGraphicsContainer = mapControl.Map as IGraphicsContainer;

            pGraphicsContainer.SendToBack(tmpGSelect.SelectedElements);
            tmpGSelect.UnselectAllElements();
            return(pElement);
        }