Advertisement
xZ3ROxPROJ3CTx

BlackShades.NET (VB.NET Theme)

Sep 22nd, 2012
6,016
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 38.47 KB | None | 0 0
  1. Imports System, System.IO, System.Collections.Generic, System.Runtime.InteropServices, System.ComponentModel
  2. Imports System.Drawing, System.Drawing.Drawing2D, System.Drawing.Imaging, System.Windows.Forms
  3.  
  4. 'PLEASE LEAVE CREDITS IN SOURCE, DO NOT REDISTRIBUTE!
  5.  
  6. '--------------------- [ Theme ] --------------------
  7. 'Creator: Recuperare
  8. 'Contact: cschaefer2183 (Skype)
  9. 'Created: 09.22.2012
  10. 'Changed: 09.22.2012
  11. '-------------------- [ /Theme ] ---------------------
  12.  
  13. 'PLEASE LEAVE CREDITS IN SOURCE, DO NOT REDISTRIBUTE!
  14.  
  15.  
  16. Enum MouseState As Byte
  17.     None = 0
  18.     Over = 1
  19.     Down = 2
  20.     Block = 3
  21. End Enum
  22.  
  23. #Region " GLOBAL FUNCTIONS "
  24.  
  25. Class Draw
  26.     Public Function RoundRect(ByVal Rectangle As Rectangle, ByVal Curve As Integer) As GraphicsPath
  27.         Dim P As GraphicsPath = New GraphicsPath()
  28.         Dim ArcRectangleWidth As Integer = Curve * 2
  29.         P.AddArc(New Rectangle(Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -180, 90)
  30.         P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -90, 90)
  31.         P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 0, 90)
  32.         P.AddArc(New Rectangle(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 90, 90)
  33.         P.AddLine(New Point(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y), New Point(Rectangle.X, Curve + Rectangle.Y))
  34.         Return P
  35.     End Function
  36.     Public Function RoundRect(ByVal X As Integer, ByVal Y As Integer, ByVal Width As Integer, ByVal Height As Integer, ByVal Curve As Integer) As GraphicsPath
  37.         Dim Rectangle As Rectangle = New Rectangle(X, Y, Width, Height)
  38.         Dim P As GraphicsPath = New GraphicsPath()
  39.         Dim ArcRectangleWidth As Integer = Curve * 2
  40.         P.AddArc(New Rectangle(Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -180, 90)
  41.         P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -90, 90)
  42.         P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 0, 90)
  43.         P.AddArc(New Rectangle(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 90, 90)
  44.         P.AddLine(New Point(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y), New Point(Rectangle.X, Curve + Rectangle.Y))
  45.         Return P
  46.     End Function
  47. End Class
  48.  
  49. #End Region
  50.  
  51.  
  52. Public Class BlackShadesNetForm : Inherits ContainerControl
  53.  
  54. #Region " Control Help - Movement & Flicker Control "
  55.     Private MouseP As Point = New Point(0, 0)
  56.     Private Cap As Boolean = False
  57.     Private MoveHeight As Integer
  58.     Private pos As Integer = 0
  59.  
  60.     Private Sub minimBtnClick() Handles minimBtn.Click
  61.         ParentForm.FindForm.WindowState = FormWindowState.Minimized
  62.     End Sub
  63.     Private Sub closeBtnClick() Handles closeBtn.Click
  64.         If CloseButtonExitsApp Then
  65.             System.Environment.Exit(0)
  66.         Else
  67.             ParentForm.FindForm.Close()
  68.         End If
  69.     End Sub
  70.     Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  71.         MyBase.OnMouseDown(e)
  72.         If e.Button = Windows.Forms.MouseButtons.Left And New Rectangle(0, 0, Width, MoveHeight).Contains(e.Location) Then
  73.             Cap = True : MouseP = e.Location
  74.         End If
  75.     End Sub
  76.     Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
  77.         MyBase.OnMouseUp(e) : Cap = False
  78.     End Sub
  79.     Protected Overrides Sub OnMouseMove(ByVal e As System.Windows.Forms.MouseEventArgs)
  80.         MyBase.OnMouseMove(e)
  81.         If Cap Then
  82.             Parent.Location = MousePosition - MouseP
  83.         End If
  84.     End Sub
  85.     Protected Overrides Sub OnInvalidated(ByVal e As System.Windows.Forms.InvalidateEventArgs)
  86.         MyBase.OnInvalidated(e)
  87.         ParentForm.FindForm.Text = Text
  88.     End Sub
  89.     Protected Overrides Sub OnPaintBackground(ByVal e As System.Windows.Forms.PaintEventArgs)
  90.     End Sub
  91.     Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
  92.         MyBase.OnTextChanged(e)
  93.         Invalidate()
  94.     End Sub
  95.     Protected Overrides Sub OnCreateControl()
  96.         MyBase.OnCreateControl()
  97.         Me.ParentForm.FormBorderStyle = FormBorderStyle.None
  98.         Me.ParentForm.TransparencyKey = Color.Fuchsia
  99.     End Sub
  100.     Protected Overrides Sub CreateHandle()
  101.         MyBase.CreateHandle()
  102.     End Sub
  103.     Private _closesEnv As Boolean = False
  104.     Public Property CloseButtonExitsApp() As Boolean
  105.         Get
  106.             Return _closesEnv
  107.         End Get
  108.         Set(ByVal v As Boolean)
  109.             _closesEnv = v
  110.             Invalidate()
  111.         End Set
  112.     End Property
  113.  
  114.     Private _minimBool As Boolean = True
  115.     Public Property MinimizeButton() As Boolean
  116.         Get
  117.             Return _minimBool
  118.         End Get
  119.         Set(ByVal v As Boolean)
  120.             _minimBool = v
  121.             Invalidate()
  122.         End Set
  123.     End Property
  124.  
  125. #End Region
  126.  
  127.     Dim WithEvents minimBtn As New BlackShadesNetTopButton With {.Location = New Point(Width - 44, 7)}
  128.     Dim WithEvents closeBtn As New BlackShadesNetTopButton With {.Location = New Point(Width - 27, 7)}
  129.  
  130.     Sub New()
  131.         MyBase.New()
  132.         Dock = DockStyle.Fill
  133.         MoveHeight = 25
  134.         Font = New Font("Trebuchet MS", 8.25F, FontStyle.Bold)
  135.         ForeColor = Color.FromArgb(142, 152, 156)
  136.         DoubleBuffered = True
  137.  
  138.         Controls.Add(closeBtn)
  139.  
  140.         closeBtn.Refresh() : minimBtn.Refresh()
  141.     End Sub
  142.  
  143.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  144.  
  145.         Const curve As Integer = 7
  146.         Dim B As New Bitmap(Width, Height)
  147.         Dim G As Graphics = Graphics.FromImage(B)
  148.  
  149.         If _minimBool Then
  150.             Controls.Add(minimBtn)
  151.         Else
  152.             Controls.Remove(minimBtn)
  153.         End If
  154.  
  155.         minimBtn.Location = New Point(Width - 44, 7)
  156.         closeBtn.Location = New Point(Width - 27, 7)
  157.  
  158.         G.SmoothingMode = SmoothingMode.Default
  159.         Dim ClientRectangle As New Rectangle(0, 0, Width - 1, Height - 1)
  160.         Dim TransparencyKey As Color = Me.ParentForm.TransparencyKey
  161.         Dim d As New Draw()
  162.         MyBase.OnPaint(e)
  163.  
  164.         G.Clear(TransparencyKey)
  165.  
  166.         G.FillPath(New SolidBrush(Color.FromArgb(42, 47, 49)), d.RoundRect(ClientRectangle, curve))
  167.  
  168.  
  169.         'DRAW GRADIENTED BORDER
  170.         Dim innerGradLeft As New LinearGradientBrush(New Rectangle(1, 1, Width / 2 - 1, Height - 3), _
  171.                                              Color.FromArgb(102, 108, 112), Color.FromArgb(204, 216, 224), 0S)
  172.         Dim innerGradRight As New LinearGradientBrush(New Rectangle(1, 1, Width / 2 - 1, Height - 3), _
  173.                                      Color.FromArgb(204, 216, 224), Color.FromArgb(102, 108, 112), 0S)
  174.         G.DrawPath(New Pen(innerGradLeft), d.RoundRect(New Rectangle(1, 1, Width / 2 + 3, Height - 3), curve))
  175.         G.DrawPath(New Pen(innerGradRight), d.RoundRect(New Rectangle(Width / 2 - 5, 1, Width / 2 + 3, Height - 3), curve))
  176.  
  177.  
  178.         G.FillPath(New SolidBrush(Color.FromArgb(42, 47, 49)), d.RoundRect(New Rectangle(2, 2, Width - 5, Height - 5), curve))
  179.  
  180.  
  181.         Dim topGradLeft As New LinearGradientBrush(New Rectangle(0, 0, Width - 1, 25), Color.FromArgb(42, 46, 48), _
  182.                                                    Color.FromArgb(93, 98, 101), 0S)
  183.         Dim topGradRight As New LinearGradientBrush(New Rectangle(0, 0, Width - 1, 25), Color.FromArgb(93, 98, 101), _
  184.                                            Color.FromArgb(42, 46, 48), 0S)
  185.         G.FillPath(topGradLeft, d.RoundRect(New Rectangle(2, 2, Width / 2 + 2, 25), curve))
  186.         G.FillPath(topGradRight, d.RoundRect(New Rectangle(Width / 2 - 3, 2, Width / 2 - 1, 25), curve))
  187.  
  188.         G.FillRectangle(New SolidBrush(Color.FromArgb(42, 47, 49)), New Rectangle(2, 23, Width - 5, 10))
  189.  
  190.         G.DrawPath(New Pen(Color.FromArgb(42, 46, 48)), d.RoundRect(New Rectangle(2, 2, Width - 5, Height - 5), curve))
  191.         G.DrawPath(New Pen(Color.FromArgb(9, 11, 12)), d.RoundRect(ClientRectangle, curve))
  192.  
  193.         G.DrawString(Text, Font, Brushes.White, New Rectangle(curve, curve - 2, Width - 1, 22), New StringFormat() With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Near})
  194.  
  195.         e.Graphics.DrawImage(B.Clone(), 0, 0)
  196.         G.Dispose() : B.Dispose()
  197.     End Sub
  198. End Class
  199.  
  200. Public Class BlackShadesNetButton : Inherits Control
  201.  
  202. #Region " Control Help - MouseState & Flicker Control"
  203.     Private State As MouseState = MouseState.None
  204.     Protected Overrides Sub OnMouseEnter(ByVal e As System.EventArgs)
  205.         MyBase.OnMouseEnter(e)
  206.         State = MouseState.Over
  207.         Invalidate()
  208.     End Sub
  209.     Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  210.         MyBase.OnMouseDown(e)
  211.         State = MouseState.Down
  212.         Invalidate()
  213.     End Sub
  214.     Protected Overrides Sub OnMouseLeave(ByVal e As System.EventArgs)
  215.         MyBase.OnMouseLeave(e)
  216.         State = MouseState.None
  217.         Invalidate()
  218.     End Sub
  219.     Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
  220.         MyBase.OnMouseUp(e)
  221.         State = MouseState.Over
  222.         Invalidate()
  223.     End Sub
  224.     Protected Overrides Sub OnPaintBackground(ByVal pevent As System.Windows.Forms.PaintEventArgs)
  225.     End Sub
  226.     Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
  227.         MyBase.OnTextChanged(e)
  228.         Invalidate()
  229.     End Sub
  230.     Private _align As StringAlignment = StringAlignment.Center
  231.     Public Shadows Property TextAlignment() As StringAlignment
  232.         Get
  233.             Return _align
  234.         End Get
  235.         Set(ByVal v As StringAlignment)
  236.             _align = v
  237.             Invalidate()
  238.         End Set
  239.     End Property
  240.  
  241. #End Region
  242.  
  243.     Sub New()
  244.         MyBase.New()
  245.         BackColor = Color.FromArgb(38, 38, 38)
  246.         Font = New Font("Trebuchet MS", 8.25F, FontStyle.Bold)
  247.         'ForeColor = Color.FromArgb(142, 152, 156)
  248.         ForeColor = Color.White
  249.         DoubleBuffered = True
  250.         Size = New Size(75, 23)
  251.     End Sub
  252.  
  253.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  254.         Dim B As New Bitmap(Width, Height)
  255.         Dim G As Graphics = Graphics.FromImage(B)
  256.  
  257.         Const curve As Integer = 3
  258.         Dim ClientRectangle = New Rectangle(0, 0, Width - 1, Height - 1)
  259.  
  260.         Dim d As New Draw()
  261.         G.SmoothingMode = SmoothingMode.HighQuality
  262.         'G.Clear(Color.FromArgb(20, 20, 20))
  263.         'Dim bg As Color = Parent.FindForm.BackColor
  264.         G.Clear(Color.FromArgb(42, 47, 49))
  265.  
  266.         Select Case State
  267.             Case MouseState.None 'Mouse None
  268.                 G.FillPath(New SolidBrush(Color.FromArgb(32, 36, 38)), d.RoundRect(New Rectangle(0, 0, Width - 1, Height - 2), curve))
  269.                 Dim gloss As New LinearGradientBrush(New Rectangle(1, 1, Width - 5, Height / 2 - 3), Color.FromArgb(70, Color.White), Color.Transparent, 90S)
  270.                 G.FillPath(gloss, d.RoundRect(New Rectangle(0, 0, Width - 1, Height / 2 - 3), curve))
  271.                 Dim borderRect As New LinearGradientBrush(ClientRectangle, Color.FromArgb(36, 31, 43), Color.FromArgb(61, 65, 68), 90S)
  272.                 G.DrawPath(New Pen(Color.FromArgb(99, 103, 105)), d.RoundRect(New Rectangle(0, 1, Width - 1, Height - 3), curve))
  273.                 G.DrawPath(New Pen(borderRect), d.RoundRect(New Rectangle(0, 0, Width - 1, Height - 2), curve))
  274.                 G.DrawPath(New Pen(Color.FromArgb(27, 31, 33)), d.RoundRect(New Rectangle(1, 0, Width - 3, Height - 3), curve))
  275.             Case MouseState.Over 'Mouse Hover
  276.                 G.FillPath(New SolidBrush(Color.FromArgb(32, 36, 38)), d.RoundRect(New Rectangle(0, 0, Width - 1, Height - 2), curve))
  277.                 Dim gloss As New LinearGradientBrush(New Rectangle(1, 1, Width - 5, Height / 2 - 3), Color.FromArgb(70, Color.White), Color.Transparent, 90S)
  278.                 G.FillPath(gloss, d.RoundRect(New Rectangle(0, 0, Width - 1, Height / 2 - 3), curve))
  279.                 Dim borderRect As New LinearGradientBrush(ClientRectangle, Color.FromArgb(36, 31, 43), Color.FromArgb(61, 65, 68), 90S)
  280.                 G.DrawPath(New Pen(Color.FromArgb(99, 103, 105)), d.RoundRect(New Rectangle(0, 1, Width - 1, Height - 3), curve))
  281.                 G.DrawPath(New Pen(Color.FromArgb(100, 99, 103, 105)), d.RoundRect(New Rectangle(2, 2, Width - 5, Height - 6), curve))
  282.                 G.DrawPath(New Pen(borderRect), d.RoundRect(New Rectangle(0, 0, Width - 1, Height - 2), curve))
  283.                 G.DrawPath(New Pen(Color.FromArgb(27, 31, 33)), d.RoundRect(New Rectangle(1, 0, Width - 3, Height - 3), curve))
  284.                 G.DrawPath(New Pen(Color.FromArgb(0, 186, 255)), d.RoundRect(New Rectangle(1, 1, Width - 3, Height - 4), curve))
  285.             Case MouseState.Down 'Mouse Down
  286.                 G.FillPath(New SolidBrush(Color.FromArgb(32, 36, 38)), d.RoundRect(New Rectangle(0, 0, Width - 1, Height - 2), curve))
  287.                 Dim topGrad As New LinearGradientBrush(New Rectangle(0, 0, Width - 1, Height / 2 - 1), Color.FromArgb(32, 36, 38), Color.FromArgb(57, 57, 57), 90S)
  288.                 G.FillPath(topGrad, d.RoundRect(New Rectangle(0, 0, Width - 1, Height / 2 + 1), curve))
  289.                 Dim botGrad As New LinearGradientBrush(New Rectangle(0, 0, Width - 1, Height / 2 - 1), Color.FromArgb(57, 57, 57), Color.FromArgb(32, 36, 38), 90S)
  290.                 G.FillPath(botGrad, d.RoundRect(New Rectangle(0, Height / 2 - 1, Width - 1, Height / 2 + 2), curve))
  291.                 G.DrawLine(New Pen(Color.FromArgb(57, 57, 57)), 0, Convert.ToInt32(Height / 2 - 1), Width - 1, Convert.ToInt32(Height / 2 - 1))
  292.  
  293.                 Dim borderRect As New LinearGradientBrush(ClientRectangle, Color.FromArgb(36, 31, 43), Color.FromArgb(61, 65, 68), 90S)
  294.                 G.DrawPath(New Pen(borderRect), d.RoundRect(New Rectangle(0, 0, Width - 1, Height - 2), curve))
  295.                 G.DrawPath(New Pen(Color.FromArgb(27, 31, 33)), d.RoundRect(New Rectangle(1, 0, Width - 3, Height - 3), curve))
  296.  
  297.         End Select
  298.  
  299.         'G.DrawRectangle(Pens.Black, ClientRectangle)
  300.  
  301.         'G.DrawString(Text, Font, Brushes.Black, New Rectangle(-1, -2, Width - 1, Height - 1), New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
  302.         G.DrawString(Text, Font, New SolidBrush(ForeColor), New Rectangle(-1, -1, Width - 1, Height - 1), New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
  303.  
  304.         e.Graphics.DrawImage(B.Clone(), 0, 0)
  305.         G.Dispose() : B.Dispose()
  306.     End Sub
  307. End Class
  308.  
  309. Public Class BlackShadesNetTopButton : Inherits Control
  310. #Region " Control Help - MouseState & Flicker Control"
  311.  
  312.     Private State As MouseState = MouseState.None
  313.  
  314.     Protected Overrides Sub OnMouseEnter(ByVal e As System.EventArgs)
  315.         MyBase.OnMouseEnter(e)
  316.         State = MouseState.Over
  317.         Invalidate()
  318.     End Sub
  319.     Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  320.         MyBase.OnMouseDown(e)
  321.         State = MouseState.Down
  322.         Invalidate()
  323.     End Sub
  324.     Protected Overrides Sub OnMouseLeave(ByVal e As System.EventArgs)
  325.         MyBase.OnMouseLeave(e)
  326.         State = MouseState.None
  327.         Invalidate()
  328.     End Sub
  329.     Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
  330.         MyBase.OnMouseUp(e)
  331.         State = MouseState.Over
  332.         Invalidate()
  333.     End Sub
  334.     Protected Overrides Sub OnPaintBackground(ByVal pevent As System.Windows.Forms.PaintEventArgs)
  335.     End Sub
  336.     Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
  337.         MyBase.OnTextChanged(e)
  338.         Invalidate()
  339.     End Sub
  340. #End Region
  341.  
  342.     Sub New()
  343.         MyBase.New()
  344.         BackColor = Color.FromArgb(38, 38, 38)
  345.         Font = New Font("Verdana", 8.25F)
  346.         Size = New Size(15, 11)
  347.         DoubleBuffered = True
  348.         Focus()
  349.     End Sub
  350.  
  351.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  352.         Dim B As New Bitmap(Width, Height)
  353.         Dim G As Graphics = Graphics.FromImage(B)
  354.         Dim d As New Draw()
  355.  
  356.         Dim ClientRectangle As New Rectangle(0, 0, Width - 1, Height - 1)
  357.  
  358.         Size = New Size(15, 11)
  359.         G.Clear(Color.FromArgb(49, 53, 55))
  360.  
  361.         Select Case State
  362.             Case MouseState.None 'Mouse None
  363.                 Dim border As New LinearGradientBrush(ClientRectangle, Color.FromArgb(200, 44, 47, 51), Color.FromArgb(80, 64, 69, 71), 90S)
  364.                 G.FillPath(border, d.RoundRect(ClientRectangle, 1))
  365.                 Dim bodyGrad As New LinearGradientBrush(New Rectangle(2, 2, Width - 6, Height - 6), Color.FromArgb(90, 97, 101), Color.FromArgb(63, 69, 73), 90S)
  366.                 G.FillPath(bodyGrad, d.RoundRect(New Rectangle(2, 2, Width - 6, Height - 6), 1))
  367.                 G.DrawPath(New Pen(Color.FromArgb(30, 32, 35)), d.RoundRect(New Rectangle(2, 2, Width - 6, Height - 6), 1))
  368.             Case MouseState.Over
  369.                 Dim border As New LinearGradientBrush(ClientRectangle, Color.FromArgb(200, 44, 47, 51), Color.FromArgb(80, 64, 69, 71), 90S)
  370.                 G.FillPath(border, d.RoundRect(ClientRectangle, 1))
  371.                 Dim bodyGrad As New LinearGradientBrush(New Rectangle(2, 2, Width - 6, Height - 6), Color.FromArgb(90, 97, 101), Color.FromArgb(63, 69, 73), 90S)
  372.                 G.FillPath(bodyGrad, d.RoundRect(New Rectangle(2, 2, Width - 6, Height - 6), 1))
  373.                 G.DrawPath(New Pen(Color.FromArgb(30, 32, 35)), d.RoundRect(New Rectangle(2, 2, Width - 6, Height - 6), 1))
  374.                 G.DrawPath(New Pen(Color.FromArgb(200, 0, 186, 255)), d.RoundRect(New Rectangle(2, 2, Width - 6, Height - 6), 1))
  375.             Case MouseState.Down
  376.                 Dim border As New LinearGradientBrush(ClientRectangle, Color.FromArgb(200, 44, 47, 51), Color.FromArgb(80, 64, 69, 71), 90S)
  377.                 G.FillPath(border, d.RoundRect(ClientRectangle, 1))
  378.                 Dim bodyGrad As New LinearGradientBrush(New Rectangle(2, 2, Width - 6, Height - 6), Color.FromArgb(90, 97, 101), Color.FromArgb(63, 69, 73), 135S)
  379.                 G.FillPath(bodyGrad, d.RoundRect(New Rectangle(2, 2, Width - 6, Height - 6), 1))
  380.                 G.DrawPath(New Pen(Color.FromArgb(30, 32, 35)), d.RoundRect(New Rectangle(2, 2, Width - 6, Height - 6), 1))
  381.         End Select
  382.  
  383.         e.Graphics.DrawImage(B.Clone(), 0, 0)
  384.         G.Dispose() : B.Dispose()
  385.     End Sub
  386. End Class
  387.  
  388. Public Class BlackShadesNetMultiLineTextBox : Inherits Control
  389.     Dim WithEvents txtbox As New TextBox
  390.  
  391. #Region " Control Help - Properties & Flicker Control "
  392.     Private _maxchars As Integer = 32767
  393.     Public Property MaxCharacters() As Integer
  394.         Get
  395.             Return _maxchars
  396.         End Get
  397.         Set(ByVal v As Integer)
  398.             _maxchars = v
  399.             Invalidate()
  400.         End Set
  401.     End Property
  402.     Private _align As HorizontalAlignment
  403.     Public Shadows Property TextAlignment() As HorizontalAlignment
  404.         Get
  405.             Return _align
  406.         End Get
  407.         Set(ByVal v As HorizontalAlignment)
  408.             _align = v
  409.             Invalidate()
  410.         End Set
  411.     End Property
  412.  
  413.  
  414.     Protected Overrides Sub OnPaintBackground(ByVal pevent As System.Windows.Forms.PaintEventArgs)
  415.     End Sub
  416.     Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
  417.         MyBase.OnTextChanged(e)
  418.         Invalidate()
  419.     End Sub
  420.     Protected Overrides Sub OnBackColorChanged(ByVal e As System.EventArgs)
  421.         MyBase.OnBackColorChanged(e)
  422.         txtbox.BackColor = BackColor
  423.         Invalidate()
  424.     End Sub
  425.     Protected Overrides Sub OnForeColorChanged(ByVal e As System.EventArgs)
  426.         MyBase.OnForeColorChanged(e)
  427.         txtbox.ForeColor = ForeColor
  428.         Invalidate()
  429.     End Sub
  430.     Protected Overrides Sub OnSizeChanged(ByVal e As System.EventArgs)
  431.         MyBase.OnSizeChanged(e)
  432.         txtbox.Size = New Size(Width - 10, Height - 11)
  433.     End Sub
  434.     Protected Overrides Sub OnFontChanged(ByVal e As System.EventArgs)
  435.         MyBase.OnFontChanged(e)
  436.         txtbox.Font = Font
  437.     End Sub
  438.     Protected Overrides Sub OnGotFocus(ByVal e As System.EventArgs)
  439.         MyBase.OnGotFocus(e)
  440.         txtbox.Focus()
  441.     End Sub
  442.     Sub TextChngTxtBox() Handles txtbox.TextChanged
  443.         Text = txtbox.Text
  444.     End Sub
  445.     Sub TextChng() Handles MyBase.TextChanged
  446.         txtbox.Text = Text
  447.     End Sub
  448.     Sub NewTextBox()
  449.         With txtbox
  450.             .Multiline = True
  451.             .BackColor = BackColor
  452.             .ForeColor = ForeColor
  453.             .Text = String.Empty
  454.             .TextAlign = HorizontalAlignment.Center
  455.             .BorderStyle = BorderStyle.None
  456.             .Location = New Point(3, 4)
  457.             .Font = New Font("Trebuchet MS", 8.25F, FontStyle.Bold)
  458.             .Size = New Size(Width - 10, Height - 10)
  459.         End With
  460.         txtbox.Font = New Font("Trebuchet MS", 8.25F, FontStyle.Bold)
  461.     End Sub
  462. #End Region
  463.  
  464.     Sub New()
  465.         MyBase.New()
  466.  
  467.         NewTextBox()
  468.         Controls.Add(txtbox)
  469.  
  470.         Text = ""
  471.         BackColor = Color.FromArgb(36, 40, 42)
  472.         ForeColor = Color.FromArgb(142, 152, 156)
  473.         Size = New Size(135, 35)
  474.         DoubleBuffered = True
  475.     End Sub
  476.  
  477.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  478.         Dim B As New Bitmap(Width, Height)
  479.         Dim G As Graphics = Graphics.FromImage(B)
  480.         G.SmoothingMode = SmoothingMode.HighQuality
  481.         Dim d As New Draw()
  482.         Dim ClientRectangle As New Rectangle(0, 0, Width - 1, Height - 1)
  483.  
  484.         txtbox.TextAlign = TextAlignment
  485.  
  486.         G.Clear(Color.FromArgb(36, 40, 42))
  487.  
  488.         G.FillRectangle(New SolidBrush(Color.FromArgb(36, 40, 42)), ClientRectangle)
  489.         G.DrawRectangle(New Pen(Color.FromArgb(53, 57, 60)), ClientRectangle)
  490.  
  491.         e.Graphics.DrawImage(B.Clone(), 0, 0)
  492.         G.Dispose() : B.Dispose()
  493.     End Sub
  494. End Class
  495.  
  496. Public Class BlackShadesNetTextBox : Inherits Control
  497.     Dim WithEvents txtbox As New TextBox
  498.  
  499. #Region " Control Help - Properties & Flicker Control "
  500.     Private _passmask As Boolean = False
  501.     Public Shadows Property UseSystemPasswordChar() As Boolean
  502.         Get
  503.             Return _passmask
  504.         End Get
  505.         Set(ByVal v As Boolean)
  506.             txtbox.UseSystemPasswordChar = UseSystemPasswordChar
  507.             _passmask = v
  508.             Invalidate()
  509.         End Set
  510.     End Property
  511.     Private _maxchars As Integer = 32767
  512.     Public Shadows Property MaxLength() As Integer
  513.         Get
  514.             Return _maxchars
  515.         End Get
  516.         Set(ByVal v As Integer)
  517.             _maxchars = v
  518.             txtbox.MaxLength = MaxLength
  519.             Invalidate()
  520.         End Set
  521.     End Property
  522.     Private _align As HorizontalAlignment
  523.     Public Shadows Property TextAlignment() As HorizontalAlignment
  524.         Get
  525.             Return _align
  526.         End Get
  527.         Set(ByVal v As HorizontalAlignment)
  528.             _align = v
  529.             Invalidate()
  530.         End Set
  531.     End Property
  532.  
  533.     Protected Overrides Sub OnPaintBackground(ByVal pevent As System.Windows.Forms.PaintEventArgs)
  534.     End Sub
  535.     Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
  536.         MyBase.OnTextChanged(e)
  537.         Invalidate()
  538.     End Sub
  539.     Protected Overrides Sub OnBackColorChanged(ByVal e As System.EventArgs)
  540.         MyBase.OnBackColorChanged(e)
  541.         txtbox.BackColor = BackColor
  542.         Invalidate()
  543.     End Sub
  544.     Protected Overrides Sub OnForeColorChanged(ByVal e As System.EventArgs)
  545.         MyBase.OnForeColorChanged(e)
  546.         txtbox.ForeColor = ForeColor
  547.         Invalidate()
  548.     End Sub
  549.     Protected Overrides Sub OnFontChanged(ByVal e As System.EventArgs)
  550.         MyBase.OnFontChanged(e)
  551.         txtbox.Font = Font
  552.     End Sub
  553.     Protected Overrides Sub OnGotFocus(ByVal e As System.EventArgs)
  554.         MyBase.OnGotFocus(e)
  555.         txtbox.Focus()
  556.     End Sub
  557.     Sub TextChngTxtBox() Handles txtbox.TextChanged
  558.         Text = txtbox.Text
  559.     End Sub
  560.     Sub TextChng() Handles MyBase.TextChanged
  561.         txtbox.Text = Text
  562.     End Sub
  563.     Sub NewTextBox()
  564.         With txtbox
  565.             .Multiline = False
  566.             .BackColor = Color.FromArgb(43, 43, 43)
  567.             .ForeColor = ForeColor
  568.             .Text = String.Empty
  569.             .TextAlign = HorizontalAlignment.Center
  570.             .BorderStyle = BorderStyle.None
  571.             .Location = New Point(5, 4)
  572.             .Font = New Font("Trebuchet MS", 8.25F, FontStyle.Bold)
  573.             .Size = New Size(Width - 10, Height - 11)
  574.             .UseSystemPasswordChar = UseSystemPasswordChar
  575.         End With
  576.  
  577.     End Sub
  578. #End Region
  579.  
  580.     Sub New()
  581.         MyBase.New()
  582.  
  583.         NewTextBox()
  584.         Controls.Add(txtbox)
  585.  
  586.         Text = ""
  587.         BackColor = Color.FromArgb(36, 40, 42)
  588.         ForeColor = Color.FromArgb(142, 152, 156)
  589.         Size = New Size(135, 35)
  590.         DoubleBuffered = True
  591.     End Sub
  592.  
  593.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  594.         Dim B As New Bitmap(Width, Height)
  595.         Dim G As Graphics = Graphics.FromImage(B)
  596.         G.SmoothingMode = SmoothingMode.HighQuality
  597.         Dim d As New Draw()
  598.         Dim ClientRectangle As New Rectangle(0, 0, Width - 1, Height - 1)
  599.  
  600.         Height = txtbox.Height + 11
  601.         With txtbox
  602.             .Width = Width - 10
  603.             .TextAlign = TextAlignment
  604.             .UseSystemPasswordChar = UseSystemPasswordChar
  605.         End With
  606.  
  607.         G.Clear(Color.FromArgb(36, 40, 42))
  608.  
  609.         G.FillRectangle(New SolidBrush(Color.FromArgb(36, 40, 42)), ClientRectangle)
  610.         G.DrawRectangle(New Pen(Color.FromArgb(53, 57, 60)), ClientRectangle)
  611.  
  612.         e.Graphics.DrawImage(B.Clone(), 0, 0)
  613.         G.Dispose() : B.Dispose()
  614.     End Sub
  615. End Class
  616.  
  617. Public Class BlackShadesNetRichTextBox : Inherits Control
  618.     Dim WithEvents txtbox As New RichTextBox
  619.  
  620. #Region " Control Help - Properties & Flicker Control "
  621.  
  622.  
  623.     Protected Overrides Sub OnPaintBackground(ByVal pevent As System.Windows.Forms.PaintEventArgs)
  624.     End Sub
  625.     Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
  626.         MyBase.OnTextChanged(e)
  627.         Invalidate()
  628.     End Sub
  629.     Protected Overrides Sub OnBackColorChanged(ByVal e As System.EventArgs)
  630.         MyBase.OnBackColorChanged(e)
  631.         txtbox.BackColor = BackColor
  632.         Invalidate()
  633.     End Sub
  634.     Protected Overrides Sub OnForeColorChanged(ByVal e As System.EventArgs)
  635.         MyBase.OnForeColorChanged(e)
  636.         txtbox.ForeColor = ForeColor
  637.         Invalidate()
  638.     End Sub
  639.     Protected Overrides Sub OnSizeChanged(ByVal e As System.EventArgs)
  640.         MyBase.OnSizeChanged(e)
  641.         txtbox.Size = New Size(Width - 10, Height - 11)
  642.     End Sub
  643.     Protected Overrides Sub OnFontChanged(ByVal e As System.EventArgs)
  644.         MyBase.OnFontChanged(e)
  645.         txtbox.Font = Font
  646.     End Sub
  647.     Protected Overrides Sub OnGotFocus(ByVal e As System.EventArgs)
  648.         MyBase.OnGotFocus(e)
  649.         txtbox.Focus()
  650.     End Sub
  651.     Sub TextChngTxtBox() Handles txtbox.TextChanged
  652.         Text = txtbox.Text
  653.     End Sub
  654.     Sub TextChng() Handles MyBase.TextChanged
  655.         txtbox.Text = Text
  656.     End Sub
  657.     Sub NewTextBox()
  658.         With txtbox
  659.             .Multiline = True
  660.             .BackColor = BackColor
  661.             .ForeColor = ForeColor
  662.             .Text = String.Empty
  663.             .BorderStyle = BorderStyle.None
  664.             .Location = New Point(3, 4)
  665.             .Font = New Font("Trebuchet MS", 8.25F, FontStyle.Bold)
  666.             .Size = New Size(Width - 10, Height - 10)
  667.         End With
  668.         txtbox.Font = New Font("Trebuchet MS", 8.25F, FontStyle.Bold)
  669.     End Sub
  670. #End Region
  671.  
  672.     Sub New()
  673.         MyBase.New()
  674.  
  675.         NewTextBox()
  676.         Controls.Add(txtbox)
  677.  
  678.         Text = ""
  679.         BackColor = Color.FromArgb(36, 40, 42)
  680.         ForeColor = Color.FromArgb(142, 152, 156)
  681.         Size = New Size(135, 35)
  682.         DoubleBuffered = True
  683.     End Sub
  684.  
  685.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  686.         Dim B As New Bitmap(Width, Height)
  687.         Dim G As Graphics = Graphics.FromImage(B)
  688.         G.SmoothingMode = SmoothingMode.HighQuality
  689.         Dim d As New Draw()
  690.         Dim ClientRectangle As New Rectangle(0, 0, Width - 1, Height - 1)
  691.  
  692.         G.Clear(Color.FromArgb(36, 40, 42))
  693.  
  694.         G.DrawRectangle(New Pen(Color.FromArgb(30, 33, 35), 2), ClientRectangle)
  695.         G.DrawLine(New Pen(Color.FromArgb(83, 90, 94)), Width - 1, 0, Width - 1, Height)
  696.         G.DrawLine(New Pen(Color.FromArgb(83, 90, 94)), 0, Height - 1, Width - 1, Height - 1)
  697.  
  698.         e.Graphics.DrawImage(B.Clone(), 0, 0)
  699.         G.Dispose() : B.Dispose()
  700.     End Sub
  701. End Class
  702.  
  703. <DefaultEvent("CheckedChanged")> Public Class BlackShadesNetCheckBox : Inherits Control
  704.  
  705. #Region " Control Help - MouseState & Flicker Control"
  706.     Private State As MouseState = MouseState.None
  707.     Protected Overrides Sub OnMouseEnter(ByVal e As System.EventArgs)
  708.         MyBase.OnMouseEnter(e)
  709.         State = MouseState.Over
  710.         Invalidate()
  711.     End Sub
  712.     Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  713.         MyBase.OnMouseDown(e)
  714.         State = MouseState.Down
  715.         Invalidate()
  716.     End Sub
  717.     Protected Overrides Sub OnMouseLeave(ByVal e As System.EventArgs)
  718.         MyBase.OnMouseLeave(e)
  719.         State = MouseState.None
  720.         Invalidate()
  721.     End Sub
  722.     Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
  723.         MyBase.OnMouseUp(e)
  724.         State = MouseState.Over
  725.         Invalidate()
  726.     End Sub
  727.     Protected Overrides Sub OnPaintBackground(ByVal pevent As System.Windows.Forms.PaintEventArgs)
  728.     End Sub
  729.     Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
  730.         MyBase.OnTextChanged(e)
  731.         Invalidate()
  732.     End Sub
  733.     Private _Checked As Boolean
  734.     Property Checked() As Boolean
  735.         Get
  736.             Return _Checked
  737.         End Get
  738.         Set(ByVal value As Boolean)
  739.             _Checked = value
  740.             Invalidate()
  741.         End Set
  742.     End Property
  743.     Protected Overrides Sub OnResize(ByVal e As System.EventArgs)
  744.         MyBase.OnResize(e)
  745.         Height = 14
  746.     End Sub
  747.     Protected Overrides Sub OnClick(ByVal e As System.EventArgs)
  748.         _Checked = Not _Checked
  749.         RaiseEvent CheckedChanged(Me)
  750.         MyBase.OnClick(e)
  751.     End Sub
  752.     Event CheckedChanged(ByVal sender As Object)
  753. #End Region
  754.  
  755.     Sub New()
  756.         MyBase.New()
  757.         BackColor = Color.FromArgb(20, 20, 20)
  758.         ForeColor = Color.White
  759.         Size = New Size(145, 16)
  760.     End Sub
  761.  
  762.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  763.         Dim B As New Bitmap(Width, Height)
  764.         Dim G As Graphics = Graphics.FromImage(B)
  765.         Dim d As New Draw()
  766.  
  767.         Dim checkBoxRectangle As New Rectangle(0, 0, Height - 1, Height - 1)
  768.  
  769.         G.Clear(Color.FromArgb(42, 47, 49))
  770.  
  771.         Dim bodyGrad As New LinearGradientBrush(checkBoxRectangle, Color.FromArgb(36, 40, 42), Color.FromArgb(64, 71, 74), 90S)
  772.         G.FillRectangle(bodyGrad, bodyGrad.Rectangle)
  773.         G.DrawRectangle(New Pen(Color.FromArgb(42, 47, 49)), New Rectangle(1, 1, Height - 3, Height - 3))
  774.         G.DrawRectangle(New Pen(Color.FromArgb(102, 108, 112)), checkBoxRectangle)
  775.  
  776.  
  777.         If Checked Then
  778.             Dim chkPoly As Rectangle = New Rectangle(checkBoxRectangle.X + checkBoxRectangle.Width / 4, checkBoxRectangle.Y + checkBoxRectangle.Height / 4, checkBoxRectangle.Width \ 2, checkBoxRectangle.Height \ 2)
  779.             Dim Poly() As Point = {New Point(chkPoly.X, chkPoly.Y + chkPoly.Height \ 2), _
  780.                            New Point(chkPoly.X + chkPoly.Width \ 2, chkPoly.Y + chkPoly.Height), _
  781.                            New Point(chkPoly.X + chkPoly.Width, chkPoly.Y)}
  782.             G.SmoothingMode = SmoothingMode.HighQuality
  783.             Dim P1 As New Pen(Color.FromArgb(250, 255, 255, 255), 2)
  784.             Dim chkGrad As New LinearGradientBrush(chkPoly, Color.FromArgb(200, 200, 200), Color.FromArgb(255, 255, 255), 0S)
  785.             For i = 0 To Poly.Length - 2
  786.                 G.DrawLine(P1, Poly(i), Poly(i + 1))
  787.             Next
  788.         End If
  789.         G.DrawString(Text, Font, New SolidBrush(ForeColor), New Point(18, -1), New StringFormat With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Near})
  790.  
  791.         e.Graphics.DrawImage(B.Clone(), 0, 0)
  792.         G.Dispose() : B.Dispose()
  793.  
  794.     End Sub
  795.  
  796. End Class
  797.  
  798. <DefaultEvent("CheckedChanged")> Public Class BlackShadesNetRadioButton : Inherits Control
  799.  
  800. #Region " Control Help - MouseState & Flicker Control"
  801.     Private R1 As Rectangle
  802.     Private G1 As LinearGradientBrush
  803.  
  804.     Private State As MouseState = MouseState.None
  805.     Protected Overrides Sub OnMouseEnter(ByVal e As System.EventArgs)
  806.         MyBase.OnMouseEnter(e)
  807.         State = MouseState.Over
  808.         Invalidate()
  809.     End Sub
  810.     Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  811.         MyBase.OnMouseDown(e)
  812.         State = MouseState.Down
  813.         Invalidate()
  814.     End Sub
  815.     Protected Overrides Sub OnMouseLeave(ByVal e As System.EventArgs)
  816.         MyBase.OnMouseLeave(e)
  817.         State = MouseState.None
  818.         Invalidate()
  819.     End Sub
  820.     Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
  821.         MyBase.OnMouseUp(e)
  822.         State = MouseState.Over
  823.         Invalidate()
  824.     End Sub
  825.     Protected Overrides Sub OnResize(ByVal e As System.EventArgs)
  826.         MyBase.OnResize(e)
  827.         Height = 16
  828.     End Sub
  829.     Protected Overrides Sub OnPaintBackground(ByVal pevent As System.Windows.Forms.PaintEventArgs)
  830.     End Sub
  831.     Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
  832.         MyBase.OnTextChanged(e)
  833.         Invalidate()
  834.     End Sub
  835.     Private _Checked As Boolean
  836.     Property Checked() As Boolean
  837.         Get
  838.             Return _Checked
  839.         End Get
  840.         Set(ByVal value As Boolean)
  841.             _Checked = value
  842.             InvalidateControls()
  843.             RaiseEvent CheckedChanged(Me)
  844.             Invalidate()
  845.         End Set
  846.     End Property
  847.     Protected Overrides Sub OnClick(ByVal e As EventArgs)
  848.         If Not _Checked Then Checked = True
  849.         MyBase.OnClick(e)
  850.     End Sub
  851.     Event CheckedChanged(ByVal sender As Object)
  852.     Protected Overrides Sub OnCreateControl()
  853.         MyBase.OnCreateControl()
  854.         InvalidateControls()
  855.     End Sub
  856.     Private Sub InvalidateControls()
  857.         If Not IsHandleCreated OrElse Not _Checked Then Return
  858.  
  859.         For Each C As Control In Parent.Controls
  860.             If C IsNot Me AndAlso TypeOf C Is BlackShadesNetRadioButton Then
  861.                 DirectCast(C, BlackShadesNetRadioButton).Checked = False
  862.             End If
  863.         Next
  864.     End Sub
  865. #End Region
  866.  
  867.     Sub New()
  868.         MyBase.New()
  869.         BackColor = Color.FromArgb(42, 47, 49)
  870.         ForeColor = Color.White
  871.         Size = New Size(150, 16)
  872.     End Sub
  873.  
  874.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  875.         Dim B As New Bitmap(Width, Height)
  876.         Dim G As Graphics = Graphics.FromImage(B)
  877.         Dim d As New Draw()
  878.         Dim radioBtnRectangle = New Rectangle(0, 0, Height - 1, Height - 1)
  879.  
  880.         G.SmoothingMode = SmoothingMode.HighQuality
  881.         G.Clear(BackColor)
  882.  
  883.         Dim bgGrad As New LinearGradientBrush(radioBtnRectangle, Color.FromArgb(36, 40, 42), Color.FromArgb(66, 70, 72), 90S)
  884.         G.FillEllipse(bgGrad, radioBtnRectangle)
  885.  
  886.         G.DrawEllipse(New Pen(Color.FromArgb(44, 48, 50)), New Rectangle(1, 1, Height - 3, Height - 3))
  887.         G.DrawEllipse(New Pen(Color.FromArgb(102, 108, 112)), radioBtnRectangle)
  888.  
  889.         If Checked Then
  890.             Dim chkGrad As New LinearGradientBrush(New Rectangle(4, 4, Height - 9, Height - 8), Color.White, Color.Black, 90S)
  891.             G.FillEllipse(chkGrad, New Rectangle(4, 4, Height - 9, Height - 9))
  892.         End If
  893.  
  894.         G.DrawString(Text, Font, Brushes.White, New Point(18, 0), New StringFormat With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Near})
  895.  
  896.         e.Graphics.DrawImage(B.Clone(), 0, 0)
  897.         G.Dispose() : B.Dispose()
  898.     End Sub
  899.  
  900. End Class
  901.  
  902. Public Class BlackShadesNetGroupBox : Inherits ContainerControl
  903. #Region " Control Help - Properties & Flicker Control"
  904.     Protected Overrides Sub OnPaintBackground(ByVal pevent As System.Windows.Forms.PaintEventArgs)
  905.     End Sub
  906.     Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
  907.         MyBase.OnTextChanged(e)
  908.         Invalidate()
  909.     End Sub
  910. #End Region
  911.  
  912.     Sub New()
  913.         MyBase.New()
  914.         BackColor = Color.FromArgb(33, 33, 33)
  915.         Size = New Size(200, 100)
  916.     End Sub
  917.  
  918.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  919.         Dim B As New Bitmap(Width, Height)
  920.         Dim G As Graphics = Graphics.FromImage(B)
  921.  
  922.         G.SmoothingMode = SmoothingMode.HighSpeed
  923.         Const curve As Integer = 3
  924.         Dim ClientRectangle As New Rectangle(0, 0, Width - 1, Height - 1)
  925.         Dim TransparencyKey As Color = Me.ParentForm.TransparencyKey
  926.         Dim d As New Draw()
  927.         MyBase.OnPaint(e)
  928.  
  929.         G.Clear(Color.FromArgb(42, 47, 49))
  930.  
  931.  
  932.  
  933.         G.DrawPath(New Pen(Color.FromArgb(67, 75, 78)), d.RoundRect(New Rectangle(2, 7, Width - 5, Height - 9), curve))
  934.         Dim outerBorder As New LinearGradientBrush(ClientRectangle, Color.FromArgb(30, 32, 32), Color.Transparent, 90S)
  935.         G.DrawPath(New Pen(outerBorder), d.RoundRect(New Rectangle(1, 6, Width - 3, Height - 9), curve))
  936.         Dim innerBorder As New LinearGradientBrush(New Rectangle(3, 7, Width - 7, Height - 10), Color.Transparent, Color.FromArgb(30, 32, 32), 90S)
  937.         G.DrawPath(New Pen(innerBorder), d.RoundRect(New Rectangle(3, 7, Width - 7, Height - 10), curve))
  938.  
  939.         G.FillRectangle(New SolidBrush(Color.FromArgb(42, 47, 49)), New Rectangle(8, 0, Text.Length * 6, 11))
  940.  
  941.         G.DrawString(Text, Font, New SolidBrush(ForeColor), New Rectangle(8, 0, Width - 1, 11), New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Near})
  942.  
  943.         e.Graphics.DrawImage(B.Clone(), 0, 0)
  944.         G.Dispose() : B.Dispose()
  945.     End Sub
  946. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement