Re: [2005] Custom TabControl
you could just change the text when the tabs are changed..
for example.. lets say you set each tabs TAG property, to the same as its text property.. (if you already use TAG for something else, you could just keep the data in a local array instead) then you add some code like this
VB Code:
'NUMBER OF CHARACTERS TO SHOW IN UNSELECTED TABS (PLUS ...)
Private Const MAX_TAB_CHARS As Integer = 12
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
TruncateTabs()
End Sub
Private Sub TabControl1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TabControl1.SelectedIndexChanged
TruncateTabs()
End Sub
Private Sub TruncateTabs()
'SHORTEN TABS THAT ARE LONGER THAN THE MAX_TAB_CHARS SETTING
For Each TP As TabPage In TabControl1.TabPages
If Not TP Is TabControl1.SelectedTab Then
If TP.Tag.ToString.Length > MAX_TAB_CHARS Then
TP.Text = TP.Tag.ToString.Substring(0, MAX_TAB_CHARS) & "..."
End If
Else
TabControl1.SelectedTab.Text = TabControl1.SelectedTab.Tag.ToString
End If
Next
End Sub
so that when the user clicks on the tab, the full text is shown, but all the others are truncated to whatever length you want.
Re: [2005] Custom TabControl
This works....But it doesn't do, exactly what I'm trying to do. I don't think I was very clear in my first post (Monday morning after a weekend of 100 plus degree temperature with no AC will do that to you).
Lets say I have 6 tabs. The text on each one of different length. The tab control has a width of 320. What I want to do is when a page is selected, the full text shows. The rest of the tab pages get truncated to fill the remaining space.
So if the selected tab is 100 pixels wide, then the other 5 will be 64 pixels wide.