What doesn't work? You give up far too easily ;-)
I just noticed that you are setting Appearance to Buttons, which makes your solution a little different to that in the post which I linked to.
You still need to create your own TabControl class because you need to fix the DisplayRectangle (the area which the Tabpages occupy).
Code Snippet
Public
Class MyTabControl
Inherits TabControl
Public Overrides ReadOnly Property DisplayRectangle() As System.Drawing.Rectangle
Get
Dim tabStripHeight, itemHeight As Int32
If Me.Alignment <= TabAlignment.Bottom OrElse Me.SizeMode = TabSizeMode.Fixed Then
itemHeight =
Me.ItemSize.Height
Else
itemHeight =
Me.ItemSize.Width
End If
If Me.Appearance = TabAppearance.Normal Then
tabStripHeight = 5 + (itemHeight *
Me.RowCount)
Else
tabStripHeight = (3 + itemHeight) *
Me.RowCount
End If
Select Case Me.Alignment
Case TabAlignment.Top
Return New Rectangle(4, tabStripHeight, Width - 8, Height - tabStripHeight - 4)
Case TabAlignment.Bottom
Return New Rectangle(4, 4, Width - 8, Height - tabStripHeight - 4)
Case TabAlignment.Left
Return New Rectangle(tabStripHeight, 4, Width - tabStripHeight - 4, Height - 8)
Case TabAlignment.Right
Return New Rectangle(4, 4, Width - tabStripHeight - 4, Height - 8)
End Select
End Get
End Property
End
Class
Add an instance of this control to your form and set:
DrawMode to OwnerDrawFixed.
SizeMode to Fixed.
ItemSize will have to be manually edited otherwise it draws the tabs the wrong size. Note that width and height are the wrong way round for left or right aligned tabs.
You can then simply draw the tabtext in the controls DrawItem method:
Code Snippet
Private Sub MyTabControl1_DrawItem(ByVal sender As Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles MyTabControl1.DrawItem
Dim textBrush As New SolidBrush(e.ForeColor)
Dim textFormat As New StringFormat()
textFormat.Alignment = StringAlignment.Center
textFormat.LineAlignment = StringAlignment.Center
e.Graphics.FillRectangle(SystemBrushes.Control, e.Bounds)
e.Graphics.DrawString(MyTabControl1.TabPages(e.Index).Text, e.Font, textBrush, e.Bounds, textFormat)
textBrush.Dispose()
textFormat.Dispose()
End Sub