G
Guest
Hi,
I'm using VS2005 Pro and trying to minimise the redundant code between a
number of similar forms in a C# project.
I’ve produced a base form, which contains a few buttons, a graphic and some
associated code. This works okay programmatically, but I find that the
buttons (which are anchored to the right and / or bottom of the form) are not
being placed correctly when first drawn if the inherited form’s initial size
is different to the base form’s. For subsequent changes in form shape within
the designer or a running application, the behaviour with regard to anchoring
is as expected (i.e. the gap between button and bottom border remains
constant – it’s just not what I originally specified).
It seems the buttons are being drawn in their original position (relative to
the top left of the form) and *then* anchored to the form’s bottom / right
borders, regardless of whether the border is also in its original position.
As the form is inherited, the buttons cannot be manually realigned in the
designer.
If anyone can tell me how to solve (or perhaps get around) this problem,
that would be great! It would be quite untidy to have to have all the forms
the same dimensions or anchor everything to the top left.
Cheers,
Mike
I'm using VS2005 Pro and trying to minimise the redundant code between a
number of similar forms in a C# project.
I’ve produced a base form, which contains a few buttons, a graphic and some
associated code. This works okay programmatically, but I find that the
buttons (which are anchored to the right and / or bottom of the form) are not
being placed correctly when first drawn if the inherited form’s initial size
is different to the base form’s. For subsequent changes in form shape within
the designer or a running application, the behaviour with regard to anchoring
is as expected (i.e. the gap between button and bottom border remains
constant – it’s just not what I originally specified).
It seems the buttons are being drawn in their original position (relative to
the top left of the form) and *then* anchored to the form’s bottom / right
borders, regardless of whether the border is also in its original position.
As the form is inherited, the buttons cannot be manually realigned in the
designer.
If anyone can tell me how to solve (or perhaps get around) this problem,
that would be great! It would be quite untidy to have to have all the forms
the same dimensions or anchor everything to the top left.
Cheers,
Mike