地图网格设定
LayoutElements elements = m_mapLayoutControl.MapLayout.Elements; //构造GeoMap GeoMap geoMap = new GeoMap(); geoMap.MapName = "京津地区交通干线图"; // 新建一个 GeoMapGrid 对象。 GeoMapGrid geoMapGrid = new GeoMapGrid(); // 设置 GeoMapGrid 对象的相关属性,即设置地图的经纬网的风格。 // 设置为地图添加经纬网。 geoMapGrid.GridType = GeoMapGridType.Graticule; // 设置经纬网的格网线的线型风格。 geoMapGrid.GridLineStyle.LineSymbolID = 9; geoMapGrid.GridLineStyle.LineColor = Color.Black; // 设置经纬网的格网线的水平、竖直间距。 geoMapGrid.HorizontalGridDistance = 40; geoMapGrid.VerticalGridDistance = 40; // 设置经纬网的格网线的类型为实线。 geoMapGrid.GridLineType = GeoMapGridLineType.SolidLine; // 设置经纬网的边框风格。 GeoStyle style = new GeoStyle(); style.LineSymbolID = 6; style.LineColor = Color.Blue; style.LineWidth = 0.2; geoMapGrid.BorderLineStyle = style; // 设置经纬网文本标注的水平、竖直位置。 geoMapGrid.HorizontalTextPosition = HorizontalTextPositionType.Middle; geoMapGrid.VerticalTextPosition = VerticalTextPositionType.Middle; // 设置经纬网文本标注的文本风格。 geoMapGrid.GridLineTextStyle.ForeColor = Color.Black; geoMapGrid.GridLineTextStyle.FontHeight = 60; // 为地图对象添加经纬网。 geoMap.IsGridVisible = true; geoMap.MapGrid = geoMapGrid; //设置GeoMap对象的外切矩形 Rectangle2D rect = new Rectangle2D(new Point2D(850, 1300), new Size2D(1500, 1500)); GeoRectangle geoRect = new GeoRectangle(rect, 0); geoMap.Shape = geoRect; elements.AddNew(geoMap); m_mapID = elements.GetID(); //构造指北针 GeoNorthArrow northArrow = new GeoNorthArrow( NorthArrowStyleType.EightDirection, new Rectangle2D(new Point2D(1400, 2250), new Size2D(350, 350)), 0); northArrow.BindingGeoMapID = m_mapID; elements.AddNew(northArrow); //构造比例尺 GeoMapScale scale = new GeoMapScale(m_mapID, new Point2D(125, 400), 50, 50); scale.LeftDivisionCount = 2; scale.ScaleUnit = Unit.Kilometer; scale.SegmentCount = 4; elements.AddNew(scale);