radioman / greatmaps

GMap.NET - Great Maps for Windows Forms & Presentation
912 stars 407 forks source link

Completely re-draw the map? #73

Closed vbCodingNewbie closed 6 years ago

vbCodingNewbie commented 6 years ago

I am new to programming and to this control. I sometimes get the red X/envelope issue. From what I have found it means there is an error that can not be trapped during the Painting event. While I am trying to figure out where I messed up I was hoping for a way to allow the user to completely redraw the map. Right now when this happens they have to close the program and then re-launch it.

From a menu option I have tried:

Private Sub ReloadMapToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles ReloadMapToolStripMenuItem.Click
    mainMap.SuspendLayout()
    mainMap.Refresh()
    System.Threading.Thread.Sleep(500)
    mainMap.ResumeLayout()
End Sub

and also

Private Sub ReloadMapToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles ReloadMapToolStripMenuItem.Click
    mainMapmainMap.SuspendLayout()
    mainMapmainMap.ReloadMap()  
    System.Threading.Thread.Sleep(500)
    mainMapmainMap.ResumeLayout()
End Sub

Neither of those approaches worked. Is there a way to accomplish this while I try to figure out where I messed up with the updating process?

radioman commented 6 years ago

Map.Refresh();