Quantcast
Channel: GMap.NET - Great Maps for Windows Forms & Presentation
Viewing all articles
Browse latest Browse all 3384

New Post: Map control not redrawing correctly after switching provider. [C#]

$
0
0
Its Working :D.

Setting the initial combobox index to 1 seemed to resolve the Issue.

He is the working code for anyone interested:
public partial class main : Form
{
    GMapControl map = new GMap.NET.WindowsForms.GMapControl();
    public main()
    {
        InitializeComponent();
        comboBox_maps.DataSource = GMapProviders.List;
        comboBox_maps.SelectedIndex = 1;
        map.MapProvider = (GMapProvider)comboBox_maps.SelectedItem;
        addMap(); 
    }

    private void main_Load(object sender, EventArgs e)
    {
    }

    private void addMap()
    { 
        map.Bearing = 0F;
        map.CanDragMap = true;
        map.GrayScaleMode = false;
        map.LevelsKeepInMemmory = 5;
        map.Location = new System.Drawing.Point(12, 87);
        map.MarkersEnabled = true;
        map.MaxZoom = 2;
        map.BorderStyle = BorderStyle.FixedSingle;
        map.MinZoom = 2;
        map.MouseWheelZoomType = GMap.NET.MouseWheelZoomType.MousePositionAndCenter;
        map.Name = "map";
        map.NegativeMode = false;
        map.PolygonsEnabled = true;
        map.RetryLoadTile = 0;
        map.RoutesEnabled = true;
        map.ShowTileGridLines = false;
        map.Size = new System.Drawing.Size(960, 511);
        map.TabIndex = 2;
        map.Zoom = 0D;
        map.Load += new System.EventHandler(this.main_Load);
        map.MinZoom = 3;
        map.MaxZoom = 17;
        map.Zoom = 5;
        map.Manager.Mode = AccessMode.ServerAndCache;
        //map.MapProvider = GMapProviders.OpenStreetMap;
        Controls.Add(map);
    }

    private void comboBox_maps_SelectedIndexChanged(object sender, EventArgs e)
    {
        map.MapProvider = (GMapProvider)comboBox_maps.SelectedItem;
    }
Thank you radioman for all your help on the issue.
  • Dan.

Viewing all articles
Browse latest Browse all 3384

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>