How to set alignments of form controls dynamically.
-
Hi there, I have a form containing two panels. In both panels there are two labels and textboxes. I set the 'Center In Form' property of the labels and textboxes to 'Horizontally' and 'Vertically' in design time respectively. But as the form is resizable, when the size of the form is increased or decreased at runtime the controls are no longer center aligned in the panels. How can I handle this problem (provided the main form needs to remain sizable)? Please help. Thanks.
-
Hi there, I have a form containing two panels. In both panels there are two labels and textboxes. I set the 'Center In Form' property of the labels and textboxes to 'Horizontally' and 'Vertically' in design time respectively. But as the form is resizable, when the size of the form is increased or decreased at runtime the controls are no longer center aligned in the panels. How can I handle this problem (provided the main form needs to remain sizable)? Please help. Thanks.
Good god are people still trying to do this, this has been solved 1000s of times, look for some articles on resizing forms. There are multiple approaches to solving this and it really depends on what you want. I tend to dock everything and leave the list control docked to fill, if there is no list control I don't bother just leave a blank area or put everything in a panel and anchor it to all sides.
Never underestimate the power of human stupidity RAH
-
Good god are people still trying to do this, this has been solved 1000s of times, look for some articles on resizing forms. There are multiple approaches to solving this and it really depends on what you want. I tend to dock everything and leave the list control docked to fill, if there is no list control I don't bother just leave a blank area or put everything in a panel and anchor it to all sides.
Never underestimate the power of human stupidity RAH
Setting the Anchor property of the controls to none will solve it. :thumbsup: