CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2011
    Posts
    63

    resizing panel to fit all controls

    Hello,

    I'm thinking there must be a way to tell a panel to resize to exactly the size required for all its controls to be visible. So if it's too big, it shrinks to fit all the controls snugly, and if it's too small, it grows so that all the controls can be seen.

    How can I do this?

  2. #2
    Join Date
    Jan 2002
    Posts
    195

    Re: resizing panel to fit all controls

    I would calculate the percentage of the hight and width the control takes compared to the panel. Then when the panel resizes I would resize all the controls in the panel to the same percentage. Don't forget to subtract spacing of your controls from the panel size when making calculations and also remeber to place controls based on the new size of its neigbor controls.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured