Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #UDT
- #UltimateDevTeam
- ' Minimal Tabcontrol.
- ' Made by Naywyn.
- Public Class cTabControl
- Inherits TabControl
- Private G As Graphics
- Private Rect As Rectangle
- Sub New()
- DoubleBuffered = True
- SizeMode = TabSizeMode.Fixed
- ItemSize = New Size(30, 170)
- Alignment = TabAlignment.Left
- SetStyle(ControlStyles.UserPaint Or ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer, True)
- End Sub
- Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
- G = e.Graphics
- G.Clear(Color.White)
- Using Right As New Pen(Color.FromArgb(211, 223, 229))
- G.DrawLine(Right, ItemSize.Height + 3, 4, ItemSize.Height + 3, Height)
- End Using
- For T As Integer = 0 To TabPages.Count - 1
- Rect = GetTabRect(T)
- If SelectedIndex = T Then
- Using TextBrush As New SolidBrush(Color.FromArgb(32, 32, 32)), TextFont As New Font("Verdana", 10)
- G.DrawString(TabPages(T).Text, TextFont, TextBrush, New Point(Rect.X + 45, Rect.Y + 7))
- End Using
- Else
- Using TextBrush As New SolidBrush(Color.FromArgb(129, 129, 129)), TextFont As New Font("Verdana", 10)
- G.DrawString(TabPages(T).Text, TextFont, TextBrush, New Point(Rect.X + 45, Rect.Y + 7))
- End Using
- End If
- If Not IsNothing(ImageList) Then
- If Not TabPages(T).ImageIndex < 0 Then
- G.DrawImage(ImageList.Images(TabPages(T).ImageIndex), New Rectangle(Rect.X + 20, Rect.Y + 7, 16, 16))
- End If
- End If
- Next
- MyBase.OnPaint(e)
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement