Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6636607
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:12:26+00:00 2026-05-25T23:12:26+00:00

I have a Form with only a single TabControl , with many tabs, where

  • 0

I have a Form with only a single TabControl, with many tabs, where each tab has only square buttons side by side. I am trying to make it so that when the user clicks on a tab, the form resizes itself to a size where you can see all the buttons in a particular tab or a size where you can see all the tabs, whichever is greater.

I am just curious if there is a way to query where the last control in a tab page is? So I can just do something like:

tabForm.Width = currentTabPage.UsedContentBorder + 10;

Or do I have to do this by adding all the controls and the sizes between them, etc?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T23:12:26+00:00Added an answer on May 25, 2026 at 11:12 pm

    You want to find out the maximum coordinates of all controls in a specific tab? Easy with LINQ:

    int right = tab.Controls.Cast<Control>().Max(c => c.Right);
    int bottom = tab.Controls.Cast<Control>().Max(c => c.Bottom);
    

    Now, to properly choose the size of the form, I imagine you just have to figure out how much larger the Form is than its TabPages… I would guess something like this:

    int extraWidth = form.Width - tabControl.SelectedTab.Width;
    int extraHeight = form.Height - tabControl.SelectedTab.Height;
    

    Then you just do

    form.Size = new Size(right + extraWidth, bottom + extraHeight);
    

    (the TabControl will resize automatically if its Anchor property is set to all four sides.) It occurs to me that this may malfunction if the user resizes the form very small… you may be able to compensate by calculating extraWidth and extraHeight in the Form.Load event and then saving those values for when you need them later.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form which has only tab control in it. I want to
I have a winforms app and the main (and only) form has several buttons.
I have a form that has many checkboxes (too many for it to make
In my C# WinForms program, I have a form that has only a single
I have created a form in my web application which has only a single
I have a form which has a single textbox that sends some data to
You can only have one form runat=server per page apparently. My page has one
Have a simple form (only extract fields here) but for some reason the JQserilization
I have simple form like this which accepts only two values string action and
We have a form that hosts the WebBrowser control. That is the only control

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.