Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System.Drawing.Drawing2D
- Imports System.ComponentModel
- Module Drawing
- Public Function RoundRect(ByVal rect As Rectangle, ByVal slope As Integer) As GraphicsPath
- Dim gp As GraphicsPath = New GraphicsPath()
- Dim arcWidth As Integer = slope * 2
- gp.AddArc(New Rectangle(rect.X, rect.Y, arcWidth, arcWidth), -180, 90)
- gp.AddArc(New Rectangle(rect.Width - arcWidth + rect.X, rect.Y, arcWidth, arcWidth), -90, 90)
- gp.AddArc(New Rectangle(rect.Width - arcWidth + rect.X, rect.Height - arcWidth + rect.Y, arcWidth, arcWidth), 0, 90)
- gp.AddArc(New Rectangle(rect.X, rect.Height - arcWidth + rect.Y, arcWidth, arcWidth), 90, 90)
- gp.CloseAllFigures()
- Return gp
- End Function
- End Module
- Module Prevent
- Public Sub Prevent(ByVal g As Graphics, ByVal w As Integer, ByVal h As Integer)
- Dim txt As String = System.Text.Encoding.UTF8.GetString(Convert.FromBase64String("VGhlbWUlMjBjcmVhdGVkJTIwYnklMjBIYXdrJTIwSEY=")).Replace("%20", " ")
- Dim txtSize As SizeF = g.MeasureString(txt, New Font("Arial", 8))
- g.DrawString(txt, New Font("Arial", 8), New SolidBrush(Color.FromArgb(125, 125, 125)), New Point(w - txtSize.Width - 6, h - txtSize.Height - 4))
- End Sub
- End Module
- Class ascTabControl
- Inherits TabControl
- Sub New()
- SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.ResizeRedraw Or
- ControlStyles.UserPaint Or ControlStyles.DoubleBuffer, True)
- ItemSize = New Size(0, 34)
- Padding = New Size(24, 0)
- Font = New Font("Arial", 12)
- End Sub
- Protected Overrides Sub CreateHandle()
- MyBase.CreateHandle()
- Alignment = TabAlignment.Top
- End Sub
- Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
- MyBase.OnPaint(e)
- Dim G As Graphics = e.Graphics
- G.SmoothingMode = SmoothingMode.HighQuality
- G.Clear(Parent.BackColor)
- Dim FontColor As New Color
- For i = 0 To TabCount - 1
- Dim mainRect As Rectangle = GetTabRect(i)
- If i = SelectedIndex Then
- FontColor = Color.FromArgb(255, 255, 255)
- G.DrawLine(New Pen(Color.FromArgb(255, 255, 255)), New Point(mainRect.X - 2, mainRect.Height - 1), New Point(mainRect.X + mainRect.Width - 2, mainRect.Height - 1))
- G.DrawLine(New Pen(Color.FromArgb(255, 255, 255)), New Point(mainRect.X - 2, mainRect.Height), New Point(mainRect.X + mainRect.Width - 2, mainRect.Height))
- Else
- FontColor = Color.FromArgb(255, 255, 255)
- G.DrawLine(New Pen(Color.FromArgb(6, 122, 89)), New Point(mainRect.X - 2, mainRect.Height - 1), New Point(mainRect.X + mainRect.Width - 2, mainRect.Height - 1))
- G.DrawLine(New Pen(Color.FromArgb(6, 122, 89)), New Point(mainRect.X - 2, mainRect.Height), New Point(mainRect.X + mainRect.Width - 2, mainRect.Height))
- End If
- If i <> 0 Then
- ' G.DrawLine(New Pen(Color.FromArgb(30, 90, 125)), New Point(mainRect.X - 4, mainRect.Height - 7), New Point(mainRect.X + 4, mainRect.Y + 6))
- End If
- Dim titleX As Integer = (mainRect.Location.X + mainRect.Width / 2) - (G.MeasureString(TabPages(i).Text, Font).Width / 2)
- Dim titleY As Integer = (mainRect.Location.Y + mainRect.Height / 2) - (G.MeasureString(TabPages(i).Text, Font).Height / 2)
- G.DrawString(TabPages(i).Text, Font, New SolidBrush(FontColor), New Point(titleX, titleY))
- Try : TabPages(i).BackColor = Parent.BackColor : Catch : End Try
- Next
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment