1

Its that I am developing an application in C# and I have used three tab controls there. The problem is I can not change the actual window size of the application when I change to another tab because I do not need such big window for that and when I change back to the previous one it should go back to previous size.

3
  • 2
    I personally feel that constantly changing the window size would not provide a very pleasant user experience, if they maximize (unless you don't let them) then they will get a full-screen window anyway. I would suggest setting the window size to the maximum you need and just have tabs that don't fill the full window with content all the time Commented Jan 6, 2012 at 10:09
  • Do not use tab control. Use panels and show/hide them via buttons. You simply have to set autosize and AutoSizeMode property of Form. Commented Jan 6, 2012 at 10:21
  • Is this WinForms or WPF? Commented Jan 7, 2012 at 1:12

2 Answers 2

2

In my opinion you should not change the size of the window when the selected tab changes. Design your window in such a way that you don't need to resize it.

Redesign your tabs in such a way that they always consume the same size so you don't need to resize the window.

I would not expect, as a user, that the window size changes because it may give you a bad user experience.

Sign up to request clarification or add additional context in comments.

3 Comments

I get the point but its a project and I was asked to do it. So, can you please help?
Try to redesign you tabs in such a way that the consume allway the same size. So you don't need to resize the window. Does that help you?
I tried that but you see the contents of one tab take so much space and the others don't and I have to keep those that way.
1

i think you want this:

 private void tabControl1_SelectedIndexChanged(object sender, EventArgs e) { if (tabControl1.SelectedTab.Text == "tabPage1") { // rezise tabcontrol } } 

although i dont think its user-friendly

1 Comment

@shihab13rocks see my edit, now using selectedIndexChanged, this works (for me)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.