How to set alignments of form controls dynamically.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • priyamtheone
    New Member
    • Sep 2007
    • 88

    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.
  • Anton Zinchenko
    New Member
    • Sep 2010
    • 16

    #2
    I can't figure out what you mean by "...set the 'Center In Form' property of the labels and textboxes to 'Horizontally' and 'Vertically'... ", but maybe setting the Anchor property of your labels and texboxes to None will solve your problem...

    Comment

    • priyamtheone
      New Member
      • Sep 2007
      • 88

      #3
      I can't figure out what you mean by "...set the 'Center In Form' property of the labels and textboxes to 'Horizontally' and 'Vertically'... "
      Select a control in a form, go to Format menu and you'll get 'Center In Form'. It has two options 'Horizontally' and 'Vertically'. By these you can center the control horizontally or vertically in respect to its container. Though I referred it as a property but I learned latter that it's a design time tool only.

      However yours is the absolute solution I was looking for. Thanks a lot. Regards.

      Comment

      Working...