Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System.Drawing.Drawing2D
- 'Made by Darko155
- 'Special thanks to Mavamaarten
- 'www.hackforums.net
- Public Class TabControlClass
- Inherits Windows.Forms.TabControl
- Dim LightColor As Color = Color.FromArgb(95, 105, 127)
- Dim DarkColor As Color = Color.FromArgb(71, 80, 100)
- Dim LightBrush As New SolidBrush(LightColor)
- Dim DarkBrush As New SolidBrush(DarkColor)
- Dim NotSelectedColor As New SolidBrush(Color.FromArgb(90, 102, 127))
- Sub New()
- SetStyle(ControlStyles.UserPaint Or ControlStyles.Opaque Or ControlStyles.ResizeRedraw Or ControlStyles.AllPaintingInWmPaint Or ControlStyles.Opaque, True)
- SetStyle(ControlStyles.Selectable, False)
- Dock = DockStyle.Fill
- SizeMode = TabSizeMode.Fixed
- Alignment = TabAlignment.Left
- ItemSize = New Size(25, 120)
- DrawMode = TabDrawMode.OwnerDrawFixed
- Font = New Font("Verdana", 8)
- End Sub
- Protected Overrides Sub CreateHandle()
- MyBase.CreateHandle()
- Alignment = TabAlignment.Left
- End Sub
- Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
- Dim bm As New Bitmap(Width, Height)
- Dim g As Graphics = Graphics.FromImage(bm)
- g.Clear(DarkColor)
- g.SmoothingMode = SmoothingMode.AntiAlias
- For i = 0 To TabCount - 1
- Dim TabRectangle As Rectangle = GetTabRect(i)
- If i = SelectedIndex Then
- g.FillRectangle(LightBrush, TabRectangle)
- g.FillRectangle(Brushes.DeepSkyBlue, New Rectangle(TabRectangle.Location.X + 2, TabRectangle.Location.Y + 2, 3, TabRectangle.Height - 4))
- Else
- g.FillRectangle(DarkBrush, TabRectangle)
- g.FillRectangle(NotSelectedColor, New Rectangle(TabRectangle.Location.X + 2, TabRectangle.Location.Y + 2, 3, TabRectangle.Height - 4))
- End If
- g.DrawString(TabPages(i).Text, Font, Brushes.White, TabRectangle, New StringFormat With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
- Next
- e.Graphics.DrawImage(bm.Clone, 0, 0)
- g.Dispose() : bm.Dispose()
- MyBase.OnPaint(e)
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment