Guest User

Untitled

a guest
Dec 28th, 2017
344
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.68 KB | None | 0 0
  1. Imports System.Drawing.Drawing2D
  2. Imports System.ComponentModel
  3.  
  4. Module Drawing
  5.  
  6. Public Function RoundRect(ByVal rect As Rectangle, ByVal slope As Integer) As GraphicsPath
  7. Dim gp As GraphicsPath = New GraphicsPath()
  8. Dim arcWidth As Integer = slope * 2
  9. gp.AddArc(New Rectangle(rect.X, rect.Y, arcWidth, arcWidth), -180, 90)
  10. gp.AddArc(New Rectangle(rect.Width - arcWidth + rect.X, rect.Y, arcWidth, arcWidth), -90, 90)
  11. gp.AddArc(New Rectangle(rect.Width - arcWidth + rect.X, rect.Height - arcWidth + rect.Y, arcWidth, arcWidth), 0, 90)
  12. gp.AddArc(New Rectangle(rect.X, rect.Height - arcWidth + rect.Y, arcWidth, arcWidth), 90, 90)
  13. gp.CloseAllFigures()
  14. Return gp
  15. End Function
  16.  
  17. End Module
  18.  
  19. Module Prevent
  20.  
  21. Public Sub Prevent(ByVal g As Graphics, ByVal w As Integer, ByVal h As Integer)
  22. Dim txt As String = System.Text.Encoding.UTF8.GetString(Convert.FromBase64String("VGhlbWUlMjBjcmVhdGVkJTIwYnklMjBIYXdrJTIwSEY=")).Replace("%20", " ")
  23. Dim txtSize As SizeF = g.MeasureString(txt, New Font("Arial", 8))
  24. g.DrawString(txt, New Font("Arial", 8), New SolidBrush(Color.FromArgb(125, 125, 125)), New Point(w - txtSize.Width - 6, h - txtSize.Height - 4))
  25. End Sub
  26.  
  27. End Module
  28.  
  29.  
  30. Class ascTabControl
  31. Inherits TabControl
  32.  
  33. Sub New()
  34. SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.ResizeRedraw Or
  35. ControlStyles.UserPaint Or ControlStyles.DoubleBuffer, True)
  36. ItemSize = New Size(0, 34)
  37. Padding = New Size(24, 0)
  38. Font = New Font("Arial", 12)
  39. End Sub
  40.  
  41. Protected Overrides Sub CreateHandle()
  42. MyBase.CreateHandle()
  43. Alignment = TabAlignment.Top
  44. End Sub
  45.  
  46. Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  47. MyBase.OnPaint(e)
  48.  
  49. Dim G As Graphics = e.Graphics
  50.  
  51. G.SmoothingMode = SmoothingMode.HighQuality
  52. G.Clear(Parent.BackColor)
  53.  
  54. Dim FontColor As New Color
  55.  
  56. For i = 0 To TabCount - 1
  57.  
  58. Dim mainRect As Rectangle = GetTabRect(i)
  59.  
  60. If i = SelectedIndex Then
  61. FontColor = Color.FromArgb(255, 255, 255)
  62. 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))
  63. 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))
  64.  
  65. Else
  66.  
  67. FontColor = Color.FromArgb(255, 255, 255)
  68. 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))
  69. 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))
  70.  
  71. End If
  72.  
  73. If i <> 0 Then
  74. ' 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))
  75. End If
  76.  
  77. Dim titleX As Integer = (mainRect.Location.X + mainRect.Width / 2) - (G.MeasureString(TabPages(i).Text, Font).Width / 2)
  78. Dim titleY As Integer = (mainRect.Location.Y + mainRect.Height / 2) - (G.MeasureString(TabPages(i).Text, Font).Height / 2)
  79. G.DrawString(TabPages(i).Text, Font, New SolidBrush(FontColor), New Point(titleX, titleY))
  80.  
  81. Try : TabPages(i).BackColor = Parent.BackColor : Catch : End Try
  82.  
  83. Next
  84.  
  85. End Sub
  86.  
  87. End Class
Advertisement
Add Comment
Please, Sign In to add comment