Пример #1
0
        /// <summary>
        /// 获取经纬网,并设置属性
        /// </summary>
        /// <returns></returns>
        public static IGraticule GetGraticuleAndSetProperty()
        {
            IGraticule pGraticule = new GraticuleClass();

            pGraticule.Name = "Map Grid";
            //设置网格线的符号样式
            ICartographicLineSymbol pLineSymbol = GetLineSymbol();

            pGraticule.LineSymbol = pLineSymbol;
            //设置网格的边框样式
            pGraticule.Border = (IMapGridBorder)GetMapGridBorder();
            //设置网格的主刻度的样式和可见性
            pGraticule.TickLength     = 15;
            pGraticule.TickMarkSymbol = null;
            pGraticule.TickLineSymbol = pLineSymbol;
            //设置网格的次级刻度的样式和可见性
            pGraticule.SubTickCount      = 5;
            pGraticule.SubTickLength     = 10;
            pGraticule.SubTickLineSymbol = pLineSymbol;
            pGraticule.SetSubTickVisibility(true, true, true, true);
            //设置网格的标签的样式和可见性
            pGraticule.LabelFormat.Font = MappingHelper.GetFont("Arial") as IFontDisp;
            pGraticule.Visible          = true;
            return(pGraticule);
        }
Пример #2
0
        /// <summary>
        /// 获取文本符号
        /// </summary>
        /// <returns></returns>
        private static ITextSymbol GetTextSymbol(decimal fontSize = 24)
        {
            //设置文本格式
            ITextSymbol pTextSymbol = new TextSymbolClass();

            //pTextSymbol.Text = "测试";
            pTextSymbol.Font                = (IFontDisp)MappingHelper.GetFont(fontSize: fontSize, isBold: true);
            pTextSymbol.Angle               = 0;
            pTextSymbol.RightToLeft         = false;                                     //文本由左向右排列
            pTextSymbol.VerticalAlignment   = esriTextVerticalAlignment.esriTVABaseline; //垂直方向基线对齐
            pTextSymbol.HorizontalAlignment = esriTextHorizontalAlignment.esriTHACenter; //文本水平居中
            return(pTextSymbol);
        }