Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. How to set alignments of form controls dynamically.

How to set alignments of form controls dynamically.

Scheduled Pinned Locked Moved C#
helpquestiondesigntutorial
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    priyamtheone
    wrote on last edited by
    #1

    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.

    M 1 Reply Last reply
    0
    • P priyamtheone

      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.

      M Offline
      M Offline
      Mycroft Holmes
      wrote on last edited by
      #2

      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

      P 1 Reply Last reply
      0
      • M Mycroft Holmes

        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

        P Offline
        P Offline
        priyamtheone
        wrote on last edited by
        #3

        Setting the Anchor property of the controls to none will solve it. :thumbsup:

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups