VS.NET Inherited Forms Bug

VS.NET Bug. I was asked to look into a problem last week involving some moving buttons in the designer. The problem was occurring in inherited forms where the parent form contained some protected, and anchored controls. When you resized the child form in the designer and build, Vs.Net would create some interesting locations and sizes, often time off the form entirely. These location and size values are set in the InitializeComponent() which makes things difficult.

So, after some searching and digging I found an interesting KB article, that explains its a bug.
However Microsoft's solutions are actually the causes in VS.NET 2003.
Basically there are a few options:
  • Once you have the controls have been moved, delete the offending locations and sizes from the InitializeComponent() and they will inherit their values from the parent again.
  • Create another size and location property and replace the erroneous values with these hard coded values after InitializeComponent().
  • Change the protection level to Friend.

    Obviously some of these solutions have their own problems, but the bug is fixed in the latest beta release of Whidbey so just bide your time for a bit.