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

    resizing controls by percent

    Hello,

    Please have a look at the screen capture below.

    SafeguardRowUserControl.jpg

    What I have here is a line up of textboxes and a couple combobox at the right end. They are all children of a UserControl.

    What I would like to do is allow for the UserControl to be horizontally resized and have the textboxes and comboboxes resize according to percentage. Whatever percentage they are now (as seen in the screen capture), they should maintain that percentage. So, for example, the left-most combobox is about 8% of the entire width of the UserControl as you can see. If the UserControl was stretched to twice its current size, the combobox should also stretch to twice its size, thereby remaining at 8% of the UserControl's width.

    How can I do this?

    I'm working in Visual Studios 2008.

  2. #2
    Join Date
    Feb 2012
    Location
    Strasbourg, France
    Posts
    116

    Re: resizing controls by percent

    Use Anchor properties of controls

  3. #3
    Join Date
    Jan 2002
    Posts
    195

    Re: resizing controls by percent

    control1.width=usercontrol.width*.08
    ...
    that should do it.

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