Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

A question about the TabStrip control 1

Status
Not open for further replies.

EricsonJ

Programmer
Mar 3, 2002
44
US
I created the tabs of a TabStrip dynamically in my program, and it runs well. But I think the problem is: If the user add to many tabs (I let the users add tabs by thenselves), the top of the TabStrip will change to 2 or 3 or even more lines, but I cannot find any property to determine the hight of the Top tab titles, therefore, I think the Tab Titles will overlap with the content of the TabStrip eventually. Is there any method to solve this.

Thanks a lot.
 
Not sure, but I think you have a couple of options

1. Limit the number of tabs they can add

or
2. Set the multi-row property of the tab strip to false - then tabs get added across the top only in one row and you can add as many as you like with encroaching on the main area (a scroll bar appears)

or

3.
You have to use picture boxes to hold the controls for tab's work area. You might consider keeping track of how many tabs you have (maybe as a private variable of the form) and work out when this encroaches on the main area from the tab fixed height and tab fixed width properties and then set the top property of these picture boxes to allow for this and the same with the height of the tab strip control and the height of the form.

It's a bit messy, but there you go

Mark
 
Thank you very much for your help.

The method 3 is a good way to solve this.

I also have a idea to solve it when I was thinking it yesterday night: I can calculate the total width of all the tabs on the control, and then I can calculate how many rows needed to hold them, then I can get the top property of the picBox in the client area. I am going to program on it, hope it works.


Thaks again.


 
I also followed someone else's suggestion a while back in putting the tabs page controls into frames, as often when adding tabs, altering the size of the control, my tab page controls went all over the place each time and I had to keep going in to move them back.
 
The souce code by which I realize this:
// picIcon is a picture box holds the controls displayed in the tabs.

Dim longTemp As Long
Dim intRowNum As Integer
longTemp = 0
For i = 1 To tbsStepType.Tabs.Count
longTemp = longTemp + tbsStepType.Tabs(i).Width
Next i

intRowNum = longTemp \ tbsStepType.Width + 1
picIcon.Top = tbsStepType.Tabs(1).Height * intRowNum + 500
tbsStepType.Height = picIcon.Top + picIcon.Height
' frameButtons holeds the OK and Cancel buttons
frameButtons.Top = tbsStepType.Top + tbsStepType.Height
Me.Height = tbsStepType.Top + tbsStepType.Height + 945 '* 945 is use to create some place for the OK and Cancel buttons
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top