I have map control on main form. Problem is, when form designer generate code then overrides value of variable (RouteOverlay and MarkerOverlay) with new value and i don't want that.
Before generated code
//Map.cs
RouteOverlay = new GMap开发者_StackOverflowOverlay(this, "routes");
MarkerOverlay = new GMapOverlay(this, "markers");
After generated code
//MainForm.designer.cs
this.map1.MarkerOverlay = ((GMap.NET.WindowsForms.GMapOverlay)(resources.GetObject("map1.MarkerOverlay")));
this.map1.RouteOverlay = ((GMap.NET.WindowsForms.GMapOverlay)(resources.GetObject("map1.RouteOverlay")));
Add [DesignerSerializationVisiblity(DesignerSerializationVisiblity.Hidden)]
to the properties.
This will completely prevent the designer from saving them.
精彩评论