Various technical articles, IT-related tutorials, software information, and development journals
Thursday, October 1, 2015
Keeping Windows Forms Controls Centered
Windows Forms designers may find it necessary to keep a control centered in its container but not stretched if the container expands (e.g. if the user maximizes the window). The way to accomplish this is actually quite simple, and requires no math whatsoever. Simply setting the Anchor property to nothing along a certain axis results in the control staying perfectly centered without any change in size. Setting that property to Bottom only, for example, keeps the control's bottom edge stuck relative to the bottom of the container but allows it to slide horizontally to remain centered.
Labels:
misc
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment