private void ComboBoxMapTypeSelectedIndexChanged(object sender, EventArgs e) { ComboBoxSelectedIndexChanged( comboBoxMapType, MapProviderNames.GetType, (mapType) => { _mapControl.MapProvider = MapProviderFactory.CreateMapProvider(mapType); _viewItemManager.Config.MapType = mapType; }); }
private void InitializeMapControl(Config.Config config) { _mapControl = new GMapControl(); _mapControl.Dock = DockStyle.Fill; panelMain.Controls.Add(_mapControl); //use google provider _mapControl.MapProvider = MapProviderFactory.CreateMapProvider(config.MapType); //get tiles from server only // _mapControl.Manager.Mode = AccessMode.ServerAndCache; _mapControl.Manager.Mode = AccessMode.ServerOnly; _mapControl.DragButton = MouseButtons.Left; //not use proxy GMapProvider.WebProxy = null; //center map on moscow _mapControl.Position = new PointLatLng( _viewItemManager.Config.MapPosition.Lat, _viewItemManager.Config.MapPosition.Lng); //zoom min/max; default both = 2 _mapControl.MinZoom = Config.Config.MapZoomLevelMinValue; _mapControl.MaxZoom = Config.Config.MapZoomLevelMaxValue; //set zoom _mapControl.Zoom = config.MapZoomLevel; _overlayOne = new GMapOverlay("OverlayOne"); _mapControl.Overlays.Add(_overlayOne); _mapControl.OnMapZoomChanged += MapControlOnOnMapZoomChanged; _mapControl.OnPositionChanged += MapControlOnOnPositionChanged; _mapControl.DoubleClick += OnDoubleClick; _mapControl.Click += OnClick; }