public MapFile(string file) { InitializeComponent(); //map = new DesignXmlDraw(); // designer keeps deleting this code??!! Application.AddMessageFilter(this); // // manually add controls to the splitter. visual studio keeps deleting them // map = new DesignXmlDraw(); this.splitContainer1.Panel1.Controls.Add(this.map); // // map // this.map.Dock = System.Windows.Forms.DockStyle.Fill; this.map.Location = new System.Drawing.Point(0, 0); this.map.Name = "map"; this.map.Size = new System.Drawing.Size(620, 474); this.map.TabIndex = 0; this.map.Zoom = 1F; map.ZoomChange += new DesignXmlDraw.DrawEventHandler(map_ZoomChange); map.XmlChange += new DesignXmlDraw.DrawEventHandler(map_XmlChange); map.SelectionChange += new DesignXmlDraw.DrawEventHandler(map_SelectionChange); map.ToolChange += new DesignXmlDraw.DrawEventHandler(map_ToolChange); this.Closing += new CancelEventHandler(MapFile_Closing); if (file != null) { map.SetMapFile(file); if (map.MapDoc == null) // failed to open? map.SetNew(); // yes, just start a new one } else map.SetNew(); SetTitle(false); }