Dynamically sizing WinForms components

Posted on 2006-05-26
Last Modified: 2010-04-16
I have an application that consists of a window... and inside that window I had a tab control, which contains various other controls (text boxes, etc.).  When I maximize the window, I'd like the tab control to resize along with the window instead of staying the size I initially set it at.  It would also be interesting to see if I could get the other controls to resize appropriately as well, but the tab control is the main thing.  Thanks!!
Question by:DiamonDogX
    LVL 5

    Accepted Solution

    Two possible ways you can do this:

    If you don't mind theTabControl covers the whole form you can just set the Dock property to Fill on the TabControl.  If you don't want the TabControl to fill the whole form, you can position the TabControl to whereever you would like then anchor it on all 4 sides to the form.


    LVL 69

    Expert Comment

    by:Éric Moreau
    Hi DiamonDogX,

    Use the Anchor property of each control to attach to the borders you want. When the borders move, the controls resize.


    Author Comment


    Author Comment

    But wait!  Now when I resize my window (with the mouse) to a larger size, I can't shrink it back again!  The tab control's size seemed to be locked whenever I increase size...

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Article by: Ivo
    Anonymous Types in C# by Ivo Stoykov Anonymous Types are useful when  we do not need to follow usual work-flow -- creating object of some type, assign some read-only values and then doing something with them. Instead we can encapsulate this read…
    In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now