TabControl wiht Alignment left and horizontal Text

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello

Is it possible to create a TabControl with Alignment Left and horizontal
Text for the TabPages?

Thanks Edi
 
Set the Tabcontrols SizeMode to Fixed.
Change the TabControls ItemSize property so that it gets serialized.
Change the TabControls DrawMode to OwnerDrawFixed
Then add the following code (assuming your tabcontrol is called TabControl1)
\\\
Private Sub TabControl1_DrawItem(ByVal sender As System.Object, _
ByVal e As DrawItemEventArgs) Handles TabControl1.DrawItem

e.Graphics.FillRectangle(SystemBrushes.Control, e.Bounds)
Dim sf As New StringFormat
sf.Alignment = StringAlignment.Center
sf.LineAlignment = StringAlignment.Center
e.Graphics.DrawString(TabControl1.TabPages(e.Index).Text, _
TabControl1.Font, SystemBrushes.ControlText, _
RectangleF.op_Implicit(e.Bounds), sf)
End Sub
///

For some more TabControl tips visit my site:
http://dotnetrix.co.uk/tabcontrols.html
 
Back
Top