Results 1 to 4 of 4

Thread: [RESOLVED] [2005] TabControl Resize

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2005
    Posts
    1,950

    Resolved [RESOLVED] [2005] TabControl Resize

    I have a tab control on a form, when the form is resized, I re-arrange the controls on the form and on both tabs of the tabcontrol. However... only the controls on the visible tab appear to move. If I click to the previously unselected tab, the controls have not moved. If I then resize the form, they all jump into place.

    This also happens if I start with the 'other' tab visible.

    I tried adding invoking my resize sub on the tabcontrol resized event, but that does not make any difference. I also added my resize sub on a tab enter event and that does not alter the outcome.

  2. #2
    PowerPoster
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,070

    Re: [2005] TabControl Resize

    I think this is because the controls on a tabpage seem to be generated during run-time. The same happens when you try to click a button that is on a non-selected tabpage using PerformClick: it does not work.


    How do you re-arrange the controls? Simply using Docking and Anchoring? Or do you do it in code? If you do it in code try running the same code on the SelectedIndexChanged event of the TabControl.

    Or better yet: try doing it with docking and anchoring instead. I just tested it and using docking/anchoring the problem does not exist. I can't think of much scenarios when docking and anchoring is insufficient, but if you're having trouble show us what you want to do exactly.

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2005
    Posts
    1,950

    Re: [2005] TabControl Resize

    I do it programatically using a ReSize sub, referring to each control and moving them around to the correct positions for the form size.

    I tried calling that sub in the tab control SelectedIndexChanged event and it worked! It was strange that the enter event for a given tab did not work though, weird.

    Docking and Anchoring would be easier, but I can never seem to get this to work as I want. Also, I resize some listview columns in the resize event too, so I need to run something to control how they look.

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    Re: [RESOLVED] [2005] TabControl Resize

    Show us what these tabs look like and we'll show you how to layout your form so you don't need to manually change the Size or Location of any controls. If the layout is complex then one or more TableLayoutPanels or FlowLayoutPanels may be required. If there are any proportions you want to maintain, please specify.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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