Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ' Créé par AeroRev9.
- ' Custom Tab Control.
- Imports System.Drawing.Drawing2D
- Imports System.Drawing.Text
- Module Helpers
- Public Enum MouseState As Byte
- None = 0
- Over = 1
- Down = 2
- End Enum
- Public Sub CenterString(G As Graphics, text As String, font As Font, brush As Brush, rect As Rectangle)
- Dim textSize As SizeF = G.MeasureString(text, font)
- Dim textX As Integer = rect.X + (rect.Width / 2) - (textSize.Width / 2)
- Dim textY As Integer = rect.Y + (rect.Height / 2) - (textSize.Height / 2)
- G.DrawString(text, font, brush, textX, textY + 1)
- End Sub
- Public Sub RoundRect(ByVal G As Graphics,
- ByVal X As Integer,
- ByVal Y As Integer,
- ByVal Width As Integer,
- ByVal Height As Integer,
- ByVal Curve As Integer,
- ByVal Draw As Color)
- Dim BaseRect As New RectangleF(X, Y, Width,
- Height)
- Dim ArcRect As New RectangleF(BaseRect.Location,
- New SizeF(Curve, Curve))
- G.DrawArc(New Pen(Draw), ArcRect, 180, 90)
- G.DrawLine(New Pen(Draw), X + CInt(Curve / 2),
- Y,
- Y + Width - CInt(Curve / 2),
- Y)
- ArcRect.X = BaseRect.Right - Curve
- G.DrawArc(New Pen(Draw), ArcRect, 270, 90)
- G.DrawLine(New Pen(Draw), X + Width,
- Y + CInt(Curve / 2),
- X + Width,
- Y + Height - CInt(Curve / 2))
- ArcRect.Y = BaseRect.Bottom - Curve
- G.DrawArc(New Pen(Draw), ArcRect, 0, 90)
- G.DrawLine(New Pen(Draw), X + CInt(Curve / 2),
- Y + Height,
- X + Width - CInt(Curve / 2),
- Y + Height)
- ArcRect.X = BaseRect.Left
- G.DrawArc(New Pen(Draw), ArcRect, 90, 90)
- G.DrawLine(New Pen(Draw),
- X, Y + CInt(Curve / 2),
- X,
- Y + Height - CInt(Curve / 2))
- End Sub
- End Module
- Class CustomTab
- Inherits TabControl
- Sub New()
- DoubleBuffered = True
- End Sub
- Protected Overrides Sub OnCreateControl()
- MyBase.OnCreateControl()
- SetStyle(ControlStyles.UserPaint, True)
- Alignment = TabAlignment.Left
- ItemSize = New Point(30, 140)
- End Sub
- Protected Overrides Sub OnPaint(e As PaintEventArgs)
- Dim G As Graphics = e.Graphics
- G.SmoothingMode = SmoothingMode.HighQuality
- G.TextRenderingHint = TextRenderingHint.ClearTypeGridFit
- MyBase.OnPaint(e)
- G.Clear(Color.FromArgb(244, 244, 244))
- G.DrawRectangle(New Pen(Color.FromArgb(170, 170, 170)), New Rectangle(0, 0, Width - 1, Height - 1))
- For i As Integer = 0 To TabPages.Count - 1
- Try : TabPages(i).BackColor = Color.FromArgb(244, 244, 244) : Catch : End Try
- G.FillRectangle(New SolidBrush(Color.FromArgb(244, 244, 244)), GetTabRect(i))
- If SelectedIndex = i Then
- CenterString(G, TabPages(i).Text.ToUpper, New Font("Segoe UI", 9, FontStyle.Bold), New SolidBrush(Color.FromArgb(70, 150, 180)), GetTabRect(i))
- Else
- CenterString(G, TabPages(i).Text.ToUpper, New Font("Segoe UI", 9, FontStyle.Bold), New SolidBrush(Color.Black), GetTabRect(i))
- End If
- Next
- End Sub
- End Class
- Class BlackPaginator
- Inherits Control
- Sub New()
- DoubleBuffered = True
- End Sub
- Protected Overrides Sub OnPaint(e As PaintEventArgs)
- Dim G As Graphics = e.Graphics
- G.SmoothingMode = SmoothingMode.HighQuality
- G.TextRenderingHint = TextRenderingHint.ClearTypeGridFit
- MyBase.OnPaint(e)
- G.FillRectangle(New SolidBrush(Color.FromArgb(48, 48, 48)), New Rectangle(0, 0, Width - 1, Height - 1))
- Helpers.CenterString(G, Text, New Font("Segoe UI", 9), Brushes.White, New Rectangle(0, 0, Width - 1, Height - 1))
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement