Thursday, July 2, 2009

Use The Document Outline Window

My tech blog's admin page is down for the moment so I am posting this here so I don't forget to blog about it.

I am currently working on a .Net Windows Forms MDI application at the company I work at. On the MDI container I added a panel docked to the left side of the form and added some code that allows the user to click its border and re size it. However, after rearranging some controls and adding a couple of new controls the layout stopped working correctly. Every time I opened a child form it was displayed behind the panel. It wasn't doing that previously and its been a couple of weeks since I got everything working the way I wanted it and I couldn't remember exactly what I had done.

After googling "MDIchild form goes behind the panel" I knew the panel needed to be docked. For some reason it wasn't anymore so I re docked it to the left side of the form only to have all my menus pushed over to the right of the control as seen in the example below. Previously when I docked it to the left of the form it only went up to the menu containers which looks normal.


After spending way more time on this than I should of I stopped googling because I wasn't finding anything useful and instead googled my brain. I thought about how a web page is laid out and how the order of the controls can affect the styling.

Finally, I opened the Document Outline Window (example below) from the View Menu in Visual Studio, and pushed the panel up in the order. That did the trick. Somehow the order of the controls got all out of whack.


The lesson I learned was to always have the document outline window open when working in the form designer. If it was open by default I could have spent those 2 hours of my life more productively.

No comments:

Post a Comment