TabPanel Title Tab Width

Hello Everyone,

Does anyone know how to change to tab tittle width while using TabPanel.

The thing is I am working on a desktop app which is having only two tabs.

The TabPanel size that I have created is only 560 X 360. The two tabs (WorkSheet and Report )
on the top left occupies only a slight width of the TabPanel width. The remaining horizontal row
( tab row ) is empty and hence looks odd.

Is there any way to have a uniform tab spread across the window width. That is the tab width in this case
would be individually around 280 points so the WorkSheet Tab covers half the TabPanel and the Report tab Covers the remaining half of the TabPanel WIndow.

Please note, I am only referring for the Tabs ( the little tab buttons on the top that we press to shuffle through the Tab Pages ).

Regards,

Gaurav

I don’t believe so, not with the built-in TabPanel. To do what you need you’ll have to either write your own, use one of the custom classes already written (search the forums) or fake it with a PagePanel rather than a TabPanel and acouple of canvas’s using their MouseDown events to change pages.

what about adding extra space in front and back on the tab text making it longer or just some code to calculate and add in the spacing using code

That should work. Try it and see if you get the results you want.

Hey @Richard Duke / @Dale Arends ,

Yes that seems to work and the thing looks better.

Thanks for the kind support.

  • Gaurav

Not only lazy but also bored … i wrote something beginner friendly (my level of knowledge) :wink:

[code]Public Sub MakeCaptionsEqualWidth(Extends tp As TabPanel)
Dim Y As Integer = tp.PanelCount-1

Dim TabCaptions(-1) As String

For X As Integer = 0 To Y

TabCaptions.Append tp.CaptionAt(X)

Next

Dim LongestString As Integer

// Find the longest Tab Caption
For X As Integer = 0 To Y

If TabCaptions(X).Length > LongestString Then 
  
  LongestString = TabCaptions(X).Length-1
  
End If

Next

// Set Tab Captions in Panel
For X As Integer = 0 To Y

// Let's see if current Caption is smaller than the longest Caption
Dim AllSpaces As Integer = LongestString - TabCaptions(X).Length

// Add Spaces on both ends until we are equal or longer than longest Caption
While TabCaptions(X).Length < LongestString
  
  TabCaptions(X) = " " + TabCaptions(X) + " "
  
Wend

tp.CaptionAt(X) = TabCaptions(X)

Next
End Sub
[/code]

For sure far from ideal/perfect, but it works :smiley:

Oops! I made all Captions of equal width, because i missunderstud the issue. Sry.
Time to take a break. Have a nice weekend all :slight_smile: