TabControl wiht Alignment left and horizontal Text

G

Guest

Hello

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

Thanks Edi
 
M

Mick Doherty

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top