Windows Develop Bookmark and Share   
 index > Windows Forms General > Calculate size of each tabpage
 

Calculate size of each tabpage

How can I calculate the size of each tabpage. If for example I have 4 tabpages I would like these to be spread accross equally.

If one more tab is added = 5 tabpages the code should be able to take care of that too.

I hope anybody can help.
Scorgi  Wednesday, September 09, 2009 1:24 PM
Hi,
You need to calculate your formwidth divde by your no tabpage width.
like your form width=400/no of tabs so each tabpage width is 100.
i hope it will help you
Best Regards, C.Gnanadurai ----------------------- Please mark the post as answer if it is helpfull to you
Gnanadurai  Wednesday, September 09, 2009 1:33 PM
Do you mean the size of the tabs (ie tab page header) or the tab page? I ask because by default the tab pages would typically fill the tab control.

If you mean the tabs (page header) then the two important properties to look at are the ItemSize and the SizeMode.
1. Calculate the required width = tabcontrol.width/number of tabs
2. Set SizeMode to Fixed
3. Set ItemSize = new ItemSize(width/current itemSize.Height)

Hope that helps.
Wole Ogunremi  Wednesday, September 09, 2009 2:09 PM
Hi,
You need to calculate your formwidth divde by your no tabpage width.
like your form width=400/no of tabs so each tabpage width is 100.
i hope it will help you
Best Regards, C.Gnanadurai ----------------------- Please mark the post as answer if it is helpfull to you
Gnanadurai  Wednesday, September 09, 2009 1:33 PM
Do you mean the size of the tabs (ie tab page header) or the tab page? I ask because by default the tab pages would typically fill the tab control.

If you mean the tabs (page header) then the two important properties to look at are the ItemSize and the SizeMode.
1. Calculate the required width = tabcontrol.width/number of tabs
2. Set SizeMode to Fixed
3. Set ItemSize = new ItemSize(width/current itemSize.Height)

Hope that helps.
Wole Ogunremi  Wednesday, September 09, 2009 2:09 PM

You can use google to search for other answers

Custom Search

More Threads

• Avoid form's flash while focus change
• RequiredFieldValidator in WinForms
• Open a Dialog Box
• docking ...
• InitializeComponent method
• ScriptErrorsSuppressed problem
• Report with bitmaps
• SaveFileDialog not handling multi-dotted extensions consistently
• How can i search for certain word in contents of text files?
• Multiple Forms / Calling a Single Form from the Code