private void DisplayMap_Load(object sender, EventArgs e) { winformsMap1.MapUnit = GeographyUnit.DecimalDegree; winformsMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean); Random random = new Random(); InMemoryFeatureLayer inmLayer = new InMemoryFeatureLayer(); inmLayer.Open(); inmLayer.Columns.Add(new FeatureSourceColumn("textContent")); inmLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = new TextStyle("textContent", new GeoFont("Arial", 15), new GeoSolidBrush(GeoColor.SimpleColors.Black)) { XOffsetInPixel = 18 }; inmLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.Capital1; inmLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyles.Canal1; inmLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; ////add waypoints Vertex wayPoint1 = new Vertex(random.Next(-180, 180), random.Next(-90, 90)); Vertex wayPoint2 = new Vertex(random.Next(-180, 180), random.Next(-90, 90)); Vertex wayPoint3 = new Vertex(random.Next(-180, 180), random.Next(-90, 90)); ////add lines Collection wayPoints = new Collection(); wayPoints.Add(wayPoint1); wayPoints.Add(wayPoint2); LineShape line1 = new LineShape(wayPoints); wayPoints.Clear(); wayPoints.Add(wayPoint2); wayPoints.Add(wayPoint3); LineShape line2 = new LineShape(wayPoints); wayPoints.Clear(); wayPoints.Add(wayPoint3); wayPoints.Add(wayPoint1); LineShape line3 = new LineShape(wayPoints); Feature wayPoint1Featrue = new Feature(wayPoint1); wayPoint1Featrue.ColumnValues.Add("textContent", "wayPoint1"); Feature wayPoint2Featrue = new Feature(wayPoint2); wayPoint2Featrue.ColumnValues.Add("textContent", "wayPoint2"); Feature wayPoint3Featrue = new Feature(wayPoint3); wayPoint3Featrue.ColumnValues.Add("textContent", "wayPoint3"); Feature line1Feature = new Feature(line1); line1Feature.ColumnValues.Add("textContent", "line1"); Feature line2Feature = new Feature(line2); line2Feature.ColumnValues.Add("textContent", "line2"); Feature line3Feature = new Feature(line3); line3Feature.ColumnValues.Add("textContent", "line3"); inmLayer.InternalFeatures.Add(wayPoint1Featrue); inmLayer.InternalFeatures.Add(wayPoint2Featrue); inmLayer.InternalFeatures.Add(wayPoint3Featrue); inmLayer.InternalFeatures.Add(line1Feature); inmLayer.InternalFeatures.Add(line2Feature); inmLayer.InternalFeatures.Add(line3Feature); LayerOverlay overlay = new LayerOverlay(); overlay.Layers.Add(inmLayer); winformsMap1.Overlays.Add(overlay); winformsMap1.CurrentExtent = inmLayer.GetBoundingBox(); winformsMap1.Refresh(); }