daily pastebin goal
68%
SHARE
TWEET

xVisual Theme [GDI+] [12 Controls] [Light & Dark] [Customiza

MephobiaHF Jun 19th, 2013 8,990 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Imports System.Drawing.Drawing2D
  2. Imports System.ComponentModel
  3.  
  4. 'PLEASE LEAVE CREDITS IN SOURCE, DO NOT REDISTRIBUTE!
  5.  
  6. '--------------------- [ Theme ] --------------------
  7. 'Creator: Mephobia
  8. 'Contact: Mephobia.HF (Skype)
  9. 'Created: 6.19.2013
  10. 'Changed: 6.19.2013
  11. '-------------------- [ /Theme ] ---------------------
  12.  
  13. 'PLEASE LEAVE CREDITS IN SOURCE, DO NOT REDISTRIBUTE!
  14.  
  15. Enum MouseState As Byte
  16.     None = 0
  17.     Over = 1
  18.     Down = 2
  19.     Block = 3
  20. End Enum
  21. Module Draw
  22.     Public Function GetBrush(ByVal c As Color) As SolidBrush
  23.         Return New SolidBrush(c)
  24.     End Function
  25.     Public Function GetPen(ByVal c As Color) As Pen
  26.         Return New Pen(New SolidBrush(c))
  27.     End Function
  28.     Function NoiseBrush(colors As Color()) As TextureBrush
  29.         Dim B As New Bitmap(128, 128)
  30.         Dim R As New Random(128)
  31.  
  32.         For X As Integer = 0 To B.Width - 1
  33.             For Y As Integer = 0 To B.Height - 1
  34.                 B.SetPixel(X, Y, colors(R.Next(colors.Length)))
  35.             Next
  36.         Next
  37.  
  38.         Dim T As New TextureBrush(B)
  39.         B.Dispose()
  40.  
  41.         Return T
  42.     End Function
  43.     Private CreateRoundPath As GraphicsPath
  44.     Private CreateCreateRoundangle As Rectangle
  45.    
  46.     Function CreateRound(ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal slope As Integer) As GraphicsPath
  47.         CreateCreateRoundangle = New Rectangle(x, y, width, height)
  48.         Return CreateRound(CreateCreateRoundangle, slope)
  49.     End Function
  50.  
  51.     Function CreateRound(ByVal r As Rectangle, ByVal slope As Integer) As GraphicsPath
  52.         CreateRoundPath = New GraphicsPath(FillMode.Winding)
  53.         CreateRoundPath.AddArc(r.X, r.Y, slope, slope, 180.0F, 90.0F)
  54.         CreateRoundPath.AddArc(r.Right - slope, r.Y, slope, slope, 270.0F, 90.0F)
  55.         CreateRoundPath.AddArc(r.Right - slope, r.Bottom - slope, slope, slope, 0.0F, 90.0F)
  56.         CreateRoundPath.AddArc(r.X, r.Bottom - slope, slope, slope, 90.0F, 90.0F)
  57.         CreateRoundPath.CloseFigure()
  58.         Return CreateRoundPath
  59.     End Function
  60.  
  61.     Public Sub InnerGlow(ByVal G As Graphics, ByVal Rectangle As Rectangle, ByVal Colors As Color())
  62.         Dim SubtractTwo As Integer = 1
  63.         Dim AddOne As Integer = 0
  64.         For Each c In Colors
  65.             G.DrawRectangle(New Pen(New SolidBrush(Color.FromArgb(c.R, c.B, c.G))), Rectangle.X + AddOne, Rectangle.Y + AddOne, Rectangle.Width - SubtractTwo, Rectangle.Height - SubtractTwo)
  66.             SubtractTwo += 2
  67.             AddOne += 1
  68.         Next
  69.     End Sub
  70.     Public Sub InnerGlowRounded(ByVal G As Graphics, ByVal Rectangle As Rectangle, ByVal Degree As Integer, ByVal Colors As Color())
  71.         Dim SubtractTwo As Integer = 1
  72.         Dim AddOne As Integer = 0
  73.         For Each c In Colors
  74.             G.DrawPath(New Pen(New SolidBrush(Color.FromArgb(c.R, c.B, c.G))), Draw.CreateRound(Rectangle.X + AddOne, Rectangle.Y + AddOne, Rectangle.Width - SubtractTwo, Rectangle.Height - SubtractTwo, Degree))
  75.             SubtractTwo += 2
  76.             AddOne += 1
  77.         Next
  78.     End Sub
  79. End Module
  80. Public Class xVisualTheme : Inherits ContainerControl
  81.  
  82.     Sub New()
  83.         SetStyle(ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  84.         BackColor = Color.FromArgb(46, 43, 40)
  85.         DoubleBuffered = True
  86.     End Sub
  87.  
  88.     Dim TopTexture As TextureBrush = NoiseBrush({Color.FromArgb(66, 64, 62), Color.FromArgb(63, 61, 59), Color.FromArgb(69, 67, 65)})
  89.     Dim InnerTexture As TextureBrush = NoiseBrush({Color.FromArgb(57, 53, 50), Color.FromArgb(56, 52, 49), Color.FromArgb(58, 55, 51)})
  90.     Dim drawFont As New Font("Arial", 11, FontStyle.Bold)
  91.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  92.         Dim G As Graphics = e.Graphics
  93.         MyBase.OnPaint(e)
  94.         G.Clear(Color.Fuchsia)
  95.  
  96.         Dim mainRect As New Rectangle(0, 0, Width, Height)
  97.         Dim LeftHighlight As New LinearGradientBrush(New Rectangle(0, 0, Width, Height), Color.FromArgb(66, 64, 63), Color.FromArgb(56, 54, 53), 90S)
  98.         Dim RightHighlight As New LinearGradientBrush(New Rectangle(0, 0, Width, Height), Color.FromArgb(80, 78, 77), Color.FromArgb(70, 68, 67), 90S)
  99.         Dim TopOverlay As New LinearGradientBrush(New Rectangle(0, 0, Width - 1, 53), Color.FromArgb(15, Color.White), Color.FromArgb(100, Color.FromArgb(43, 40, 38)), 90S)
  100.  
  101.         Dim mainGradient As New LinearGradientBrush(mainRect, Color.FromArgb(73, 71, 69), Color.FromArgb(69, 67, 64), 90S)
  102.         G.FillRectangle(mainGradient, mainRect) 'Outside Rectangle
  103.         G.DrawRectangle(Pens.Black, New Rectangle(0, 0, Width - 1, Height - 1))
  104.  
  105.         G.FillRectangle(InnerTexture, New Rectangle(10, 53, Width - 21, Height - 84)) 'Inner Rectangle
  106.         G.DrawRectangle(Pens.Black, New Rectangle(10, 53, Width - 21, Height - 84))
  107.  
  108.         G.FillRectangle(TopTexture, New Rectangle(0, 0, Width - 1, 53)) 'Top Bar Rectangle
  109.         G.FillRectangle(TopOverlay, New Rectangle(0, 0, Width - 1, 53))
  110.         G.DrawRectangle(Pens.Black, New Rectangle(0, 0, Width - 1, 53))
  111.  
  112.         Dim blend As ColorBlend = New ColorBlend()
  113.  
  114.         'Add the Array of Color
  115.         Dim bColors As Color() = New Color() {Color.FromArgb(10, Color.White), Color.FromArgb(10, Color.Black), Color.FromArgb(10, Color.White)}
  116.         blend.Colors = bColors
  117.  
  118.         'Add the Array Single (0-1) colorpoints to place each Color
  119.         Dim bPts As Single() = New Single() {0, 0.7, 1}
  120.         blend.Positions = bPts
  121.  
  122.         Dim rect As New Rectangle(0, 0, Width - 1, 53)
  123.         Using br As New LinearGradientBrush(rect, Color.White, Color.Black, LinearGradientMode.Vertical)
  124.  
  125.             'Blend the colors into the Brush
  126.             br.InterpolationColors = blend
  127.  
  128.             'Fill the rect with the blend
  129.             G.FillRectangle(br, rect)
  130.  
  131.         End Using
  132.  
  133.         G.DrawLine(GetPen(Color.FromArgb(173, 172, 172)), 4, 1, Width - 5, 1) 'Top Middle Highlight
  134.         G.DrawLine(GetPen(Color.FromArgb(110, 109, 107)), 11, Height - 30, Width - 12, Height - 30) 'Bottom Middle Highlight
  135.  
  136.         G.FillRectangle(GetBrush(Color.FromArgb(173, 172, 172)), 3, 2, 1, 1) 'Top Left Corner Highlight
  137.         G.FillRectangle(GetBrush(Color.FromArgb(133, 132, 132)), 2, 2, 1, 1)
  138.         G.FillRectangle(GetBrush(Color.FromArgb(113, 112, 112)), 2, 3, 1, 1)
  139.         G.FillRectangle(GetBrush(Color.FromArgb(83, 82, 82)), 1, 4, 1, 1)
  140.  
  141.         G.FillRectangle(GetBrush(Color.FromArgb(173, 172, 172)), Width - 4, 2, 1, 1) 'Top Right Corner Highlight
  142.         G.FillRectangle(GetBrush(Color.FromArgb(133, 132, 132)), Width - 3, 2, 1, 1)
  143.         G.FillRectangle(GetBrush(Color.FromArgb(113, 112, 112)), Width - 3, 3, 1, 1)
  144.         G.FillRectangle(GetBrush(Color.FromArgb(83, 82, 82)), Width - 2, 4, 1, 1)
  145.  
  146.         '// Shadows
  147.         G.DrawLine(GetPen(Color.FromArgb(91, 90, 89)), 1, 52, Width - 2, 52) 'Middle Top Horizontal
  148.         G.DrawLine(GetPen(Color.FromArgb(40, 37, 34)), 11, 54, Width - 12, 54)
  149.         G.DrawLine(GetPen(Color.FromArgb(45, 42, 39)), 11, 55, Width - 12, 55)
  150.         G.DrawLine(GetPen(Color.FromArgb(50, 47, 44)), 11, 56, Width - 12, 56)
  151.  
  152.         G.DrawLine(GetPen(Color.FromArgb(50, 47, 44)), 11, Height - 32, Width - 12, Height - 32) 'Middle Bottom Horizontal
  153.         G.DrawLine(GetPen(Color.FromArgb(52, 49, 46)), 11, Height - 33, Width - 12, Height - 33)
  154.         G.DrawLine(GetPen(Color.FromArgb(54, 51, 48)), 11, Height - 34, Width - 12, Height - 34)
  155.  
  156.  
  157.         G.DrawLine(GetPen(Color.FromArgb(59, 57, 55)), 1, 54, 9, 54) 'Left Horizontal
  158.         G.DrawLine(GetPen(Color.FromArgb(64, 62, 60)), 1, 55, 9, 55)
  159.         G.DrawLine(GetPen(Color.FromArgb(73, 71, 69)), 1, 56, 9, 56)
  160.  
  161.         G.DrawLine(GetPen(Color.FromArgb(59, 57, 55)), Width - 10, 54, Width - 2, 54) 'Right Horizontal
  162.         G.DrawLine(GetPen(Color.FromArgb(64, 62, 60)), Width - 10, 55, Width - 2, 55)
  163.         G.DrawLine(GetPen(Color.FromArgb(73, 71, 69)), Width - 10, 56, Width - 2, 56)
  164.  
  165.         G.DrawLine(GetPen(Color.FromArgb(59, 57, 55)), 1, 54, 1, Height - 5) 'Left Vertical
  166.         G.DrawLine(GetPen(Color.FromArgb(64, 62, 60)), 2, 55, 2, Height - 4)
  167.         G.DrawLine(GetPen(Color.FromArgb(73, 71, 69)), 3, 56, 3, Height - 3)
  168.         G.DrawLine(New Pen(LeftHighlight), 1, 5, 1, 51)
  169.         G.DrawLine(New Pen(RightHighlight), 2, 5, 2, 51)
  170.         G.DrawLine(GetPen(Color.FromArgb(69, 67, 65)), 9, 56, 9, Height - 31)
  171.  
  172.         G.DrawLine(GetPen(Color.FromArgb(59, 57, 55)), Width - 2, 54, Width - 2, Height - 5) 'Right Vertical
  173.         G.DrawLine(GetPen(Color.FromArgb(64, 62, 60)), Width - 3, 55, Width - 3, Height - 4)
  174.         G.DrawLine(GetPen(Color.FromArgb(73, 71, 69)), Width - 4, 56, Width - 4, Height - 3)
  175.         G.DrawLine(New Pen(LeftHighlight), Width - 2, 5, Width - 2, 51)
  176.         G.DrawLine(New Pen(RightHighlight), Width - 3, 5, Width - 3, 51)
  177.         G.DrawLine(GetPen(Color.FromArgb(69, 67, 65)), Width - 10, 56, Width - 10, Height - 31)
  178.  
  179.         G.DrawString(Text, drawFont, New SolidBrush(Color.FromArgb(255, 255, 255)), New Rectangle(0, 0, Width, 37), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  180.  
  181.         '////left upper corner
  182.         G.FillRectangle(Brushes.Fuchsia, 0, 0, 1, 1)
  183.         G.FillRectangle(Brushes.Fuchsia, 1, 0, 1, 1)
  184.         G.FillRectangle(Brushes.Fuchsia, 2, 0, 1, 1)
  185.         G.FillRectangle(Brushes.Fuchsia, 3, 0, 1, 1)
  186.         G.FillRectangle(Brushes.Fuchsia, 0, 1, 1, 1)
  187.         G.FillRectangle(Brushes.Fuchsia, 0, 2, 1, 1)
  188.         G.FillRectangle(Brushes.Fuchsia, 0, 3, 1, 1)
  189.         G.FillRectangle(Brushes.Fuchsia, 1, 1, 1, 1)
  190.  
  191.         G.FillRectangle(Brushes.Black, 1, 3, 1, 1)
  192.         G.FillRectangle(Brushes.Black, 1, 2, 1, 1)
  193.         G.FillRectangle(Brushes.Black, 2, 1, 1, 1)
  194.         G.FillRectangle(Brushes.Black, 3, 1, 1, 1)
  195.         ''////right upper corner
  196.         G.FillRectangle(Brushes.Fuchsia, Width - 1, 0, 1, 1)
  197.         G.FillRectangle(Brushes.Fuchsia, Width - 2, 0, 1, 1)
  198.         G.FillRectangle(Brushes.Fuchsia, Width - 3, 0, 1, 1)
  199.         G.FillRectangle(Brushes.Fuchsia, Width - 4, 0, 1, 1)
  200.         G.FillRectangle(Brushes.Fuchsia, Width - 1, 1, 1, 1)
  201.         G.FillRectangle(Brushes.Fuchsia, Width - 1, 2, 1, 1)
  202.         G.FillRectangle(Brushes.Fuchsia, Width - 1, 3, 1, 1)
  203.         G.FillRectangle(Brushes.Fuchsia, Width - 2, 1, 1, 1)
  204.  
  205.         G.FillRectangle(Brushes.Black, Width - 2, 3, 1, 1)
  206.         G.FillRectangle(Brushes.Black, Width - 2, 2, 1, 1)
  207.         G.FillRectangle(Brushes.Black, Width - 3, 1, 1, 1)
  208.         G.FillRectangle(Brushes.Black, Width - 4, 1, 1, 1)
  209.         ''////left bottom corner
  210.         G.FillRectangle(Brushes.Fuchsia, 0, Height - 1, 1, 1)
  211.         G.FillRectangle(Brushes.Fuchsia, 0, Height - 2, 1, 1)
  212.         G.FillRectangle(Brushes.Fuchsia, 0, Height - 3, 1, 1)
  213.         G.FillRectangle(Brushes.Fuchsia, 0, Height - 4, 1, 1)
  214.         G.FillRectangle(Brushes.Fuchsia, 1, Height - 1, 1, 1)
  215.         G.FillRectangle(Brushes.Fuchsia, 2, Height - 1, 1, 1)
  216.         G.FillRectangle(Brushes.Fuchsia, 3, Height - 1, 1, 1)
  217.         G.FillRectangle(Brushes.Fuchsia, 1, Height - 1, 1, 1)
  218.         G.FillRectangle(Brushes.Fuchsia, 1, Height - 2, 1, 1)
  219.  
  220.         G.FillRectangle(Brushes.Black, 1, Height - 3, 1, 1)
  221.         G.FillRectangle(Brushes.Black, 1, Height - 4, 1, 1)
  222.         G.FillRectangle(Brushes.Black, 3, Height - 2, 1, 1)
  223.         G.FillRectangle(Brushes.Black, 2, Height - 2, 1, 1)
  224.         ''////right bottom corner
  225.         G.FillRectangle(Brushes.Fuchsia, Width - 1, Height, 1, 1)
  226.         G.FillRectangle(Brushes.Fuchsia, Width - 2, Height, 1, 1)
  227.         G.FillRectangle(Brushes.Fuchsia, Width - 3, Height, 1, 1)
  228.         G.FillRectangle(Brushes.Fuchsia, Width - 4, Height, 1, 1)
  229.         G.FillRectangle(Brushes.Fuchsia, Width - 1, Height - 1, 1, 1)
  230.         G.FillRectangle(Brushes.Fuchsia, Width - 1, Height - 2, 1, 1)
  231.         G.FillRectangle(Brushes.Fuchsia, Width - 1, Height - 3, 1, 1)
  232.         G.FillRectangle(Brushes.Fuchsia, Width - 2, Height - 1, 1, 1)
  233.         G.FillRectangle(Brushes.Fuchsia, Width - 3, Height - 1, 1, 1)
  234.         G.FillRectangle(Brushes.Fuchsia, Width - 4, Height - 1, 1, 1)
  235.         G.FillRectangle(Brushes.Fuchsia, Width - 1, Height - 4, 1, 1)
  236.         G.FillRectangle(Brushes.Fuchsia, Width - 2, Height - 2, 1, 1)
  237.  
  238.         G.FillRectangle(Brushes.Black, Width - 2, Height - 3, 1, 1)
  239.         G.FillRectangle(Brushes.Black, Width - 2, Height - 4, 1, 1)
  240.         G.FillRectangle(Brushes.Black, Width - 4, Height - 2, 1, 1)
  241.         G.FillRectangle(Brushes.Black, Width - 3, Height - 2, 1, 1)
  242.  
  243.     End Sub
  244.     Private MouseP As Point = New Point(0, 0)
  245.     Private Cap As Boolean = False
  246.     Private MoveHeight% = 53 : Private pos% = 0
  247.     Dim State As MouseState = MouseState.None
  248.     Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  249.         MyBase.OnMouseDown(e)
  250.         If e.Button = Windows.Forms.MouseButtons.Left And New Rectangle(0, 0, Width, MoveHeight).Contains(e.Location) Then
  251.             Cap = True
  252.             MouseP = e.Location
  253.         End If
  254.         State = MouseState.Down
  255.         Invalidate()
  256.     End Sub
  257.     Protected Overrides Sub OnMouseEnter(ByVal e As System.EventArgs)
  258.         MyBase.OnMouseEnter(e)
  259.         State = MouseState.Over : Invalidate()
  260.     End Sub
  261.     Protected Overrides Sub OnMouseLeave(ByVal e As System.EventArgs)
  262.         MyBase.OnMouseLeave(e)
  263.         State = MouseState.None : Invalidate()
  264.     End Sub
  265.     Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
  266.         MyBase.OnMouseUp(e) : Cap = False
  267.         State = MouseState.Over : Invalidate()
  268.     End Sub
  269.     Protected Overrides Sub OnMouseMove(ByVal e As System.Windows.Forms.MouseEventArgs)
  270.         MyBase.OnMouseMove(e)
  271.         If Cap Then
  272.             Parent.Location = MousePosition - MouseP
  273.         End If
  274.         Invalidate()
  275.     End Sub
  276.     Protected Overrides Sub OnCreateControl()
  277.         MyBase.OnCreateControl()
  278.         Me.ParentForm.FormBorderStyle = FormBorderStyle.None
  279.         Me.ParentForm.TransparencyKey = Color.Fuchsia
  280.         Dock = DockStyle.Fill
  281.     End Sub
  282. End Class
  283. Public Class xVisualControlBox : Inherits Control
  284.     Sub New()
  285.         SetStyle(ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  286.         BackColor = Color.Transparent
  287.         ForeColor = Color.FromArgb(205, 205, 205)
  288.         Size = New Size(83, 28)
  289.         Location = New Point(12, 12)
  290.         DoubleBuffered = True
  291.     End Sub
  292. #Region " MouseStates "
  293.     Dim State As MouseState = MouseState.None
  294.     Dim X As Integer
  295.     Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  296.         MyBase.OnMouseDown(e)
  297.  
  298.         If X > 10 And X < 25 Then
  299.             FindForm.Close()
  300.         ElseIf X > 33 And X < 48 Then
  301.             FindForm.WindowState = FormWindowState.Minimized
  302.         ElseIf X > 56 And X < 71 Then
  303.             If FindForm.WindowState = FormWindowState.Normal Then
  304.                 FindForm.WindowState = FormWindowState.Maximized
  305.             Else
  306.                 FindForm.WindowState = FormWindowState.Normal
  307.             End If
  308.         End If
  309.         State = MouseState.Down : Invalidate()
  310.     End Sub
  311.     Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
  312.         MyBase.OnMouseUp(e)
  313.         State = MouseState.Over : Invalidate()
  314.     End Sub
  315.     Protected Overrides Sub OnMouseEnter(ByVal e As System.EventArgs)
  316.         MyBase.OnMouseEnter(e)
  317.         State = MouseState.Over : Invalidate()
  318.     End Sub
  319.     Protected Overrides Sub OnMouseLeave(ByVal e As System.EventArgs)
  320.         MyBase.OnMouseLeave(e)
  321.         State = MouseState.None : Invalidate()
  322.     End Sub
  323.     Protected Overrides Sub OnMouseMove(ByVal e As System.Windows.Forms.MouseEventArgs)
  324.         MyBase.OnMouseMove(e)
  325.         X = e.Location.X
  326.         Invalidate()
  327.     End Sub
  328. #End Region
  329.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  330.         Dim B As New Bitmap(Width, Height)
  331.         Dim G As Graphics = Graphics.FromImage(B)
  332.  
  333.         MyBase.OnPaint(e)
  334.  
  335.         G.Clear(BackColor)
  336.  
  337.         G.SmoothingMode = SmoothingMode.HighQuality
  338.  
  339.         Dim ControlGradient As New LinearGradientBrush(New Rectangle(10, 2, 15, 16), Color.FromArgb(67, 67, 67), Color.FromArgb(80, 80, 81), 90S)
  340.         '// Control Box
  341.         G.FillEllipse(ControlGradient, New Rectangle(10, 2, 15, 16)) 'Main Circle
  342.         G.FillEllipse(ControlGradient, New Rectangle(33, 2, 15, 16))
  343.         G.FillEllipse(ControlGradient, New Rectangle(56, 2, 15, 16))
  344.         G.DrawEllipse(Pens.Black, New Rectangle(10, 2, 15, 16))
  345.         G.DrawEllipse(Pens.Black, New Rectangle(33, 2, 15, 16))
  346.         G.DrawEllipse(Pens.Black, New Rectangle(56, 2, 15, 16))
  347.  
  348.         Dim ControlTopCircle As New LinearGradientBrush(New Rectangle(13, 4, 9, 7), Color.FromArgb(193, 190, 176), Color.FromArgb(90, 91, 92), 90S)
  349.         G.FillEllipse(ControlTopCircle, New Rectangle(13, 4, 9, 7)) 'Top Circle
  350.         G.FillEllipse(ControlTopCircle, New Rectangle(36, 4, 9, 7)) 'Top Circle
  351.         G.FillEllipse(ControlTopCircle, New Rectangle(59, 4, 9, 7)) 'Top Circle
  352.  
  353.         Dim NControlBottomCircle As New LinearGradientBrush(New Rectangle(13, 12, 9, 5), Color.FromArgb(90, 91, 92), Color.FromArgb(155, 165, 174), 90S)
  354.  
  355.         Select Case State
  356.             Case MouseState.None
  357. None:           G.FillEllipse(NControlBottomCircle, New Rectangle(13, 12, 9, 5)) 'Bottom Circle
  358.                 G.FillEllipse(NControlBottomCircle, New Rectangle(36, 12, 9, 5))
  359.                 G.FillEllipse(NControlBottomCircle, New Rectangle(59, 12, 9, 5))
  360.             Case MouseState.Over
  361.                 If X > 10 And X < 25 Then
  362.                     Dim ControlBottomCircle As New LinearGradientBrush(New Rectangle(13, 12, 9, 5), Color.FromArgb(50, Color.Red), Color.FromArgb(10, Color.Red), 90S)
  363.                     G.FillEllipse(NControlBottomCircle, New Rectangle(13, 12, 9, 5)) 'Bottom Circle
  364.                     G.FillEllipse(ControlBottomCircle, New Rectangle(13, 12, 9, 5)) 'Bottom Circle
  365.                     G.FillEllipse(NControlBottomCircle, New Rectangle(36, 12, 9, 5))
  366.                     G.FillEllipse(NControlBottomCircle, New Rectangle(59, 12, 9, 5))
  367.                 ElseIf X > 33 And X < 48 Then
  368.                     Dim ControlBottomCircle As New LinearGradientBrush(New Rectangle(13, 12, 9, 5), Color.FromArgb(50, Color.Yellow), Color.FromArgb(10, Color.Yellow), 90S)
  369.                     G.FillEllipse(NControlBottomCircle, New Rectangle(13, 12, 9, 5)) 'Bottom Circle
  370.                     G.FillEllipse(NControlBottomCircle, New Rectangle(36, 12, 9, 5))
  371.                     G.FillEllipse(ControlBottomCircle, New Rectangle(36, 12, 9, 5))
  372.                     G.FillEllipse(NControlBottomCircle, New Rectangle(59, 12, 9, 5))
  373.                 ElseIf X > 56 And X < 71 Then
  374.                     Dim ControlBottomCircle As New LinearGradientBrush(New Rectangle(13, 12, 9, 5), Color.FromArgb(50, Color.Green), Color.FromArgb(10, Color.Green), 90S)
  375.                     G.FillEllipse(NControlBottomCircle, New Rectangle(13, 12, 9, 5)) 'Bottom Circle
  376.                     G.FillEllipse(NControlBottomCircle, New Rectangle(36, 12, 9, 5))
  377.                     G.FillEllipse(NControlBottomCircle, New Rectangle(59, 12, 9, 5))
  378.                     G.FillEllipse(ControlBottomCircle, New Rectangle(59, 12, 9, 5))
  379.                 Else
  380.                     GoTo None
  381.                 End If
  382.             Case MouseState.Down
  383.  
  384.         End Select
  385.  
  386.  
  387.         e.Graphics.DrawImage(B.Clone(), 0, 0)
  388.         G.Dispose() : B.Dispose()
  389.     End Sub
  390. End Class
  391. Public Class xVisualButton : Inherits Control
  392. #Region " MouseStates "
  393.     Dim State As MouseState = MouseState.None
  394.     Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  395.         MyBase.OnMouseDown(e)
  396.         State = MouseState.Down : Invalidate()
  397.     End Sub
  398.     Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
  399.         MyBase.OnMouseUp(e)
  400.         State = MouseState.Over : Invalidate()
  401.     End Sub
  402.     Protected Overrides Sub OnMouseEnter(ByVal e As System.EventArgs)
  403.         MyBase.OnMouseEnter(e)
  404.         State = MouseState.Over : Invalidate()
  405.     End Sub
  406.     Protected Overrides Sub OnMouseLeave(ByVal e As System.EventArgs)
  407.         MyBase.OnMouseLeave(e)
  408.         State = MouseState.None : Invalidate()
  409.     End Sub
  410. #End Region
  411.  
  412.     Public Enum InnerShade
  413.         Light
  414.         Dark
  415.     End Enum
  416.     Private _Shade As InnerShade
  417.     Property Shade As InnerShade
  418.         Get
  419.             Return _Shade
  420.         End Get
  421.         Set(ByVal value As InnerShade)
  422.             _Shade = value
  423.             Invalidate()
  424.         End Set
  425.     End Property
  426.  
  427.     Sub New()
  428.         SetStyle(ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  429.         BackColor = Color.Transparent
  430.         ForeColor = Color.FromArgb(205, 205, 205)
  431.         _Shade = InnerShade.Dark
  432.         DoubleBuffered = True
  433.     End Sub
  434.     Dim InnerTexture As TextureBrush = NoiseBrush({Color.FromArgb(52, 48, 44), Color.FromArgb(54, 50, 46), Color.FromArgb(50, 46, 42)})
  435.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  436.         Dim B As New Bitmap(Width, Height)
  437.         Dim G As Graphics = Graphics.FromImage(B)
  438.         Dim ClientRectangle As New Rectangle(3, 3, Width - 7, Height - 7)
  439.  
  440.         MyBase.OnPaint(e)
  441.  
  442.         G.Clear(BackColor)
  443.  
  444.         G.SmoothingMode = SmoothingMode.HighQuality
  445.  
  446.         Select Case _Shade
  447.             Case InnerShade.Dark
  448.  
  449.                 G.FillPath(InnerTexture, Draw.CreateRound(ClientRectangle, 3))
  450.  
  451.                 G.DrawPath(GetPen(Color.FromArgb(40, 38, 36)), Draw.CreateRound(New Rectangle(3, 3, Width - 6, Height - 6), 3))
  452.                 G.DrawPath(GetPen(Color.FromArgb(45, 43, 41)), Draw.CreateRound(New Rectangle(3, 3, Width - 6, Height - 5), 3))
  453.                 G.DrawPath(GetPen(Color.FromArgb(50, 48, 46)), Draw.CreateRound(New Rectangle(2, 2, Width - 5, Height - 3), 3))
  454.  
  455.                 Dim HighlightGradient As New LinearGradientBrush(New Rectangle(4, 4, Width - 8, Height - 8), Color.FromArgb(160, 158, 157), Color.FromArgb(61, 57, 54), 90S)
  456.                 Dim hp As New Pen(HighlightGradient)
  457.                 G.DrawPath(hp, Draw.CreateRound(New Rectangle(4, 4, Width - 9, Height - 9), 3))
  458.  
  459.                 Dim OutlineGradient As New LinearGradientBrush(New Rectangle(3, 3, Width - 7, Height - 6), Color.FromArgb(34, 32, 30), Color.Black, 90S)
  460.                 Dim op As New Pen(OutlineGradient)
  461.                 G.DrawPath(op, Draw.CreateRound(New Rectangle(3, 3, Width - 7, Height - 7), 3))
  462.  
  463.                 Dim drawFont As New Font("Arial", 9, FontStyle.Bold)
  464.                 Select Case State
  465.                     Case MouseState.None
  466.                         G.DrawString(Text, drawFont, Brushes.White, New Rectangle(0, 0, Width - 1, Height - 1), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  467.                     Case MouseState.Over
  468.                         G.DrawString(Text, drawFont, Brushes.White, New Rectangle(0, 0, Width - 1, Height - 1), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  469.                     Case MouseState.Down
  470.                         G.DrawString(Text, drawFont, Brushes.White, New Rectangle(0, 0, Width - 1, Height - 1), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  471.                 End Select
  472.  
  473.             Case InnerShade.Light
  474.  
  475.                 Dim MainGradient As New LinearGradientBrush(ClientRectangle, Color.FromArgb(225, 227, 230), Color.FromArgb(199, 201, 204), 90S)
  476.                 G.FillPath(MainGradient, Draw.CreateRound(ClientRectangle, 3))
  477.  
  478.                 G.DrawPath(GetPen(Color.FromArgb(167, 168, 171)), Draw.CreateRound(New Rectangle(3, 3, Width - 6, Height - 6), 3))
  479.                 G.DrawPath(GetPen(Color.FromArgb(203, 205, 208)), Draw.CreateRound(New Rectangle(2, 2, Width - 5, Height - 4), 3))
  480.  
  481.                 Dim HighlightGradient As New LinearGradientBrush(New Rectangle(4, 4, Width - 8, Height - 8), Color.FromArgb(255, 255, 255), Color.FromArgb(218, 219, 222), 90S)
  482.                 Dim hp As New Pen(HighlightGradient)
  483.                 G.DrawPath(hp, Draw.CreateRound(New Rectangle(4, 4, Width - 9, Height - 9), 3))
  484.  
  485.                 Dim OutlineGradient As New LinearGradientBrush(New Rectangle(3, 3, Width - 7, Height - 6), Color.FromArgb(173, 174, 177), Color.FromArgb(110, 111, 114), 90S)
  486.                 Dim op As New Pen(OutlineGradient)
  487.                 G.DrawPath(op, Draw.CreateRound(New Rectangle(3, 3, Width - 7, Height - 7), 3))
  488.  
  489.                 Dim drawFont As New Font("Arial", 9, FontStyle.Bold)
  490.                 Select Case State
  491.                     Case MouseState.None
  492.                         G.DrawString(Text, drawFont, GetBrush(Color.FromArgb(109, 109, 110)), New Rectangle(0, 0, Width - 1, Height - 1), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  493.                     Case MouseState.Over
  494.                         G.DrawString(Text, drawFont, GetBrush(Color.FromArgb(109, 109, 110)), New Rectangle(0, 0, Width - 1, Height - 1), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  495.                     Case MouseState.Down
  496.                         G.DrawString(Text, drawFont, GetBrush(Color.FromArgb(109, 109, 110)), New Rectangle(0, 0, Width - 1, Height - 1), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  497.                 End Select
  498.  
  499.         End Select
  500.  
  501.  
  502.         e.Graphics.DrawImage(B.Clone(), 0, 0)
  503.         G.Dispose() : B.Dispose()
  504.     End Sub
  505. End Class
  506. Public Class xVisualGroupBox : Inherits ContainerControl
  507.  
  508.     Public Enum InnerShade
  509.         Light
  510.         Dark
  511.     End Enum
  512.     Private _Shade As InnerShade
  513.     Property Shade As InnerShade
  514.         Get
  515.             Return _Shade
  516.         End Get
  517.         Set(ByVal value As InnerShade)
  518.             _Shade = value
  519.             Invalidate()
  520.         End Set
  521.     End Property
  522.  
  523.     Sub New()
  524.         SetStyle(ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  525.         BackColor = Color.Transparent
  526.         ForeColor = Color.FromArgb(205, 205, 205)
  527.         Size = New Size(174, 115)
  528.         _Shade = InnerShade.Light
  529.         DoubleBuffered = True
  530.     End Sub
  531.     Dim TopTexture As TextureBrush = NoiseBrush({Color.FromArgb(49, 45, 41), Color.FromArgb(51, 47, 43), Color.FromArgb(47, 43, 39)})
  532.     Dim InnerTexture As TextureBrush = NoiseBrush({Color.FromArgb(55, 52, 48), Color.FromArgb(57, 50, 50), Color.FromArgb(53, 50, 46)})
  533.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  534.         Dim B As New Bitmap(Width, Height)
  535.         Dim G As Graphics = Graphics.FromImage(B)
  536.         Dim ClientRectangle As New Rectangle(0, 0, Width - 1, Height - 1)
  537.         Dim BarRect As New Rectangle(0, 0, Width - 1, 32)
  538.         MyBase.OnPaint(e)
  539.  
  540.         G.Clear(BackColor)
  541.  
  542.         G.SmoothingMode = SmoothingMode.HighQuality
  543.  
  544.         Select Case _Shade
  545.             Case InnerShade.Light
  546.                 Dim mainGradient As New LinearGradientBrush(ClientRectangle, Color.FromArgb(228, 230, 232), Color.FromArgb(199, 201, 205), 90S)
  547.                 G.FillRectangle(mainGradient, ClientRectangle)
  548.                 G.DrawRectangle(Pens.Black, ClientRectangle)
  549.             Case InnerShade.Dark
  550.                 G.FillRectangle(InnerTexture, ClientRectangle)
  551.                 G.DrawRectangle(Pens.Black, ClientRectangle)
  552.         End Select
  553.  
  554.         Dim TopOverlay As New LinearGradientBrush(ClientRectangle, Color.FromArgb(5, Color.White), Color.FromArgb(10, Color.White), 90S)
  555.         G.FillRectangle(TopTexture, BarRect)
  556.  
  557.         Dim blend As ColorBlend = New ColorBlend()
  558.  
  559.         'Add the Array of Color
  560.         Dim bColors As Color() = New Color() {Color.FromArgb(20, Color.White), Color.FromArgb(10, Color.Black), Color.FromArgb(10, Color.White)}
  561.         blend.Colors = bColors
  562.  
  563.         'Add the Array Single (0-1) colorpoints to place each Color
  564.         Dim bPts As Single() = New Single() {0, 0.9, 1}
  565.         blend.Positions = bPts
  566.  
  567.         Using br As New LinearGradientBrush(BarRect, Color.White, Color.Black, LinearGradientMode.Vertical)
  568.  
  569.             'Blend the colors into the Brush
  570.             br.InterpolationColors = blend
  571.  
  572.             'Fill the rect with the blend
  573.             G.FillRectangle(br, BarRect)
  574.  
  575.         End Using
  576.  
  577.         G.DrawRectangle(Pens.Black, BarRect)
  578.  
  579.         '// Top Bar Highlights
  580.         G.DrawLine(GetPen(Color.FromArgb(112, 109, 107)), 1, 1, Width - 2, 1)
  581.         G.DrawLine(GetPen(Color.FromArgb(67, 63, 60)), 1, BarRect.Height - 1, Width - 2, BarRect.Height - 1)
  582.  
  583.         Select Case _Shade
  584.             Case InnerShade.Light
  585.                 Dim c As Color() = {Color.FromArgb(153, 153, 153), Color.FromArgb(173, 174, 177), Color.FromArgb(200, 201, 204)}
  586.                 Draw.InnerGlow(G, New Rectangle(1, 33, Width - 2, Height - 34), c)
  587.             Case InnerShade.Dark
  588.                 Dim c As Color() = {Color.FromArgb(43, 40, 38), Color.FromArgb(50, 47, 44), Color.FromArgb(55, 52, 49)}
  589.                 Draw.InnerGlow(G, New Rectangle(1, 33, Width - 2, Height - 34), c)
  590.         End Select
  591.  
  592.         Dim drawFont As New Font("Arial", 9, FontStyle.Bold)
  593.         G.DrawString(Text, drawFont, Brushes.White, New Rectangle(15, 3, Width - 1, 26), New StringFormat() With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Center})
  594.  
  595.         e.Graphics.DrawImage(B.Clone(), 0, 0)
  596.         G.Dispose() : B.Dispose()
  597.     End Sub
  598. End Class
  599. Public Class xVisualHeader : Inherits ContainerControl
  600.     Protected Overrides Sub OnResize(ByVal e As EventArgs)
  601.         Height = 32
  602.         MyBase.OnResize(e)
  603.     End Sub
  604.  
  605.     Sub New()
  606.         SetStyle(ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  607.         BackColor = Color.Transparent
  608.         ForeColor = Color.FromArgb(205, 205, 205)
  609.         Size = New Size(174, 32)
  610.         DoubleBuffered = True
  611.     End Sub
  612.     Dim TopTexture As TextureBrush = NoiseBrush({Color.FromArgb(49, 45, 41), Color.FromArgb(51, 47, 43), Color.FromArgb(47, 43, 39)})
  613.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  614.         Dim B As New Bitmap(Width, Height)
  615.         Dim G As Graphics = Graphics.FromImage(B)
  616.         Dim BarRect As New Rectangle(0, 0, Width - 1, Height - 1)
  617.         MyBase.OnPaint(e)
  618.  
  619.         G.Clear(BackColor)
  620.  
  621.         G.SmoothingMode = SmoothingMode.HighQuality
  622.  
  623.         Dim TopOverlay As New LinearGradientBrush(BarRect, Color.FromArgb(5, Color.White), Color.FromArgb(10, Color.White), 90S)
  624.         G.FillRectangle(TopTexture, BarRect)
  625.  
  626.         Dim blend As ColorBlend = New ColorBlend()
  627.  
  628.         'Add the Array of Color
  629.         Dim bColors As Color() = New Color() {Color.FromArgb(20, Color.White), Color.FromArgb(10, Color.Black), Color.FromArgb(10, Color.White)}
  630.         blend.Colors = bColors
  631.  
  632.         'Add the Array Single (0-1) colorpoints to place each Color
  633.         Dim bPts As Single() = New Single() {0, 0.9, 1}
  634.         blend.Positions = bPts
  635.  
  636.         Using br As New LinearGradientBrush(BarRect, Color.White, Color.Black, LinearGradientMode.Vertical)
  637.  
  638.             'Blend the colors into the Brush
  639.             br.InterpolationColors = blend
  640.  
  641.             'Fill the rect with the blend
  642.             G.FillRectangle(br, BarRect)
  643.  
  644.         End Using
  645.  
  646.         G.DrawRectangle(Pens.Black, BarRect)
  647.  
  648.         '// Top Bar Highlights
  649.         G.DrawLine(GetPen(Color.FromArgb(112, 109, 107)), 1, 1, Width - 2, 1)
  650.         G.DrawLine(GetPen(Color.FromArgb(67, 63, 60)), 1, BarRect.Height - 1, Width - 2, BarRect.Height - 1)
  651.  
  652.  
  653.         Dim drawFont As New Font("Arial", 9, FontStyle.Bold)
  654.         G.DrawString(Text, drawFont, Brushes.White, New Rectangle(15, 3, Width - 1, 26), New StringFormat() With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Center})
  655.  
  656.         e.Graphics.DrawImage(B.Clone(), 0, 0)
  657.         G.Dispose() : B.Dispose()
  658.     End Sub
  659. End Class
  660. Public Class xVisualSeperator : Inherits Control
  661.  
  662.     Public Enum LineStyle
  663.         Horizontal
  664.         Vertical
  665.     End Enum
  666.     Private _Style As LineStyle
  667.     Property Style As LineStyle
  668.         Get
  669.             Return _Style
  670.         End Get
  671.         Set(ByVal value As LineStyle)
  672.             _Style = value
  673.             Invalidate()
  674.         End Set
  675.     End Property
  676.  
  677.     Sub New()
  678.         SetStyle(ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  679.         BackColor = Color.Transparent
  680.         ForeColor = Color.FromArgb(205, 205, 205)
  681.         _Style = LineStyle.Horizontal
  682.  
  683.         Size = New Size(174, 3)
  684.  
  685.         DoubleBuffered = True
  686.     End Sub
  687.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  688.         Dim B As New Bitmap(Width, Height)
  689.         Dim G As Graphics = Graphics.FromImage(B)
  690.         MyBase.OnPaint(e)
  691.  
  692.         Size = Size
  693.         _Style = Style
  694.  
  695.         G.Clear(BackColor)
  696.  
  697.         G.SmoothingMode = SmoothingMode.HighQuality
  698.  
  699.         Select Case _Style
  700.             Case LineStyle.Horizontal
  701.                 G.DrawLine(GetPen(Color.Black), 0, 0, Width - 1, Height - 3)
  702.                 G.DrawLine(GetPen(Color.FromArgb(99, 97, 94)), 0, 1, Width - 1, Height - 2)
  703.             Case LineStyle.Vertical
  704.                 G.DrawLine(GetPen(Color.Black), 0, 0, 0, Height - 1)
  705.                 G.DrawLine(GetPen(Color.FromArgb(99, 97, 94)), 1, 0, 1, Height - 1)
  706.         End Select
  707.  
  708.         e.Graphics.DrawImage(B.Clone(), 0, 0)
  709.         G.Dispose() : B.Dispose()
  710.     End Sub
  711. End Class
  712. <DefaultEvent("TextChanged")> Public Class xVisualTextBox : Inherits Control
  713.  
  714. #Region " Variables"
  715.  
  716.     Private W, H As Integer
  717.     Private State As MouseState = MouseState.None
  718.     Private WithEvents TB As Windows.Forms.TextBox
  719.  
  720. #End Region
  721.  
  722. #Region " Properties"
  723.  
  724. #Region " TextBox Properties"
  725.  
  726.     Private _TextAlign As HorizontalAlignment = HorizontalAlignment.Left
  727.     Public Enum RoundingStyle
  728.         Normal
  729.         Rounded
  730.     End Enum
  731.     Private _Style As RoundingStyle
  732.     <Category("Options")> _
  733.     Property Style() As RoundingStyle
  734.         Get
  735.             Return _Style
  736.         End Get
  737.         Set(ByVal value As RoundingStyle)
  738.             _Style = value
  739.             If TB IsNot Nothing Then
  740.                 TB.TextAlign = value
  741.             End If
  742.         End Set
  743.     End Property
  744.  
  745.     <Category("Options")> _
  746.     Property TextAlign() As HorizontalAlignment
  747.         Get
  748.             Return _TextAlign
  749.         End Get
  750.         Set(ByVal value As HorizontalAlignment)
  751.             _TextAlign = value
  752.             If TB IsNot Nothing Then
  753.                 TB.TextAlign = value
  754.             End If
  755.         End Set
  756.     End Property
  757.     Private _MaxLength As Integer = 32767
  758.     <Category("Options")> _
  759.     Property MaxLength() As Integer
  760.         Get
  761.             Return _MaxLength
  762.         End Get
  763.         Set(ByVal value As Integer)
  764.             _MaxLength = value
  765.             If TB IsNot Nothing Then
  766.                 TB.MaxLength = value
  767.             End If
  768.         End Set
  769.     End Property
  770.     Private _ReadOnly As Boolean
  771.     <Category("Options")> _
  772.     Property [ReadOnly]() As Boolean
  773.         Get
  774.             Return _ReadOnly
  775.         End Get
  776.         Set(ByVal value As Boolean)
  777.             _ReadOnly = value
  778.             If TB IsNot Nothing Then
  779.                 TB.ReadOnly = value
  780.             End If
  781.         End Set
  782.     End Property
  783.     Private _UseSystemPasswordChar As Boolean
  784.     <Category("Options")> _
  785.     Property UseSystemPasswordChar() As Boolean
  786.         Get
  787.             Return _UseSystemPasswordChar
  788.         End Get
  789.         Set(ByVal value As Boolean)
  790.             _UseSystemPasswordChar = value
  791.             If TB IsNot Nothing Then
  792.                 TB.UseSystemPasswordChar = value
  793.             End If
  794.         End Set
  795.     End Property
  796.     Private _Multiline As Boolean
  797.     <Category("Options")> _
  798.     Property Multiline() As Boolean
  799.         Get
  800.             Return _Multiline
  801.         End Get
  802.         Set(ByVal value As Boolean)
  803.             _Multiline = value
  804.             If TB IsNot Nothing Then
  805.                 TB.Multiline = value
  806.  
  807.                 If value Then
  808.                     TB.Height = Height - 11
  809.                 Else
  810.                     Height = TB.Height + 11
  811.                 End If
  812.  
  813.             End If
  814.         End Set
  815.     End Property
  816.     <Category("Options")> _
  817.     Overrides Property Text As String
  818.         Get
  819.             Return MyBase.Text
  820.         End Get
  821.         Set(ByVal value As String)
  822.             MyBase.Text = value
  823.             If TB IsNot Nothing Then
  824.                 TB.Text = value
  825.             End If
  826.         End Set
  827.     End Property
  828.     <Category("Options")> _
  829.     Overrides Property Font As Font
  830.         Get
  831.             Return MyBase.Font
  832.         End Get
  833.         Set(ByVal value As Font)
  834.             MyBase.Font = value
  835.             If TB IsNot Nothing Then
  836.                 TB.Font = value
  837.                 TB.Location = New Point(3, 5)
  838.                 TB.Width = Width - 6
  839.  
  840.                 If Not _Multiline Then
  841.                     Height = TB.Height + 11
  842.                 End If
  843.             End If
  844.         End Set
  845.     End Property
  846.  
  847.     Protected Overrides Sub OnCreateControl()
  848.         MyBase.OnCreateControl()
  849.         If Not Controls.Contains(TB) Then
  850.             Controls.Add(TB)
  851.         End If
  852.     End Sub
  853.     Private Sub OnBaseTextChanged(ByVal s As Object, ByVal e As EventArgs)
  854.         Text = TB.Text
  855.     End Sub
  856.     Private Sub OnBaseKeyDown(ByVal s As Object, ByVal e As KeyEventArgs)
  857.         If e.Control AndAlso e.KeyCode = Keys.A Then
  858.             TB.SelectAll()
  859.             e.SuppressKeyPress = True
  860.         End If
  861.         If e.Control AndAlso e.KeyCode = Keys.C Then
  862.             TB.Copy()
  863.             e.SuppressKeyPress = True
  864.         End If
  865.     End Sub
  866.     Protected Overrides Sub OnResize(ByVal e As EventArgs)
  867.         TB.Location = New Point(11, 5)
  868.         TB.Width = Width - 14
  869.  
  870.         If _Multiline Then
  871.             TB.Height = Height - 11
  872.         Else
  873.             Height = TB.Height + 11
  874.         End If
  875.  
  876.         MyBase.OnResize(e)
  877.     End Sub
  878.  
  879. #End Region
  880.  
  881. #Region " Mouse States"
  882.  
  883.     Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
  884.         MyBase.OnMouseDown(e)
  885.         State = MouseState.Down : Invalidate()
  886.     End Sub
  887.     Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
  888.         MyBase.OnMouseUp(e)
  889.         State = MouseState.Over : TB.Focus() : Invalidate()
  890.     End Sub
  891.     Protected Overrides Sub OnMouseEnter(e As EventArgs)
  892.         MyBase.OnMouseEnter(e)
  893.         State = MouseState.Over : Invalidate()
  894.     End Sub
  895.     Protected Overrides Sub OnMouseLeave(e As EventArgs)
  896.         MyBase.OnMouseLeave(e)
  897.         State = MouseState.None : Invalidate()
  898.     End Sub
  899.  
  900. #End Region
  901.  
  902. #End Region
  903.  
  904. #Region " Colors"
  905.  
  906.     Private _BaseColor As Color = Color.FromArgb(242, 242, 242)
  907.     Private _TextColor As Color = Color.FromArgb(30, 30, 30)
  908.  
  909. #End Region
  910.  
  911.     Sub New()
  912.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or _
  913.                  ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer Or _
  914.                  ControlStyles.SupportsTransparentBackColor, True)
  915.         DoubleBuffered = True
  916.  
  917.         BackColor = Color.Transparent
  918.  
  919.         TB = New Windows.Forms.TextBox
  920.         TB.Font = New Font("Arial", 8, FontStyle.Bold)
  921.         TB.Text = Text
  922.         TB.BackColor = _BaseColor
  923.         TB.ForeColor = _TextColor
  924.         TB.MaxLength = _MaxLength
  925.         TB.Multiline = _Multiline
  926.         TB.ReadOnly = _ReadOnly
  927.         TB.UseSystemPasswordChar = _UseSystemPasswordChar
  928.         TB.BorderStyle = BorderStyle.None
  929.         TB.Location = New Point(11, 5)
  930.         TB.Width = Width - 10
  931.         _Style = RoundingStyle.Normal
  932.  
  933.         TB.Cursor = Cursors.IBeam
  934.  
  935.         If _Multiline Then
  936.             TB.Height = Height - 11
  937.         Else
  938.             Height = TB.Height + 11
  939.         End If
  940.  
  941.         AddHandler TB.TextChanged, AddressOf OnBaseTextChanged
  942.         AddHandler TB.KeyDown, AddressOf OnBaseKeyDown
  943.     End Sub
  944.  
  945.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  946.         Dim B As New Bitmap(Width, Height)
  947.         Dim G As Graphics = Graphics.FromImage(B)
  948.         G = Graphics.FromImage(B)
  949.  
  950.         W = Width - 1 : H = Height - 1
  951.  
  952.         Dim Base As New Rectangle(0, 0, W, H)
  953.  
  954.         With G
  955.             .SmoothingMode = SmoothingMode.HighQuality
  956.             .Clear(BackColor)
  957.  
  958.             TB.BackColor = _BaseColor
  959.             TB.ForeColor = _TextColor
  960.  
  961.             Select Case _Style
  962.                 Case RoundingStyle.Normal
  963.                     .FillPath(New SolidBrush(_BaseColor), Draw.CreateRound(Base, 5))
  964.                     Dim tg As New LinearGradientBrush(Base, Color.FromArgb(186, 188, 191), Color.FromArgb(204, 205, 209), 90S)
  965.                     .DrawPath(New Pen(tg), Draw.CreateRound(Base, 5))
  966.                 Case RoundingStyle.Rounded
  967.                     .DrawPath(New Pen(New SolidBrush(Color.FromArgb(132, 130, 128))), Draw.CreateRound(New Rectangle(Base.X, Base.Y + 1, Base.Width, Base.Height - 1), 20))
  968.  
  969.                     .FillPath(New SolidBrush(_BaseColor), Draw.CreateRound(New Rectangle(Base.X, Base.Y, Base.Width, Base.Height - 1), 20))
  970.                     Dim tg As New LinearGradientBrush(New Rectangle(Base.X, Base.Y, Base.Width, Base.Height - 1), Color.Black, Color.FromArgb(31, 28, 24), 90S)
  971.                     .DrawPath(New Pen(tg), Draw.CreateRound(New Rectangle(Base.X, Base.Y, Base.Width, Base.Height - 1), 20))
  972.             End Select
  973.         End With
  974.  
  975.         MyBase.OnPaint(e)
  976.         G.Dispose()
  977.         e.Graphics.InterpolationMode = 7
  978.         e.Graphics.DrawImageUnscaled(B, 0, 0)
  979.         B.Dispose()
  980.     End Sub
  981.  
  982. End Class
  983. Public Class xVisualProgressBar : Inherits Control
  984.  
  985. #Region " Control Help - Properties & Flicker Control "
  986.     Private OFS As Integer = 0
  987.     Private Speed As Integer = 50
  988.     Private _Maximum As Integer = 100
  989.  
  990.     Public Property Maximum() As Integer
  991.         Get
  992.             Return _Maximum
  993.         End Get
  994.         Set(ByVal v As Integer)
  995.             Select Case v
  996.                 Case Is < _Value
  997.                     _Value = v
  998.             End Select
  999.             _Maximum = v
  1000.             Invalidate()
  1001.         End Set
  1002.     End Property
  1003.     Private _Value As Integer = 0
  1004.     Public Property Value() As Integer
  1005.         Get
  1006.             Select Case _Value
  1007.                 Case 0
  1008.                     Return 0
  1009.                 Case Else
  1010.                     Return _Value
  1011.             End Select
  1012.         End Get
  1013.         Set(ByVal v As Integer)
  1014.             Select Case v
  1015.                 Case Is > _Maximum
  1016.                     v = _Maximum
  1017.             End Select
  1018.             _Value = v
  1019.             Invalidate()
  1020.         End Set
  1021.     End Property
  1022.     Private _ShowPercentage As Boolean = False
  1023.     Public Property ShowPercentage() As Boolean
  1024.         Get
  1025.             Return _ShowPercentage
  1026.         End Get
  1027.         Set(ByVal v As Boolean)
  1028.             _ShowPercentage = v
  1029.             Invalidate()
  1030.         End Set
  1031.     End Property
  1032.  
  1033.     Protected Overrides Sub CreateHandle()
  1034.         MyBase.CreateHandle()
  1035.     End Sub
  1036.     Sub Animate()
  1037.         While True
  1038.             If OFS <= Width Then : OFS += 1
  1039.             Else : OFS = 0
  1040.             End If
  1041.             Invalidate()
  1042.             Threading.Thread.Sleep(Speed)
  1043.         End While
  1044.     End Sub
  1045. #End Region
  1046.  
  1047.     Sub New()
  1048.         MyBase.New()
  1049.         DoubleBuffered = True
  1050.         SetStyle(ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  1051.         BackColor = Color.Transparent
  1052.         Size = New Size(274, 30)
  1053.     End Sub
  1054.  
  1055.     Dim InnerTexture As TextureBrush = NoiseBrush({Color.FromArgb(55, 52, 48), Color.FromArgb(57, 50, 50), Color.FromArgb(53, 50, 46)})
  1056.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  1057.         Dim B As New Bitmap(Width, Height)
  1058.         Dim G As Graphics = Graphics.FromImage(B)
  1059.  
  1060.         'G.SmoothingMode = SmoothingMode.HighQuality
  1061.  
  1062.         Dim intValue As Integer = CInt(_Value / _Maximum * Width)
  1063.         G.Clear(BackColor)
  1064.  
  1065.         Dim percentColor As SolidBrush = New SolidBrush(Color.White)
  1066.  
  1067.         G.FillRectangle(InnerTexture, New Rectangle(0, 0, Width - 1, Height - 1))
  1068.  
  1069.         Dim blend As ColorBlend = New ColorBlend()
  1070.  
  1071.         'Add the Array of Color
  1072.         Dim bColors As Color() = New Color() {Color.FromArgb(20, Color.White), Color.FromArgb(10, Color.Black), Color.FromArgb(10, Color.White)}
  1073.         blend.Colors = bColors
  1074.  
  1075.         'Add the Array Single (0-1) colorpoints to place each Color
  1076.         Dim bPts As Single() = New Single() {0, 0.8, 1}
  1077.         blend.Positions = bPts
  1078.  
  1079.         Using br As New LinearGradientBrush(New Rectangle(0, 0, Width - 1, Height - 1), Color.White, Color.Black, LinearGradientMode.Vertical)
  1080.  
  1081.             'Blend the colors into the Brush
  1082.             br.InterpolationColors = blend
  1083.  
  1084.             'Fill the rect with the blend
  1085.             G.FillRectangle(br, New Rectangle(0, 0, Width - 1, Height - 1))
  1086.  
  1087.         End Using
  1088.  
  1089.         G.DrawRectangle(Pens.Black, New Rectangle(0, 0, Width - 1, Height - 1))
  1090.         G.DrawLine(GetPen(Color.FromArgb(99, 97, 94)), 1, 1, Width - 3, 1)
  1091.         G.DrawLine(GetPen(Color.FromArgb(64, 60, 57)), 1, Height - 2, Width - 3, Height - 2)
  1092.  
  1093.         '//// Bar Fill
  1094.         If Not intValue = 0 Then
  1095.             G.FillRectangle(New LinearGradientBrush(New Rectangle(2, 2, intValue - 3, Height - 4), Color.FromArgb(114, 203, 232), Color.FromArgb(58, 118, 188), 90S), New Rectangle(2, 2, intValue - 3, Height - 4))
  1096.             G.DrawLine(GetPen(Color.FromArgb(235, 255, 255)), 2, 2, intValue - 2, 2)
  1097.             'G.DrawLine(GetPen(Color.FromArgb(27, 25, 23)), 2, Height - 2, intValue + 1, Height - 2)
  1098.             percentColor = New SolidBrush(Color.White)
  1099.         End If
  1100.  
  1101.         If _ShowPercentage Then
  1102.             G.DrawString(Convert.ToString(String.Concat(Value, "%")), New Font("Arial", 10, FontStyle.Bold), GetBrush(Color.FromArgb(20, 20, 20)), New Rectangle(1, 2, Width - 1, Height - 1), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  1103.             G.DrawString(Convert.ToString(String.Concat(Value, "%")), New Font("Arial", 10, FontStyle.Bold), percentColor, New Rectangle(0, 1, Width - 1, Height - 1), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  1104.         End If
  1105.  
  1106.         e.Graphics.DrawImage(B.Clone(), 0, 0)
  1107.         G.Dispose() : B.Dispose()
  1108.     End Sub
  1109. End Class
  1110. <DefaultEvent("CheckedChanged")> Public Class xVisualRadioButton : Inherits Control
  1111.  
  1112. #Region " Control Help - MouseState & Flicker Control"
  1113.     Private R1 As Rectangle
  1114.     Private G1 As LinearGradientBrush
  1115.  
  1116.     Private State As MouseState = MouseState.None
  1117.     Protected Overrides Sub OnMouseEnter(ByVal e As System.EventArgs)
  1118.         MyBase.OnMouseEnter(e)
  1119.         State = MouseState.Over
  1120.         Invalidate()
  1121.     End Sub
  1122.     Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  1123.         MyBase.OnMouseDown(e)
  1124.         State = MouseState.Down
  1125.         Invalidate()
  1126.     End Sub
  1127.     Protected Overrides Sub OnMouseLeave(ByVal e As System.EventArgs)
  1128.         MyBase.OnMouseLeave(e)
  1129.         State = MouseState.None
  1130.         Invalidate()
  1131.     End Sub
  1132.     Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
  1133.         MyBase.OnMouseUp(e)
  1134.         State = MouseState.Over
  1135.         Invalidate()
  1136.     End Sub
  1137.     Protected Overrides Sub OnResize(ByVal e As System.EventArgs)
  1138.         MyBase.OnResize(e)
  1139.         Height = 21
  1140.     End Sub
  1141.     Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
  1142.         MyBase.OnTextChanged(e)
  1143.         Invalidate()
  1144.     End Sub
  1145.     Private _Checked As Boolean
  1146.     Property Checked() As Boolean
  1147.         Get
  1148.             Return _Checked
  1149.         End Get
  1150.         Set(ByVal value As Boolean)
  1151.             _Checked = value
  1152.             InvalidateControls()
  1153.             RaiseEvent CheckedChanged(Me)
  1154.             Invalidate()
  1155.         End Set
  1156.     End Property
  1157.     Protected Overrides Sub OnClick(ByVal e As EventArgs)
  1158.         If Not _Checked Then Checked = True
  1159.         MyBase.OnClick(e)
  1160.     End Sub
  1161.     Event CheckedChanged(ByVal sender As Object)
  1162.     Protected Overrides Sub OnCreateControl()
  1163.         MyBase.OnCreateControl()
  1164.         InvalidateControls()
  1165.     End Sub
  1166.     Private Sub InvalidateControls()
  1167.         If Not IsHandleCreated OrElse Not _Checked Then Return
  1168.  
  1169.         For Each C As Control In Parent.Controls
  1170.             If C IsNot Me AndAlso TypeOf C Is xVisualRadioButton Then
  1171.                 DirectCast(C, xVisualRadioButton).Checked = False
  1172.             End If
  1173.         Next
  1174.     End Sub
  1175. #End Region
  1176.  
  1177.     Sub New()
  1178.         MyBase.New()
  1179.         SetStyle(ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  1180.         BackColor = Color.Transparent
  1181.         ForeColor = Color.Black
  1182.         Size = New Size(150, 21)
  1183.         DoubleBuffered = True
  1184.     End Sub
  1185.  
  1186.     Dim InnerTexture As TextureBrush = NoiseBrush({Color.FromArgb(55, 52, 48), Color.FromArgb(57, 50, 50), Color.FromArgb(53, 50, 46)})
  1187.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  1188.         Dim B As New Bitmap(Width, Height)
  1189.         Dim G As Graphics = Graphics.FromImage(B)
  1190.         Dim radioBtnRectangle As New Rectangle(0, 0, Height - 1, Height - 1)
  1191.  
  1192.         G.SmoothingMode = SmoothingMode.HighQuality
  1193.         G.CompositingQuality = CompositingQuality.HighQuality
  1194.         G.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAliasGridFit
  1195.  
  1196.         G.Clear(BackColor)
  1197.  
  1198.         G.FillRectangle(InnerTexture, radioBtnRectangle)
  1199.         G.DrawRectangle(New Pen(Color.Black), radioBtnRectangle)
  1200.         G.DrawRectangle(New Pen(Color.FromArgb(99, 97, 94)), New Rectangle(1, 1, Height - 3, Height - 3))
  1201.  
  1202.         If Checked Then
  1203.             G.DrawString("a", New Font("Marlett", 12, FontStyle.Regular), Brushes.White, New Point(1, 2))
  1204.         End If
  1205.  
  1206.         Dim drawFont As New Font("Arial", 10, FontStyle.Bold)
  1207.         Dim nb As Brush = New SolidBrush(Color.FromArgb(250, 250, 250))
  1208.         G.DrawString(Text, drawFont, nb, New Point(25, 10), New StringFormat With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Center})
  1209.  
  1210.         e.Graphics.DrawImage(B.Clone(), 0, 0)
  1211.         G.Dispose() : B.Dispose()
  1212.     End Sub
  1213.  
  1214. End Class
  1215. Public Class xVisualComboBox : Inherits ComboBox
  1216. #Region " Control Help - Properties & Flicker Control "
  1217.     Private _StartIndex As Integer = 0
  1218.     Public Property StartIndex As Integer
  1219.         Get
  1220.             Return _StartIndex
  1221.         End Get
  1222.         Set(ByVal value As Integer)
  1223.             _StartIndex = value
  1224.             Try
  1225.                 MyBase.SelectedIndex = value
  1226.             Catch
  1227.             End Try
  1228.             Invalidate()
  1229.         End Set
  1230.     End Property
  1231.     Public Overrides ReadOnly Property DisplayRectangle As System.Drawing.Rectangle
  1232.         Get
  1233.             Return MyBase.DisplayRectangle
  1234.         End Get
  1235.     End Property
  1236.     Sub ReplaceItem(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles Me.DrawItem
  1237.         e.DrawBackground()
  1238.         Try
  1239.             If (e.State And DrawItemState.Selected) = DrawItemState.Selected Then
  1240.                 e.Graphics.FillRectangle(New SolidBrush(_highlightColor), e.Bounds)
  1241.                 Dim gloss As New LinearGradientBrush(e.Bounds, Color.FromArgb(20, Color.White), Color.FromArgb(0, Color.White), 90S) 'Highlight Gloss/Color
  1242.                 e.Graphics.FillRectangle(gloss, New Rectangle(New Point(e.Bounds.X, e.Bounds.Y), New Size(e.Bounds.Width, e.Bounds.Height))) 'Drop Background
  1243.                 e.Graphics.DrawRectangle(New Pen(Color.FromArgb(90, Color.Black)) With {.DashStyle = DashStyle.Solid}, New Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width - 1, e.Bounds.Height - 1))
  1244.             Else
  1245.                 e.Graphics.FillRectangle(InnerTexture, e.Bounds)
  1246.             End If
  1247.             Using b As New SolidBrush(Color.FromArgb(230, 230, 230))
  1248.                 e.Graphics.DrawString(MyBase.GetItemText(MyBase.Items(e.Index)), e.Font, b, New Rectangle(e.Bounds.X + 2, e.Bounds.Y, e.Bounds.Width - 4, e.Bounds.Height))
  1249.             End Using
  1250.         Catch
  1251.         End Try
  1252.         e.DrawFocusRectangle()
  1253.     End Sub
  1254.     Protected Sub DrawTriangle(ByVal Clr As Color, ByVal FirstPoint As Point, ByVal SecondPoint As Point, ByVal ThirdPoint As Point, ByVal G As Graphics)
  1255.         Dim points As New List(Of Point)()
  1256.         points.Add(FirstPoint)
  1257.         points.Add(SecondPoint)
  1258.         points.Add(ThirdPoint)
  1259.         G.FillPolygon(New SolidBrush(Clr), points.ToArray)
  1260.         G.DrawPolygon(New Pen(New SolidBrush(Color.Black)), points.ToArray)
  1261.     End Sub
  1262.     Private _highlightColor As Color = Color.FromArgb(99, 97, 94)
  1263.     Public Property ItemHighlightColor() As Color
  1264.         Get
  1265.             Return _highlightColor
  1266.         End Get
  1267.         Set(ByVal v As Color)
  1268.             _highlightColor = v
  1269.             Invalidate()
  1270.         End Set
  1271.     End Property
  1272. #End Region
  1273.  
  1274.     Sub New()
  1275.         MyBase.New()
  1276.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or ControlStyles.DoubleBuffer Or ControlStyles.SupportsTransparentBackColor, True)
  1277.         DrawMode = Windows.Forms.DrawMode.OwnerDrawFixed
  1278.         BackColor = Color.Transparent
  1279.         ForeColor = Color.Silver
  1280.         Font = New Font("Arial", 9, FontStyle.Bold)
  1281.         DropDownStyle = ComboBoxStyle.DropDownList
  1282.         DoubleBuffered = True
  1283.         Size = New Size(Width + 1, 21)
  1284.         ItemHeight = 16
  1285.     End Sub
  1286.  
  1287.     Dim InnerTexture As TextureBrush = NoiseBrush({Color.FromArgb(55, 52, 48), Color.FromArgb(57, 50, 50), Color.FromArgb(53, 50, 46)})
  1288.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  1289.         Dim B As New Bitmap(Width, Height)
  1290.         Dim G As Graphics = Graphics.FromImage(B)
  1291.         G.SmoothingMode = SmoothingMode.HighQuality
  1292.  
  1293.  
  1294.         G.Clear(BackColor)
  1295.         G.FillRectangle(InnerTexture, New Rectangle(0, 0, Width, Height - 1))
  1296.         G.DrawLine(New Pen(Color.FromArgb(99, 97, 94)), 1, 1, Width - 2, 1)
  1297.         G.DrawRectangle(New Pen(Color.FromArgb(99, 97, 94)), New Rectangle(1, 1, Width - 3, Height - 3))
  1298.  
  1299.         DrawTriangle(Color.FromArgb(99, 97, 94), New Point(Width - 14, 9), New Point(Width - 6, 9), New Point(Width - 10, 14), G) 'Triangle Fill Color
  1300.         G.DrawRectangle(Pens.Black, New Rectangle(0, 0, Width - 1, Height - 1))
  1301.  
  1302.         'Draw Separator line
  1303.         G.DrawLine(New Pen(Color.FromArgb(99, 97, 94)), New Point(Width - 21, 1), New Point(Width - 21, Height - 3))
  1304.         G.DrawLine(New Pen(Color.Black), New Point(Width - 20, 2), New Point(Width - 20, Height - 3))
  1305.         G.DrawLine(New Pen(Color.FromArgb(99, 97, 94)), New Point(Width - 19, 1), New Point(Width - 19, Height - 3))
  1306.  
  1307.         Dim blend As ColorBlend = New ColorBlend()
  1308.  
  1309.         'Add the Array of Color
  1310.         Dim bColors As Color() = New Color() {Color.FromArgb(15, Color.White), Color.FromArgb(10, Color.Black), Color.FromArgb(10, Color.White)}
  1311.         blend.Colors = bColors
  1312.  
  1313.         'Add the Array Single (0-1) colorpoints to place each Color
  1314.         Dim bPts As Single() = New Single() {0, 0.75, 1}
  1315.         blend.Positions = bPts
  1316.  
  1317.         Using br As New LinearGradientBrush(New Rectangle(0, 0, Width, Height - 1), Color.White, Color.Black, LinearGradientMode.Vertical)
  1318.  
  1319.             'Blend the colors into the Brush
  1320.             br.InterpolationColors = blend
  1321.  
  1322.             'Fill the rect with the blend
  1323.             G.FillRectangle(br, New Rectangle(0, 0, Width, Height - 1))
  1324.  
  1325.         End Using
  1326.         Try
  1327.             G.DrawString(Text, Font, New SolidBrush(Color.FromArgb(250, 250, 250)), New Rectangle(5, 0, Width - 20, Height), New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Near})
  1328.         Catch
  1329.         End Try
  1330.  
  1331.         e.Graphics.DrawImage(B.Clone(), 0, 0)
  1332.         G.Dispose() : B.Dispose()
  1333.     End Sub
  1334. End Class
  1335. Public Class xVisualTabControl : Inherits TabControl
  1336.  
  1337.     Protected Overrides Sub OnResize(ByVal e As System.EventArgs)
  1338.         MyBase.OnResize(e)
  1339.     End Sub
  1340.  
  1341.     Sub New()
  1342.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or ControlStyles.DoubleBuffer, True)
  1343.         DoubleBuffered = True
  1344.         SizeMode = TabSizeMode.Fixed
  1345.         ItemSize = New Size(35, 122)
  1346.     End Sub
  1347.     Protected Overrides Sub CreateHandle()
  1348.         MyBase.CreateHandle()
  1349.         Alignment = TabAlignment.Left
  1350.     End Sub
  1351.  
  1352.     Function ToPen(ByVal color As Color) As Pen
  1353.         Return New Pen(color)
  1354.     End Function
  1355.  
  1356.     Function ToBrush(ByVal color As Color) As Brush
  1357.         Return New SolidBrush(color)
  1358.     End Function
  1359.     Dim InnerTexture As TextureBrush = NoiseBrush({Color.FromArgb(45, 41, 37), Color.FromArgb(47, 43, 39), Color.FromArgb(43, 39, 35)})
  1360.     Dim TabBGTexture As TextureBrush = NoiseBrush({Color.FromArgb(55, 51, 48), Color.FromArgb(57, 53, 50), Color.FromArgb(53, 49, 46)})
  1361.  
  1362.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  1363.         Dim B As New Bitmap(Width, Height)
  1364.         Dim G As Graphics = Graphics.FromImage(B)
  1365.         Dim FF As New Font("Arial", 9, FontStyle.Bold)
  1366.  
  1367.         Try : SelectedTab.BackColor = Color.FromArgb(56, 52, 49) : Catch : End Try
  1368.         G.Clear(Parent.FindForm.BackColor)
  1369.  
  1370.         G.FillRectangle(TabBGTexture, New Rectangle(0, 0, ItemSize.Height + 3, Height - 1)) 'Full Tab Background
  1371.         G.DrawLine(GetPen(Color.FromArgb(44, 42, 39)), 1, Height - 3, ItemSize.Height + 3, Height - 3)
  1372.         G.DrawLine(GetPen(Color.FromArgb(48, 45, 43)), 1, Height - 4, ItemSize.Height + 3, Height - 4)
  1373.         G.DrawLine(GetPen(Color.FromArgb(53, 50, 47)), 1, Height - 5, ItemSize.Height + 3, Height - 5)
  1374.  
  1375.         Dim y As Integer = GetTabRect(0).Height * 2
  1376.         Do Until y >= Height - 1
  1377.             G.DrawLine(Pens.Black, 1, y, Width - 2, y)
  1378.             G.DrawLine(GetPen(Color.FromArgb(99, 97, 94)), 1, y + 1, Width - 2, y + 1)
  1379.             y = y + GetTabRect(0).Height
  1380.         Loop
  1381.  
  1382.         For i = 0 To TabCount - 1
  1383.             If i = SelectedIndex Then
  1384.                 Dim x2 As Rectangle = New Rectangle(New Point(GetTabRect(i).Location.X - 2, GetTabRect(i).Location.Y - 2), New Size(GetTabRect(i).Width + 3, GetTabRect(i).Height - 1))
  1385.  
  1386.                 If SelectedIndex = 0 Then
  1387.                     Dim tabRect As New Rectangle(GetTabRect(i).Location.X, GetTabRect(i).Location.Y - 1, GetTabRect(i).Size.Width - 1, GetTabRect(i).Size.Height - 1)
  1388.                     Dim TabOverlay As New LinearGradientBrush(tabRect, Color.FromArgb(114, 203, 232), Color.FromArgb(58, 118, 188), 90S)
  1389.                     G.FillRectangle(TabOverlay, tabRect)
  1390.  
  1391.                     G.DrawLine(GetPen(Color.FromArgb(235, 255, 255)), GetTabRect(i).Location.X, GetTabRect(i).Location.Y - 1, GetTabRect(i).Size.Width, GetTabRect(i).Location.Y - 1)
  1392.                 Else
  1393.                     Dim tabRect As New Rectangle(GetTabRect(i).Location.X, GetTabRect(i).Location.Y - 2, GetTabRect(i).Size.Width - 1, GetTabRect(i).Size.Height)
  1394.                     Dim TabOverlay As New LinearGradientBrush(tabRect, Color.FromArgb(114, 203, 232), Color.FromArgb(58, 118, 188), 90S)
  1395.                     G.FillRectangle(TabOverlay, tabRect)
  1396.  
  1397.                     G.DrawLine(GetPen(Color.FromArgb(235, 255, 255)), GetTabRect(i).Location.X, GetTabRect(i).Location.Y - 2, GetTabRect(i).Size.Width, GetTabRect(i).Location.Y - 2)
  1398.                 End If
  1399.  
  1400.                 G.DrawLine(Pens.Black, GetTabRect(i).Location.X, GetTabRect(i).Location.Y + 33, GetTabRect(i).Size.Width, GetTabRect(i).Location.Y + 33)
  1401.  
  1402.                 G.SmoothingMode = SmoothingMode.HighQuality
  1403.  
  1404.                 G.DrawString(TabPages(i).Text, FF, GetBrush(Color.FromArgb(20, 20, 20)), New Rectangle(x2.X, x2.Y - 1, x2.Width + 1, x2.Height + 2), New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
  1405.                 G.DrawString(TabPages(i).Text, FF, Brushes.White, New Rectangle(x2.X, x2.Y - 1, x2.Width, x2.Height), New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
  1406.  
  1407.                 G.DrawLine(New Pen(Color.FromArgb(96, 110, 121)), New Point(x2.Location.X - 1, x2.Location.Y - 1), New Point(x2.Location.X, x2.Location.Y))
  1408.                 G.DrawLine(New Pen(Color.FromArgb(96, 110, 121)), New Point(x2.Location.X - 1, x2.Bottom - 1), New Point(x2.Location.X, x2.Bottom))
  1409.             Else
  1410.                 Dim x2 As Rectangle = New Rectangle(New Point(GetTabRect(i).Location.X - 2, GetTabRect(i).Location.Y - 2), New Size(GetTabRect(i).Width + 3, GetTabRect(i).Height - 1))
  1411.                 Dim tabRect As New Rectangle(GetTabRect(i).Location.X, GetTabRect(i).Location.Y - 2, GetTabRect(i).Size.Width - 1, GetTabRect(i).Size.Height - 1)
  1412.  
  1413.                 G.FillRectangle(InnerTexture, tabRect) 'Highlight Fill Background
  1414.                 Dim TabOverlay As New LinearGradientBrush(tabRect, Color.FromArgb(15, Color.White), Color.FromArgb(100, Color.FromArgb(43, 40, 38)), 90S)
  1415.                 G.FillRectangle(TabOverlay, tabRect)
  1416.  
  1417.                 G.DrawLine(GetPen(Color.FromArgb(113, 110, 108)), GetTabRect(i).Location.X, GetTabRect(i).Location.Y - 1, GetTabRect(i).Size.Width, GetTabRect(i).Location.Y - 1)
  1418.                 G.DrawLine(Pens.Black, GetTabRect(i).Location.X, GetTabRect(i).Location.Y + 32, GetTabRect(i).Size.Width, GetTabRect(i).Location.Y + 32)
  1419.  
  1420.                 If i = TabCount - 1 Then
  1421.                     G.DrawLine(GetPen(Color.FromArgb(64, 60, 57)), GetTabRect(i).Location.X, GetTabRect(i).Location.Y + 31, GetTabRect(i).Size.Width, GetTabRect(i).Location.Y + 31)
  1422.                     G.DrawLine(GetPen(Color.FromArgb(35, 33, 31)), GetTabRect(i).Location.X, GetTabRect(i).Location.Y + 33, GetTabRect(i).Size.Width, GetTabRect(i).Location.Y + 33)
  1423.                     G.DrawLine(GetPen(Color.FromArgb(43, 41, 38)), GetTabRect(i).Location.X, GetTabRect(i).Location.Y + 34, GetTabRect(i).Size.Width, GetTabRect(i).Location.Y + 34)
  1424.                     G.DrawLine(GetPen(Color.FromArgb(53, 50, 47)), GetTabRect(i).Location.X, GetTabRect(i).Location.Y + 35, GetTabRect(i).Size.Width, GetTabRect(i).Location.Y + 35)
  1425.                     G.DrawLine(GetPen(Color.FromArgb(58, 55, 51)), GetTabRect(i).Location.X, GetTabRect(i).Location.Y + 36, GetTabRect(i).Size.Width, GetTabRect(i).Location.Y + 36)
  1426.                 End If
  1427.  
  1428.                 G.DrawString(TabPages(i).Text, FF, New SolidBrush(Color.FromArgb(210, 220, 230)), New Rectangle(x2.X, x2.Y - 1, x2.Width, x2.Height), New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
  1429.             End If
  1430.             G.FillRectangle(New SolidBrush(Color.FromArgb(56, 52, 49)), New Rectangle(123, -1, Width - 123, Height + 1)) 'Page Fill Full
  1431.  
  1432.             G.DrawRectangle(Pens.Black, New Rectangle(123, 0, Width - 124, Height - 2))
  1433.             Dim c As Color() = {Color.FromArgb(43, 40, 38), Color.FromArgb(50, 47, 44), Color.FromArgb(55, 52, 49)}
  1434.             Draw.InnerGlow(G, New Rectangle(124, 1, Width - 125, Height - 3), c)
  1435.         Next
  1436.  
  1437.         G.DrawLine(GetPen(Color.FromArgb(56, 52, 49)), -1, Height - 1, ItemSize.Height + 1, Height - 1)
  1438.         G.DrawLine(GetPen(Color.FromArgb(56, 52, 49)), 0, -1, 0, Height - 1)
  1439.         G.DrawRectangle(New Pen(New SolidBrush(Color.Black)), New Rectangle(1, 0, ItemSize.Height, Height - 2)) 'Full Tab Inner Outline
  1440.  
  1441.         e.Graphics.DrawImage(B.Clone, 0, 0)
  1442.         G.Dispose() : B.Dispose()
  1443.     End Sub
  1444. End Class
  1445. <DefaultEvent("CheckedChanged")> Public Class xVisualCheckBox : Inherits Control
  1446.  
  1447. #Region " Control Help - MouseState & Flicker Control"
  1448.     Private State As MouseState = MouseState.None
  1449.     Protected Overrides Sub OnMouseEnter(ByVal e As System.EventArgs)
  1450.         MyBase.OnMouseEnter(e)
  1451.         State = MouseState.Over
  1452.         Invalidate()
  1453.     End Sub
  1454.     Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  1455.         MyBase.OnMouseDown(e)
  1456.         State = MouseState.Down
  1457.         Invalidate()
  1458.     End Sub
  1459.     Protected Overrides Sub OnMouseLeave(ByVal e As System.EventArgs)
  1460.         MyBase.OnMouseLeave(e)
  1461.         State = MouseState.None
  1462.         Invalidate()
  1463.     End Sub
  1464.     Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
  1465.         MyBase.OnMouseUp(e)
  1466.         State = MouseState.Over
  1467.         Invalidate()
  1468.     End Sub
  1469.     Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
  1470.         MyBase.OnTextChanged(e)
  1471.         Invalidate()
  1472.     End Sub
  1473.     Private _Checked As Boolean
  1474.     Property Checked() As Boolean
  1475.         Get
  1476.             Return _Checked
  1477.         End Get
  1478.         Set(ByVal value As Boolean)
  1479.             _Checked = value
  1480.             Invalidate()
  1481.         End Set
  1482.     End Property
  1483.     Protected Overrides Sub OnResize(ByVal e As System.EventArgs)
  1484.         MyBase.OnResize(e)
  1485.         Height = 21
  1486.     End Sub
  1487.     Protected Overrides Sub OnClick(ByVal e As System.EventArgs)
  1488.         _Checked = Not _Checked
  1489.         RaiseEvent CheckedChanged(Me)
  1490.         MyBase.OnClick(e)
  1491.     End Sub
  1492.     Event CheckedChanged(ByVal sender As Object)
  1493. #End Region
  1494.  
  1495.  
  1496.     Sub New()
  1497.         MyBase.New()
  1498.         SetStyle(ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor Or ControlStyles.OptimizedDoubleBuffer, True)
  1499.         BackColor = Color.Transparent
  1500.         ForeColor = Color.Black
  1501.         Size = New Size(250, 21)
  1502.         DoubleBuffered = True
  1503.     End Sub
  1504.  
  1505.     Dim InnerTexture As TextureBrush = NoiseBrush({Color.FromArgb(55, 52, 48), Color.FromArgb(57, 50, 50), Color.FromArgb(53, 50, 46)})
  1506.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  1507.         Dim B As New Bitmap(Width, Height)
  1508.         Dim G As Graphics = Graphics.FromImage(B)
  1509.         Dim radioBtnRectangle As New Rectangle(0, 0, Height - 1, Height - 1)
  1510.  
  1511.         G.SmoothingMode = SmoothingMode.HighQuality
  1512.         G.CompositingQuality = CompositingQuality.HighQuality
  1513.         G.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAliasGridFit
  1514.  
  1515.         G.Clear(BackColor)
  1516.  
  1517.         G.FillRectangle(InnerTexture, radioBtnRectangle)
  1518.         G.DrawRectangle(New Pen(Color.Black), radioBtnRectangle)
  1519.         G.DrawRectangle(New Pen(Color.FromArgb(99, 97, 94)), New Rectangle(1, 1, Height - 3, Height - 3))
  1520.  
  1521.         If Checked Then
  1522.             G.DrawString("a", New Font("Marlett", 12, FontStyle.Regular), Brushes.White, New Point(1, 2))
  1523.         End If
  1524.  
  1525.         Dim drawFont As New Font("Arial", 10, FontStyle.Bold)
  1526.         Dim nb As Brush = New SolidBrush(Color.FromArgb(250, 250, 250))
  1527.         G.DrawString(Text, drawFont, nb, New Point(25, 10), New StringFormat With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Center})
  1528.         e.Graphics.DrawImage(B.Clone(), 0, 0)
  1529.         G.Dispose() : B.Dispose()
  1530.  
  1531.     End Sub
  1532.  
  1533. End Class
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top