private void DisplayMap_Load(object sender, EventArgs e) { winformsMap1.MapUnit = GeographyUnit.DecimalDegree; winformsMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean); WorldMapKitWmsDesktopOverlay worldMapKitDesktopOverlay = new WorldMapKitWmsDesktopOverlay(); winformsMap1.Overlays.Add(worldMapKitDesktopOverlay); Random random = new Random(); InMemoryFeatureLayer inmLayer = new InMemoryFeatureLayer(); inmLayer.Open(); inmLayer.Columns.Add(new FeatureSourceColumn("wayPointName")); inmLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = new TextStyle("wayPointName", 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); wayPoints.Add(wayPoint3); wayPoints.Add(wayPoint1); LineShape line1 = new LineShape(wayPoints); Feature wayPoint1Featrue = new Feature(wayPoint1); wayPoint1Featrue.ColumnValues.Add("wayPointName", "wayPoint1"); Feature wayPoint2Featrue = new Feature(wayPoint2); wayPoint2Featrue.ColumnValues.Add("wayPointName", "wayPoint2"); Feature wayPoint3Featrue = new Feature(wayPoint3); wayPoint3Featrue.ColumnValues.Add("wayPointName", "wayPoint3"); inmLayer.InternalFeatures.Add(wayPoint1Featrue); inmLayer.InternalFeatures.Add(wayPoint2Featrue); inmLayer.InternalFeatures.Add(wayPoint3Featrue); inmLayer.InternalFeatures.Add(new Feature(line1)); LayerOverlay overlay = new LayerOverlay(); overlay.Layers.Add(inmLayer); winformsMap1.Overlays.Add(overlay); winformsMap1.CurrentExtent = inmLayer.GetBoundingBox() ; winformsMap1.Refresh(); }