This probably involves monkeying around with the DefaultValue()
attribute on the Size property of your inherited form, or implementing
a ShouldSerializeSize() method. Here is what is going on now:
Each property of every Control can define a DefaultValue attribute for
that property. This attribute tells Visual Studio Designer that if the
value of that property is equal to the given default value, don't
bother serializing the property in the "Windows Designer Generated
Code" section of your class. For example, the default value for the
MultiSelect property of the ListView control is true, so if you leave
it at true, Visual Studio Designer won't insert any code to initialize
that property. Only if you change it to false will you see:
this.lvwBusinessObjects.MultiSelect = false;
Since your redefined Form doesn't define a new default value for the
form size, Visual Studio Designer will _always_ serialize the size of
the form or of any child forms, because the form's size is different
from the default established on the base Form class (if there even is
one). So, in the code marked "Windows Designer Created Code" there will
always be a line like this:
this.Size = new Size(400, 500);
because Visual Studio Designer sees that the form size is not equal to
the default of 300, 300, and so it thinks that it has to insert code to
initialize the size. (Or maybe there is no default defined for Form...
I don't know.)
Anyway, you have to tell Visual Studio to not bother serializing the
form size if it is equal to that of the parent form. Unfortunately,
there's no way to do this other than hard-coding the form size into the
parent Form's class. I would try the following to see if it works.
Define a new method called ShouldSerializeSize() in your parent Form:
private bool ShouldSerializeSize()
{
return this.Size.Width == 1000 && this.Size.Height == 500;
}
for example. This should cause Visual Studio Designer to check the
child form's size to see if it is 1000 x 500. If it is, the Designer
won't insert any code to set the size of the child form.
The only drawback is that whenever you change the size of your parent
form, you have to remember to fix the ShouldSerializeSize() method.
(And no, you can't just compare this.Size.Width with base.Size.Width or
something like that. If you think about it you'll realize why that
wouldn't work.)
I'm still learning about exactly how the Designer works with defaults
and the class hierarchy, so don't be surprised if this doesn't work at
the outset. Let us know what happens and we can try other solutions if
this doesn't do it.