开发者

c# Form Designer - generated code problem

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜