Advertisement
LaPanthere

VibLander Theme

Jun 16th, 2013
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 45.98 KB | None | 0 0
  1. Imports System.Drawing.Drawing2D
  2. Imports System.ComponentModel
  3. Imports System.Runtime.InteropServices
  4. '.::VibeLander Theme::.
  5. 'Author:   UnReLaTeDScript
  6. 'Credits:  Aeonhack [Themebase]
  7. 'Version:  1.0
  8. MustInherit Class Theme
  9.     Inherits ContainerControl
  10.  
  11. #Region " Initialization "
  12.  
  13.     Protected G As Graphics
  14.     Sub New()
  15.         SetStyle(DirectCast(139270, ControlStyles), True)
  16.     End Sub
  17.  
  18.     Private ParentIsForm As Boolean
  19.     Protected Overrides Sub OnHandleCreated(ByVal e As EventArgs)
  20.         Dock = DockStyle.Fill
  21.         ParentIsForm = TypeOf Parent Is Form
  22.         If ParentIsForm Then
  23.             If Not _TransparencyKey = Color.Empty Then ParentForm.TransparencyKey = _TransparencyKey
  24.             ParentForm.FormBorderStyle = FormBorderStyle.None
  25.         End If
  26.         MyBase.OnHandleCreated(e)
  27.     End Sub
  28.  
  29.     Overrides Property Text() As String
  30.         Get
  31.             Return MyBase.Text
  32.         End Get
  33.         Set(ByVal v As String)
  34.             MyBase.Text = v
  35.             Invalidate()
  36.         End Set
  37.     End Property
  38. #End Region
  39.  
  40. #Region " Sizing and Movement "
  41.  
  42.     Private _Resizable As Boolean = True
  43.     Property Resizable() As Boolean
  44.         Get
  45.             Return _Resizable
  46.         End Get
  47.         Set(ByVal value As Boolean)
  48.             _Resizable = value
  49.         End Set
  50.     End Property
  51.  
  52.     Private _MoveHeight As Integer = 24
  53.     Property MoveHeight() As Integer
  54.         Get
  55.             Return _MoveHeight
  56.         End Get
  57.         Set(ByVal v As Integer)
  58.             _MoveHeight = v
  59.             Header = New Rectangle(7, 7, Width - 14, _MoveHeight - 7)
  60.         End Set
  61.     End Property
  62.  
  63.     Private Flag As IntPtr
  64.     Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  65.         If Not e.Button = MouseButtons.Left Then Return
  66.         If ParentIsForm Then If ParentForm.WindowState = FormWindowState.Maximized Then Return
  67.  
  68.         If Header.Contains(e.Location) Then
  69.             Flag = New IntPtr(2)
  70.         ElseIf Current.Position = 0 Or Not _Resizable Then
  71.             Return
  72.         Else
  73.             Flag = New IntPtr(Current.Position)
  74.         End If
  75.  
  76.         Capture = False
  77.         DefWndProc(Message.Create(Parent.Handle, 161, Flag, Nothing))
  78.  
  79.         MyBase.OnMouseDown(e)
  80.     End Sub
  81.  
  82.     Private Structure Pointer
  83.         ReadOnly Cursor As Cursor, Position As Byte
  84.         Sub New(ByVal c As Cursor, ByVal p As Byte)
  85.             Cursor = c
  86.             Position = p
  87.         End Sub
  88.     End Structure
  89.  
  90.     Private F1, F2, F3, F4 As Boolean, PTC As Point
  91.     Private Function GetPointer() As Pointer
  92.         PTC = PointToClient(MousePosition)
  93.         F1 = PTC.X < 7
  94.         F2 = PTC.X > Width - 7
  95.         F3 = PTC.Y < 7
  96.         F4 = PTC.Y > Height - 7
  97.  
  98.         If F1 And F3 Then Return New Pointer(Cursors.SizeNWSE, 13)
  99.         If F1 And F4 Then Return New Pointer(Cursors.SizeNESW, 16)
  100.         If F2 And F3 Then Return New Pointer(Cursors.SizeNESW, 14)
  101.         If F2 And F4 Then Return New Pointer(Cursors.SizeNWSE, 17)
  102.         If F1 Then Return New Pointer(Cursors.SizeWE, 10)
  103.         If F2 Then Return New Pointer(Cursors.SizeWE, 11)
  104.         If F3 Then Return New Pointer(Cursors.SizeNS, 12)
  105.         If F4 Then Return New Pointer(Cursors.SizeNS, 15)
  106.         Return New Pointer(Cursors.Default, 0)
  107.     End Function
  108.  
  109.     Private Current, Pending As Pointer
  110.     Private Sub SetCurrent()
  111.         Pending = GetPointer()
  112.         If Current.Position = Pending.Position Then Return
  113.         Current = GetPointer()
  114.         Cursor = Current.Cursor
  115.     End Sub
  116.  
  117.     Protected Overrides Sub OnMouseMove(ByVal e As MouseEventArgs)
  118.         If _Resizable Then SetCurrent()
  119.         MyBase.OnMouseMove(e)
  120.     End Sub
  121.  
  122.     Protected Header As Rectangle
  123.     Protected Overrides Sub OnSizeChanged(ByVal e As EventArgs)
  124.         If Width = 0 OrElse Height = 0 Then Return
  125.         Header = New Rectangle(7, 7, Width - 14, _MoveHeight - 7)
  126.         Invalidate()
  127.         MyBase.OnSizeChanged(e)
  128.     End Sub
  129.  
  130. #End Region
  131.  
  132. #Region " Convienence "
  133.  
  134.     MustOverride Sub PaintHook()
  135.     Protected NotOverridable Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  136.         If Width = 0 OrElse Height = 0 Then Return
  137.         G = e.Graphics
  138.         PaintHook()
  139.     End Sub
  140.  
  141.     Private _TransparencyKey As Color
  142.     Property TransparencyKey() As Color
  143.         Get
  144.             Return _TransparencyKey
  145.         End Get
  146.         Set(ByVal v As Color)
  147.             _TransparencyKey = v
  148.             Invalidate()
  149.         End Set
  150.     End Property
  151.  
  152.     Private _Image As Image
  153.     Property Image() As Image
  154.         Get
  155.             Return _Image
  156.         End Get
  157.         Set(ByVal value As Image)
  158.             _Image = value
  159.             Invalidate()
  160.         End Set
  161.     End Property
  162.     ReadOnly Property ImageWidth() As Integer
  163.         Get
  164.             If _Image Is Nothing Then Return 0
  165.             Return _Image.Width
  166.         End Get
  167.     End Property
  168.  
  169.     Private _Size As Size
  170.     Private _Rectangle As Rectangle
  171.     Private _Gradient As LinearGradientBrush
  172.     Private _Brush As SolidBrush
  173.  
  174.     Protected Sub DrawCorners(ByVal c As Color, ByVal rect As Rectangle)
  175.         _Brush = New SolidBrush(c)
  176.         G.FillRectangle(_Brush, rect.X, rect.Y, 1, 1)
  177.         G.FillRectangle(_Brush, rect.X + (rect.Width - 1), rect.Y, 1, 1)
  178.         G.FillRectangle(_Brush, rect.X, rect.Y + (rect.Height - 1), 1, 1)
  179.         G.FillRectangle(_Brush, rect.X + (rect.Width - 1), rect.Y + (rect.Height - 1), 1, 1)
  180.     End Sub
  181.  
  182.     Protected Sub DrawBorders(ByVal p1 As Pen, ByVal p2 As Pen, ByVal rect As Rectangle)
  183.         G.DrawRectangle(p1, rect.X, rect.Y, rect.Width - 1, rect.Height - 1)
  184.         G.DrawRectangle(p2, rect.X + 1, rect.Y + 1, rect.Width - 3, rect.Height - 3)
  185.     End Sub
  186.  
  187.     Protected Sub DrawText(ByVal a As HorizontalAlignment, ByVal c As Color, ByVal x As Integer)
  188.         DrawText(a, c, x, 0)
  189.     End Sub
  190.     Protected Sub DrawText(ByVal a As HorizontalAlignment, ByVal c As Color, ByVal x As Integer, ByVal y As Integer)
  191.         If String.IsNullOrEmpty(Text) Then Return
  192.         _Size = G.MeasureString(Text, Font).ToSize
  193.         _Brush = New SolidBrush(c)
  194.  
  195.         Select Case a
  196.             Case HorizontalAlignment.Left
  197.                 G.DrawString(Text, Font, _Brush, x, _MoveHeight \ 2 - _Size.Height \ 2 + y)
  198.             Case HorizontalAlignment.Right
  199.                 G.DrawString(Text, Font, _Brush, Width - _Size.Width - x, _MoveHeight \ 2 - _Size.Height \ 2 + y)
  200.             Case HorizontalAlignment.Center
  201.                 G.DrawString(Text, Font, _Brush, Width \ 2 - _Size.Width \ 2 + x, _MoveHeight \ 2 - _Size.Height \ 2 + y)
  202.         End Select
  203.     End Sub
  204.  
  205.     Protected Sub DrawIcon(ByVal a As HorizontalAlignment, ByVal x As Integer)
  206.         DrawIcon(a, x, 0)
  207.     End Sub
  208.     Protected Sub DrawIcon(ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
  209.         If _Image Is Nothing Then Return
  210.         Select Case a
  211.             Case HorizontalAlignment.Left
  212.                 G.DrawImage(_Image, x, _MoveHeight \ 2 - _Image.Height \ 2 + y)
  213.             Case HorizontalAlignment.Right
  214.                 G.DrawImage(_Image, Width - _Image.Width - x, _MoveHeight \ 2 - _Image.Height \ 2 + y)
  215.             Case HorizontalAlignment.Center
  216.                 G.DrawImage(_Image, Width \ 2 - _Image.Width \ 2, _MoveHeight \ 2 - _Image.Height \ 2)
  217.         End Select
  218.     End Sub
  219.  
  220.     Protected Sub DrawGradient(ByVal c1 As Color, ByVal c2 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal angle As Single)
  221.         _Rectangle = New Rectangle(x, y, width, height)
  222.         _Gradient = New LinearGradientBrush(_Rectangle, c1, c2, angle)
  223.         G.FillRectangle(_Gradient, _Rectangle)
  224.     End Sub
  225.  
  226. #End Region
  227.  
  228. End Class
  229. Module Draw
  230.     Public Function RoundRect(ByVal Rectangle As Rectangle, ByVal Curve As Integer) As GraphicsPath
  231.         Dim P As GraphicsPath = New GraphicsPath()
  232.         Dim ArcRectangleWidth As Integer = Curve * 2
  233.         P.AddArc(New Rectangle(Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -180, 90)
  234.         P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -90, 90)
  235.         P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 0, 90)
  236.         P.AddArc(New Rectangle(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 90, 90)
  237.         P.AddLine(New Point(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y), New Point(Rectangle.X, Curve + Rectangle.Y))
  238.         Return P
  239.     End Function
  240.     '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
  241.     '    Dim Rectangle As Rectangle = New Rectangle(X, Y, Width, Height)
  242.     '    Dim P As GraphicsPath = New GraphicsPath()
  243.     '    Dim ArcRectangleWidth As Integer = Curve * 2
  244.     '    P.AddArc(New Rectangle(Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -180, 90)
  245.     '    P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -90, 90)
  246.     '    P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 0, 90)
  247.     '    P.AddArc(New Rectangle(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 90, 90)
  248.     '    P.AddLine(New Point(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y), New Point(Rectangle.X, Curve + Rectangle.Y))
  249.     '    Return P
  250.     'End Function
  251. End Module
  252. MustInherit Class ThemeControl
  253.     Inherits Control
  254.  
  255. #Region " Initialization "
  256.  
  257.     Protected G As Graphics, B As Bitmap
  258.     Sub New()
  259.         SetStyle(DirectCast(139270, ControlStyles), True)
  260.         B = New Bitmap(1, 1)
  261.         G = Graphics.FromImage(B)
  262.     End Sub
  263.  
  264.     Sub AllowTransparent()
  265.         SetStyle(ControlStyles.Opaque, False)
  266.         SetStyle(ControlStyles.SupportsTransparentBackColor, True)
  267.     End Sub
  268.  
  269.     Overrides Property Text() As String
  270.         Get
  271.             Return MyBase.Text
  272.         End Get
  273.         Set(ByVal v As String)
  274.             MyBase.Text = v
  275.             Invalidate()
  276.         End Set
  277.     End Property
  278. #End Region
  279.  
  280. #Region " Mouse Handling "
  281.  
  282.     Protected Enum State As Byte
  283.         MouseNone = 0
  284.         MouseOver = 1
  285.         MouseDown = 2
  286.     End Enum
  287.  
  288.     Protected MouseState As State
  289.     Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
  290.         ChangeMouseState(State.MouseNone)
  291.         MyBase.OnMouseLeave(e)
  292.     End Sub
  293.     Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
  294.         ChangeMouseState(State.MouseOver)
  295.         MyBase.OnMouseEnter(e)
  296.     End Sub
  297.     Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  298.         ChangeMouseState(State.MouseOver)
  299.         MyBase.OnMouseUp(e)
  300.     End Sub
  301.     Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  302.         If e.Button = MouseButtons.Left Then ChangeMouseState(State.MouseDown)
  303.         MyBase.OnMouseDown(e)
  304.     End Sub
  305.  
  306.     Private Sub ChangeMouseState(ByVal e As State)
  307.         MouseState = e
  308.         Invalidate()
  309.     End Sub
  310.  
  311. #End Region
  312.  
  313. #Region " Convienence "
  314.  
  315.     MustOverride Sub PaintHook()
  316.     Protected NotOverridable Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  317.         If Width = 0 OrElse Height = 0 Then Return
  318.         PaintHook()
  319.         e.Graphics.DrawImage(B, 0, 0)
  320.     End Sub
  321.  
  322.     Protected Overrides Sub OnSizeChanged(ByVal e As EventArgs)
  323.         If Not Width = 0 AndAlso Not Height = 0 Then
  324.             B = New Bitmap(Width, Height)
  325.             G = Graphics.FromImage(B)
  326.             Invalidate()
  327.         End If
  328.         MyBase.OnSizeChanged(e)
  329.     End Sub
  330.  
  331.     Private _NoRounding As Boolean
  332.     Property NoRounding() As Boolean
  333.         Get
  334.             Return _NoRounding
  335.         End Get
  336.         Set(ByVal v As Boolean)
  337.             _NoRounding = v
  338.             Invalidate()
  339.         End Set
  340.     End Property
  341.  
  342.     Private _Image As Image
  343.     Property Image() As Image
  344.         Get
  345.             Return _Image
  346.         End Get
  347.         Set(ByVal value As Image)
  348.             _Image = value
  349.             Invalidate()
  350.         End Set
  351.     End Property
  352.     ReadOnly Property ImageWidth() As Integer
  353.         Get
  354.             If _Image Is Nothing Then Return 0
  355.             Return _Image.Width
  356.         End Get
  357.     End Property
  358.     ReadOnly Property ImageTop() As Integer
  359.         Get
  360.             If _Image Is Nothing Then Return 0
  361.             Return Height \ 2 - _Image.Height \ 2
  362.         End Get
  363.     End Property
  364.  
  365.     Private _Size As Size
  366.     Private _Rectangle As Rectangle
  367.     Private _Gradient As LinearGradientBrush
  368.     Private _Brush As SolidBrush
  369.  
  370.     Protected Sub DrawCorners(ByVal c As Color, ByVal rect As Rectangle)
  371.         If _NoRounding Then Return
  372.  
  373.         B.SetPixel(rect.X, rect.Y, c)
  374.         B.SetPixel(rect.X + (rect.Width - 1), rect.Y, c)
  375.         B.SetPixel(rect.X, rect.Y + (rect.Height - 1), c)
  376.         B.SetPixel(rect.X + (rect.Width - 1), rect.Y + (rect.Height - 1), c)
  377.     End Sub
  378.  
  379.     Protected Sub DrawBorders(ByVal p1 As Pen, ByVal p2 As Pen, ByVal rect As Rectangle)
  380.         G.DrawRectangle(p1, rect.X, rect.Y, rect.Width - 1, rect.Height - 1)
  381.         G.DrawRectangle(p2, rect.X + 1, rect.Y + 1, rect.Width - 3, rect.Height - 3)
  382.     End Sub
  383.  
  384.     Protected Sub DrawText(ByVal a As HorizontalAlignment, ByVal c As Color, ByVal x As Integer)
  385.         DrawText(a, c, x, 0)
  386.     End Sub
  387.     Protected Sub DrawText(ByVal a As HorizontalAlignment, ByVal c As Color, ByVal x As Integer, ByVal y As Integer)
  388.         If String.IsNullOrEmpty(Text) Then Return
  389.         _Size = G.MeasureString(Text, Font).ToSize
  390.         _Brush = New SolidBrush(c)
  391.  
  392.         Select Case a
  393.             Case HorizontalAlignment.Left
  394.                 G.DrawString(Text, Font, _Brush, x, Height \ 2 - _Size.Height \ 2 + y)
  395.             Case HorizontalAlignment.Right
  396.                 G.DrawString(Text, Font, _Brush, Width - _Size.Width - x, Height \ 2 - _Size.Height \ 2 + y)
  397.             Case HorizontalAlignment.Center
  398.                 G.DrawString(Text, Font, _Brush, Width \ 2 - _Size.Width \ 2 + x, Height \ 2 - _Size.Height \ 2 + y)
  399.         End Select
  400.     End Sub
  401.  
  402.     Protected Sub DrawIcon(ByVal a As HorizontalAlignment, ByVal x As Integer)
  403.         DrawIcon(a, x, 0)
  404.     End Sub
  405.     Protected Sub DrawIcon(ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
  406.         If _Image Is Nothing Then Return
  407.         Select Case a
  408.             Case HorizontalAlignment.Left
  409.                 G.DrawImage(_Image, x, Height \ 2 - _Image.Height \ 2 + y)
  410.             Case HorizontalAlignment.Right
  411.                 G.DrawImage(_Image, Width - _Image.Width - x, Height \ 2 - _Image.Height \ 2 + y)
  412.             Case HorizontalAlignment.Center
  413.                 G.DrawImage(_Image, Width \ 2 - _Image.Width \ 2, Height \ 2 - _Image.Height \ 2)
  414.         End Select
  415.     End Sub
  416.  
  417.     Protected Sub DrawGradient(ByVal c1 As Color, ByVal c2 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal angle As Single)
  418.         _Rectangle = New Rectangle(x, y, width, height)
  419.         _Gradient = New LinearGradientBrush(_Rectangle, c1, c2, angle)
  420.         G.FillRectangle(_Gradient, _Rectangle)
  421.     End Sub
  422. #End Region
  423.  
  424. End Class
  425. MustInherit Class ThemeContainerControl
  426.     Inherits ContainerControl
  427.  
  428. #Region " Initialization "
  429.  
  430.     Protected G As Graphics, B As Bitmap
  431.     Sub New()
  432.         SetStyle(DirectCast(139270, ControlStyles), True)
  433.         B = New Bitmap(1, 1)
  434.         G = Graphics.FromImage(B)
  435.     End Sub
  436.  
  437.     Sub AllowTransparent()
  438.         SetStyle(ControlStyles.Opaque, False)
  439.         SetStyle(ControlStyles.SupportsTransparentBackColor, True)
  440.     End Sub
  441.  
  442. #End Region
  443. #Region " Convienence "
  444.  
  445.     MustOverride Sub PaintHook()
  446.     Protected NotOverridable Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  447.         If Width = 0 OrElse Height = 0 Then Return
  448.         PaintHook()
  449.         e.Graphics.DrawImage(B, 0, 0)
  450.     End Sub
  451.  
  452.     Protected Overrides Sub OnSizeChanged(ByVal e As EventArgs)
  453.         If Not Width = 0 AndAlso Not Height = 0 Then
  454.             B = New Bitmap(Width, Height)
  455.             G = Graphics.FromImage(B)
  456.             Invalidate()
  457.         End If
  458.         MyBase.OnSizeChanged(e)
  459.     End Sub
  460.  
  461.     Private _NoRounding As Boolean
  462.     Property NoRounding() As Boolean
  463.         Get
  464.             Return _NoRounding
  465.         End Get
  466.         Set(ByVal v As Boolean)
  467.             _NoRounding = v
  468.             Invalidate()
  469.         End Set
  470.     End Property
  471.  
  472.     Private _Rectangle As Rectangle
  473.     Private _Gradient As LinearGradientBrush
  474.  
  475.     Protected Sub DrawCorners(ByVal c As Color, ByVal rect As Rectangle)
  476.         If _NoRounding Then Return
  477.         B.SetPixel(rect.X, rect.Y, c)
  478.         B.SetPixel(rect.X + (rect.Width - 1), rect.Y, c)
  479.         B.SetPixel(rect.X, rect.Y + (rect.Height - 1), c)
  480.         B.SetPixel(rect.X + (rect.Width - 1), rect.Y + (rect.Height - 1), c)
  481.     End Sub
  482.  
  483.     Protected Sub DrawBorders(ByVal p1 As Pen, ByVal p2 As Pen, ByVal rect As Rectangle)
  484.         G.DrawRectangle(p1, rect.X, rect.Y, rect.Width - 1, rect.Height - 1)
  485.         G.DrawRectangle(p2, rect.X + 1, rect.Y + 1, rect.Width - 3, rect.Height - 3)
  486.     End Sub
  487.  
  488.     Protected Sub DrawGradient(ByVal c1 As Color, ByVal c2 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal angle As Single)
  489.         _Rectangle = New Rectangle(x, y, width, height)
  490.         _Gradient = New LinearGradientBrush(_Rectangle, c1, c2, angle)
  491.         G.FillRectangle(_Gradient, _Rectangle)
  492.     End Sub
  493. #End Region
  494.  
  495. End Class
  496.  
  497. Class TxtBox
  498.     Inherits ThemeControl
  499.     Dim WithEvents txtbox As New TextBox
  500. #Region "lol"
  501.     Private _passmask As Boolean = False
  502.     Public Shadows Property UseSystemPasswordChar() As Boolean
  503.         Get
  504.             Return _passmask
  505.         End Get
  506.         Set(ByVal v As Boolean)
  507.             txtbox.UseSystemPasswordChar = UseSystemPasswordChar
  508.             _passmask = v
  509.             Invalidate()
  510.         End Set
  511.     End Property
  512.     Private _maxchars As Integer = 32767
  513.     Public Shadows Property MaxLength() As Integer
  514.         Get
  515.             Return _maxchars
  516.         End Get
  517.         Set(ByVal v As Integer)
  518.             _maxchars = v
  519.             txtbox.MaxLength = MaxLength
  520.             Invalidate()
  521.         End Set
  522.     End Property
  523.     Private _align As HorizontalAlignment
  524.     Public Shadows Property TextAlignment() As HorizontalAlignment
  525.         Get
  526.             Return _align
  527.         End Get
  528.         Set(ByVal v As HorizontalAlignment)
  529.             _align = v
  530.             Invalidate()
  531.         End Set
  532.     End Property
  533.  
  534.     Protected Overrides Sub OnPaintBackground(ByVal pevent As System.Windows.Forms.PaintEventArgs)
  535.     End Sub
  536.     Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
  537.         MyBase.OnTextChanged(e)
  538.         Invalidate()
  539.     End Sub
  540.     Protected Overrides Sub OnBackColorChanged(ByVal e As System.EventArgs)
  541.         MyBase.OnBackColorChanged(e)
  542.         txtbox.BackColor = BackColor
  543.         Invalidate()
  544.     End Sub
  545.     Protected Overrides Sub OnForeColorChanged(ByVal e As System.EventArgs)
  546.         MyBase.OnForeColorChanged(e)
  547.         txtbox.ForeColor = ForeColor
  548.         Invalidate()
  549.     End Sub
  550.     Protected Overrides Sub OnFontChanged(ByVal e As System.EventArgs)
  551.         MyBase.OnFontChanged(e)
  552.         txtbox.Font = Font
  553.     End Sub
  554.     Protected Overrides Sub OnGotFocus(ByVal e As System.EventArgs)
  555.         MyBase.OnGotFocus(e)
  556.         txtbox.Focus()
  557.     End Sub
  558.     Sub TextChngTxtBox() Handles txtbox.TextChanged
  559.         Text = txtbox.Text
  560.     End Sub
  561.     Sub TextChng() Handles MyBase.TextChanged
  562.         txtbox.Text = Text
  563.     End Sub
  564.  
  565. #End Region
  566.  
  567.     Protected Overrides Sub WndProc(ByRef m As Message)
  568.         Select Case m.Msg
  569.             Case 15
  570.                 Invalidate()
  571.                 MyBase.WndProc(m)
  572.                 Me.PaintHook()
  573.                 Exit Select
  574.             Case Else
  575.                 MyBase.WndProc(m)
  576.                 Exit Select
  577.         End Select
  578.     End Sub
  579.  
  580.     Sub New()
  581.         MyBase.New()
  582.  
  583.         Controls.Add(txtbox)
  584.         With txtbox
  585.             .Multiline = False
  586.             .BackColor = Color.FromArgb(0, 0, 0)
  587.             .ForeColor = ForeColor
  588.             .Text = String.Empty
  589.             .TextAlign = HorizontalAlignment.Center
  590.             .BorderStyle = BorderStyle.None
  591.             .Location = New Point(5, 8)
  592.             .Font = New Font("Arial", 8.25F, FontStyle.Bold)
  593.             .Size = New Size(Width - 8, Height - 11)
  594.             .UseSystemPasswordChar = UseSystemPasswordChar
  595.         End With
  596.  
  597.         Text = ""
  598.  
  599.         DoubleBuffered = True
  600.     End Sub
  601.  
  602.     Overrides Sub PaintHook()
  603.         Me.BackColor = Color.White
  604.         G.Clear(Parent.BackColor)
  605.         Dim p As New Pen(Color.FromArgb(204, 204, 204), 1)
  606.         Dim o As New Pen(Color.FromArgb(252, 252, 252), 7)
  607.         G.FillPath(Brushes.White, Draw.RoundRect(New Rectangle(0, 0, Width - 1, Height - 1), 2))
  608.         G.DrawPath(o, Draw.RoundRect(New Rectangle(0, 0, Width - 1, Height - 1), 2))
  609.         G.DrawPath(p, Draw.RoundRect(New Rectangle(0, 0, Width - 1, Height - 1), 2))
  610.         Height = txtbox.Height + 16
  611.         Dim drawFont As New Font("Tahoma", 9, FontStyle.Regular)
  612.         With txtbox
  613.             .Width = Width - 12
  614.             .ForeColor = Color.FromArgb(72, 72, 72)
  615.             .Font = drawFont
  616.             .TextAlign = TextAlignment
  617.             .UseSystemPasswordChar = UseSystemPasswordChar
  618.         End With
  619.         DrawCorners(Parent.BackColor, ClientRectangle)
  620.     End Sub
  621. End Class
  622. Class MultiTxtBox
  623.     Inherits ThemeControl
  624.     Dim WithEvents txtbox As New TextBox
  625. #Region "lol"
  626.     Private _passmask As Boolean = False
  627.     Public Shadows Property UseSystemPasswordChar() As Boolean
  628.         Get
  629.             Return _passmask
  630.         End Get
  631.         Set(ByVal v As Boolean)
  632.             txtbox.UseSystemPasswordChar = UseSystemPasswordChar
  633.             _passmask = v
  634.             Invalidate()
  635.         End Set
  636.     End Property
  637.     Private _maxchars As Integer = 32767
  638.     Public Shadows Property MaxLength() As Integer
  639.         Get
  640.             Return _maxchars
  641.         End Get
  642.         Set(ByVal v As Integer)
  643.             _maxchars = v
  644.             txtbox.MaxLength = MaxLength
  645.             Invalidate()
  646.         End Set
  647.     End Property
  648.     Private _align As HorizontalAlignment
  649.     Public Shadows Property TextAlignment() As HorizontalAlignment
  650.         Get
  651.             Return _align
  652.         End Get
  653.         Set(ByVal v As HorizontalAlignment)
  654.             _align = v
  655.             Invalidate()
  656.         End Set
  657.     End Property
  658.  
  659.     Protected Overrides Sub OnPaintBackground(ByVal pevent As System.Windows.Forms.PaintEventArgs)
  660.     End Sub
  661.     Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
  662.         MyBase.OnTextChanged(e)
  663.         Invalidate()
  664.     End Sub
  665.     Protected Overrides Sub OnBackColorChanged(ByVal e As System.EventArgs)
  666.         MyBase.OnBackColorChanged(e)
  667.         txtbox.BackColor = BackColor
  668.         Invalidate()
  669.     End Sub
  670.     Protected Overrides Sub OnForeColorChanged(ByVal e As System.EventArgs)
  671.         MyBase.OnForeColorChanged(e)
  672.         txtbox.ForeColor = ForeColor
  673.         Invalidate()
  674.     End Sub
  675.     Protected Overrides Sub OnFontChanged(ByVal e As System.EventArgs)
  676.         MyBase.OnFontChanged(e)
  677.         txtbox.Font = Font
  678.     End Sub
  679.     Protected Overrides Sub OnGotFocus(ByVal e As System.EventArgs)
  680.         MyBase.OnGotFocus(e)
  681.         txtbox.Focus()
  682.     End Sub
  683.     Sub TextChngTxtBox() Handles TxtBox.TextChanged
  684.         Text = txtbox.Text
  685.     End Sub
  686.     Sub TextChng() Handles MyBase.TextChanged
  687.         txtbox.Text = Text
  688.     End Sub
  689.  
  690. #End Region
  691.  
  692.     Protected Overrides Sub WndProc(ByRef m As Message)
  693.         Select Case m.Msg
  694.             Case 15
  695.                 Invalidate()
  696.                 MyBase.WndProc(m)
  697.                 Me.PaintHook()
  698.                 Exit Select
  699.             Case Else
  700.                 MyBase.WndProc(m)
  701.                 Exit Select
  702.         End Select
  703.     End Sub
  704.  
  705.     Sub New()
  706.         MyBase.New()
  707.  
  708.         Controls.Add(txtbox)
  709.         With txtbox
  710.             .ScrollBars = ScrollBars.Vertical
  711.             .Multiline = True
  712.             .BackColor = Color.FromArgb(0, 0, 0)
  713.             .ForeColor = ForeColor
  714.             .Text = String.Empty
  715.             .TextAlign = HorizontalAlignment.Center
  716.             .BorderStyle = BorderStyle.None
  717.             .Location = New Point(5, 8)
  718.             .Font = New Font("Arial", 8.25F, FontStyle.Bold)
  719.             .Size = New Size(Width - 8, Height - 11)
  720.             .UseSystemPasswordChar = UseSystemPasswordChar
  721.         End With
  722.  
  723.         Text = ""
  724.  
  725.         DoubleBuffered = True
  726.     End Sub
  727.  
  728.     Overrides Sub PaintHook()
  729.         Me.BackColor = Color.White
  730.         G.Clear(Parent.BackColor)
  731.         Dim p As New Pen(Color.FromArgb(204, 204, 204), 1)
  732.         Dim o As New Pen(Color.FromArgb(252, 252, 252), 7)
  733.         G.FillPath(Brushes.White, Draw.RoundRect(New Rectangle(0, 0, Width - 1, Height - 1), 2))
  734.         G.DrawPath(o, Draw.RoundRect(New Rectangle(0, 0, Width - 1, Height - 1), 2))
  735.         G.DrawPath(p, Draw.RoundRect(New Rectangle(0, 0, Width - 1, Height - 1), 2))
  736.         Dim drawFont As New Font("Tahoma", 9, FontStyle.Regular)
  737.         With txtbox
  738.             .Size = New Size(Width - 10, Height - 14)
  739.             .ForeColor = Color.FromArgb(72, 72, 72)
  740.             .Font = drawFont
  741.             .TextAlign = TextAlignment
  742.             .UseSystemPasswordChar = UseSystemPasswordChar
  743.         End With
  744.         DrawCorners(Parent.BackColor, ClientRectangle)
  745.     End Sub
  746. End Class
  747.  
  748. Class PanelBox
  749.     Inherits ThemeContainerControl
  750.     Private _Checked As Boolean
  751.     Sub New()
  752.         AllowTransparent()
  753.     End Sub
  754.     Overrides Sub PaintHook()
  755.         Me.Font = New Font("Tahoma", 10)
  756.         Me.ForeColor = Color.FromArgb(40, 40, 40)
  757.         G.SmoothingMode = SmoothingMode.AntiAlias
  758.         G.FillRectangle(New SolidBrush(Color.FromArgb(235, 235, 235)), New Rectangle(2, 0, Width, Height))
  759.         G.FillRectangle(New SolidBrush(Color.FromArgb(249, 249, 249)), New Rectangle(1, 0, Width - 3, Height - 4))
  760.         G.DrawRectangle(New Pen(Color.FromArgb(214, 214, 214)), 0, 0, Width - 2, Height - 3)
  761.     End Sub
  762. End Class
  763. Class GroupDropBox
  764.     Inherits ThemeContainerControl
  765.     Private _Checked As Boolean
  766.     Private X As Integer
  767.     Private y As Integer
  768.     Private _OpenedSize As Size
  769.  
  770.     Public Property Checked As Boolean
  771.         Get
  772.             Return _Checked
  773.         End Get
  774.         Set(ByVal V As Boolean)
  775.             _Checked = V
  776.             Invalidate()
  777.         End Set
  778.     End Property
  779.     Public Property OpenSize As Size
  780.         Get
  781.             Return _OpenedSize
  782.         End Get
  783.         Set(ByVal V As Size)
  784.             _OpenedSize = V
  785.             Invalidate()
  786.         End Set
  787.     End Property
  788.     Sub New()
  789.         AllowTransparent()
  790.         Size = New Size(90, 30)
  791.         MinimumSize = New Size(5, 30)
  792.         _Checked = True
  793.     End Sub
  794.     Overrides Sub PaintHook()
  795.         Me.Font = New Font("Tahoma", 10)
  796.         Me.ForeColor = Color.FromArgb(40, 40, 40)
  797.         If _Checked = True Then
  798.             G.SmoothingMode = SmoothingMode.AntiAlias
  799.             G.Clear(Color.FromArgb(245, 245, 245))
  800.             G.FillRectangle(New SolidBrush(Color.FromArgb(231, 231, 231)), New Rectangle(0, 0, Width, 30))
  801.             G.DrawLine(New Pen(Color.FromArgb(237, 237, 237)), 1, 1, Width - 2, 1)
  802.             G.DrawRectangle(New Pen(Color.FromArgb(214, 214, 214)), 0, 0, Width - 1, Height - 1)
  803.             G.DrawRectangle(New Pen(Color.FromArgb(214, 214, 214)), 0, 0, Width - 1, 30)
  804.             Me.Size = _OpenedSize
  805.             G.DrawString("t", New Font("Marlett", 12), New SolidBrush(Me.ForeColor), Width - 25, 5)
  806.         Else
  807.             G.SmoothingMode = SmoothingMode.AntiAlias
  808.             G.Clear(Color.FromArgb(245, 245, 245))
  809.             G.FillRectangle(New SolidBrush(Color.FromArgb(231, 231, 231)), New Rectangle(0, 0, Width, 30))
  810.             G.DrawLine(New Pen(Color.FromArgb(237, 237, 237)), 1, 1, Width - 2, 1)
  811.             G.DrawRectangle(New Pen(Color.FromArgb(214, 214, 214)), 0, 0, Width - 1, Height - 1)
  812.             G.DrawRectangle(New Pen(Color.FromArgb(214, 214, 214)), 0, 0, Width - 1, 30)
  813.             Me.Size = New Size(Width, 30)
  814.             G.DrawString("u", New Font("Marlett", 12), New SolidBrush(Me.ForeColor), Width - 25, 5)
  815.         End If
  816.         G.DrawString(Text, Font, New SolidBrush(Me.ForeColor), 7, 6)
  817.     End Sub
  818.  
  819.     Private Sub meResize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
  820.         If _Checked = True Then
  821.             _OpenedSize = Me.Size
  822.         Else
  823.         End If
  824.     End Sub
  825.  
  826.  
  827.     Protected Overrides Sub OnMouseMove(ByVal e As System.Windows.Forms.MouseEventArgs)
  828.         MyBase.OnMouseMove(e)
  829.         X = e.X
  830.         y = e.Y
  831.         Invalidate()
  832.     End Sub
  833.  
  834.     Sub changeCheck() Handles Me.MouseDown
  835.  
  836.  
  837.         If X >= Width - 22 Then
  838.             If y <= 30 Then
  839.                 Select Case Checked
  840.                     Case True
  841.                         Checked = False
  842.                     Case False
  843.                         Checked = True
  844.                 End Select
  845.             End If
  846.         End If
  847.     End Sub
  848. End Class
  849. Class GroupPanelBox
  850.     Inherits ThemeContainerControl
  851.     Private _Checked As Boolean
  852.     Sub New()
  853.         AllowTransparent()
  854.     End Sub
  855.     Overrides Sub PaintHook()
  856.         Me.Font = New Font("Tahoma", 10)
  857.         Me.ForeColor = Color.FromArgb(40, 40, 40)
  858.         G.SmoothingMode = SmoothingMode.AntiAlias
  859.         G.Clear(Color.FromArgb(245, 245, 245))
  860.         G.FillRectangle(New SolidBrush(Color.FromArgb(231, 231, 231)), New Rectangle(0, 0, Width, 30))
  861.         G.DrawLine(New Pen(Color.FromArgb(233, 238, 240)), 1, 1, Width - 2, 1)
  862.         G.DrawRectangle(New Pen(Color.FromArgb(214, 214, 214)), 0, 0, Width - 1, Height - 1)
  863.         G.DrawRectangle(New Pen(Color.FromArgb(214, 214, 214)), 0, 0, Width - 1, 30)
  864.         G.DrawString(Text, Font, New SolidBrush(Me.ForeColor), 7, 6)
  865.     End Sub
  866. End Class
  867.  
  868. Class ButtonGreen
  869.     Inherits ThemeControl
  870.     Overrides Sub PaintHook()
  871.         Me.Font = New Font("Arial", 10)
  872.         G.Clear(Me.BackColor)
  873.         G.SmoothingMode = SmoothingMode.HighQuality
  874.         Select Case MouseState
  875.             Case State.MouseNone
  876.                 Dim p As New Pen(Color.FromArgb(120, 159, 22), 1)
  877.                 Dim x As New LinearGradientBrush(ClientRectangle, Color.FromArgb(157, 209, 57), Color.FromArgb(130, 181, 18), LinearGradientMode.Vertical)
  878.                 G.FillPath(x, Draw.RoundRect(ClientRectangle, 4))
  879.                 G.DrawPath(p, Draw.RoundRect(New Rectangle(0, 0, Width - 1, Height - 1), 3))
  880.                 G.DrawLine(New Pen(Color.FromArgb(190, 232, 109)), 2, 1, Width - 3, 1)
  881.                 DrawText(HorizontalAlignment.Center, Color.FromArgb(240, 240, 240), 0)
  882.             Case State.MouseDown
  883.                 Dim p As New Pen(Color.FromArgb(120, 159, 22), 1)
  884.                 Dim x As New LinearGradientBrush(ClientRectangle, Color.FromArgb(125, 171, 25), Color.FromArgb(142, 192, 40), LinearGradientMode.Vertical)
  885.                 G.FillPath(x, Draw.RoundRect(ClientRectangle, 4))
  886.                 G.DrawPath(p, Draw.RoundRect(New Rectangle(0, 0, Width - 1, Height - 1), 3))
  887.                 G.DrawLine(New Pen(Color.FromArgb(142, 172, 30)), 2, 1, Width - 3, 1)
  888.                 DrawText(HorizontalAlignment.Center, Color.FromArgb(250, 250, 250), 1)
  889.             Case State.MouseOver
  890.                 Dim p As New Pen(Color.FromArgb(120, 159, 22), 1)
  891.                 Dim x As New LinearGradientBrush(ClientRectangle, Color.FromArgb(165, 220, 59), Color.FromArgb(137, 191, 18), LinearGradientMode.Vertical)
  892.                 G.FillPath(x, Draw.RoundRect(ClientRectangle, 4))
  893.                 G.DrawPath(p, Draw.RoundRect(New Rectangle(0, 0, Width - 1, Height - 1), 3))
  894.                 G.DrawLine(New Pen(Color.FromArgb(190, 232, 109)), 2, 1, Width - 3, 1)
  895.                 DrawText(HorizontalAlignment.Center, Color.FromArgb(240, 240, 240), -1)
  896.         End Select
  897.         Me.Cursor = Cursors.Hand
  898.     End Sub
  899. End Class
  900. Class ButtonBlue
  901.     Inherits ThemeControl
  902.     Overrides Sub PaintHook()
  903.         Me.Font = New Font("Arial", 10)
  904.         G.Clear(Me.BackColor)
  905.         G.SmoothingMode = SmoothingMode.HighQuality
  906.         Select Case MouseState
  907.             Case State.MouseNone
  908.                 Dim p As New Pen(Color.FromArgb(34, 112, 171), 1)
  909.                 Dim x As New LinearGradientBrush(ClientRectangle, Color.FromArgb(51, 159, 231), Color.FromArgb(33, 128, 206), LinearGradientMode.Vertical)
  910.                 G.FillPath(x, Draw.RoundRect(ClientRectangle, 4))
  911.                 G.DrawPath(p, Draw.RoundRect(New Rectangle(0, 0, Width - 1, Height - 1), 3))
  912.                 G.DrawLine(New Pen(Color.FromArgb(131, 197, 241)), 2, 1, Width - 3, 1)
  913.                 DrawText(HorizontalAlignment.Center, Color.FromArgb(240, 240, 240), 0)
  914.             Case State.MouseDown
  915.                 Dim p As New Pen(Color.FromArgb(34, 112, 171), 1)
  916.                 Dim x As New LinearGradientBrush(ClientRectangle, Color.FromArgb(37, 124, 196), Color.FromArgb(53, 153, 219), LinearGradientMode.Vertical)
  917.                 G.FillPath(x, Draw.RoundRect(ClientRectangle, 4))
  918.                 G.DrawPath(p, Draw.RoundRect(New Rectangle(0, 0, Width - 1, Height - 1), 3))
  919.  
  920.                 DrawText(HorizontalAlignment.Center, Color.FromArgb(250, 250, 250), 1)
  921.             Case State.MouseOver
  922.                 Dim p As New Pen(Color.FromArgb(34, 112, 171), 1)
  923.                 Dim x As New LinearGradientBrush(ClientRectangle, Color.FromArgb(54, 167, 243), Color.FromArgb(35, 165, 217), LinearGradientMode.Vertical)
  924.                 G.FillPath(x, Draw.RoundRect(ClientRectangle, 4))
  925.                 G.DrawPath(p, Draw.RoundRect(New Rectangle(0, 0, Width - 1, Height - 1), 3))
  926.                 G.DrawLine(New Pen(Color.FromArgb(131, 197, 241)), 2, 1, Width - 3, 1)
  927.                 DrawText(HorizontalAlignment.Center, Color.FromArgb(240, 240, 240), -1)
  928.         End Select
  929.         Me.Cursor = Cursors.Hand
  930.     End Sub
  931. End Class
  932.  
  933. Class StatusBar
  934.     Inherits ThemeControl
  935.     Sub New()
  936.         Me.Dock = DockStyle.Bottom
  937.         Me.Size = New Size(Width, 20)
  938.     End Sub
  939.     Overrides Sub PaintHook()
  940.         Me.Font = New Font("Arial", 10)
  941.         G.Clear(Me.BackColor)
  942.         G.SmoothingMode = SmoothingMode.HighQuality
  943.  
  944.         Select Case MouseState
  945.             Case State.MouseNone
  946.                 DrawGradient(Color.FromArgb(20, 82, 179), Color.FromArgb(58, 110, 195), 0, 0, Width, Height, 270S)
  947.                 G.DrawRectangle(New Pen(Color.FromArgb(12, 69, 180)), 0, 0, Width - 1, Height - 1)
  948.                 DrawText(HorizontalAlignment.Left, Color.FromArgb(240, 240, 240), +1)
  949.             Case State.MouseDown
  950.                 DrawGradient(Color.FromArgb(19, 75, 172), Color.FromArgb(70, 110, 198), 0, 0, Width, Height, 270S)
  951.                 G.DrawRectangle(New Pen(Color.FromArgb(12, 69, 180)), 0, 0, Width - 1, Height - 1)
  952.                 DrawText(HorizontalAlignment.Left, Color.FromArgb(232, 232, 232), +1)
  953.             Case State.MouseOver
  954.                 DrawGradient(Color.FromArgb(21, 79, 177), Color.FromArgb(76, 128, 218), 0, 0, Width, Height, 270S)
  955.                 G.DrawRectangle(New Pen(Color.FromArgb(12, 69, 180)), 0, 0, Width - 1, Height - 1)
  956.                 DrawText(HorizontalAlignment.Left, Color.FromArgb(250, 250, 250), +1)
  957.         End Select
  958.         G.DrawLine(New Pen(Color.FromArgb(50, 255, 255, 255)), 1, 1, Width - 3, 1)
  959.  
  960.     End Sub
  961. End Class
  962. Class ProgressBar
  963.     Inherits ThemeControl
  964.     Private _Maximum As Integer
  965.     Dim Gloss As Boolean
  966.     Dim Vertical As Boolean = True
  967.     Public Property VerticalAlignment As Boolean
  968.         Get
  969.             Return Vertical
  970.         End Get
  971.         Set(ByVal v As Boolean)
  972.             Vertical = v
  973.             Invalidate()
  974.         End Set
  975.     End Property
  976.     Public Property Glossy As Boolean
  977.         Get
  978.             Return Gloss
  979.         End Get
  980.         Set(ByVal v As Boolean)
  981.             Gloss = v
  982.             Invalidate()
  983.         End Set
  984.     End Property
  985.     Public Property Maximum() As Integer
  986.         Get
  987.             Return _Maximum
  988.         End Get
  989.         Set(ByVal v As Integer)
  990.             Select Case v
  991.                 Case Is < _Value
  992.                     _Value = v
  993.             End Select
  994.             _Maximum = v
  995.             Invalidate()
  996.         End Set
  997.     End Property
  998.     Private _Value As Integer
  999.     Public Property Value() As Integer
  1000.         Get
  1001.             Return _Value
  1002.         End Get
  1003.         Set(ByVal v As Integer)
  1004.             Select Case v
  1005.                 Case Is > _Maximum
  1006.                     v = _Maximum
  1007.             End Select
  1008.             _Value = v
  1009.             Invalidate()
  1010.         End Set
  1011.     End Property
  1012.     Overrides Sub PaintHook()
  1013.         G.SmoothingMode = SmoothingMode.HighQuality
  1014.         G.Clear(Color.Transparent)
  1015.         Dim s As Integer = 0
  1016.         Dim pe As New Pen(Color.FromArgb(34, 112, 171), 1)
  1017.         Dim xe As New LinearGradientBrush(ClientRectangle, Color.FromArgb(31, 119, 181), Color.FromArgb(33, 128, 206), LinearGradientMode.Vertical)
  1018.         G.FillPath(xe, Draw.RoundRect(ClientRectangle, 4))
  1019.         G.DrawPath(pe, Draw.RoundRect(New Rectangle(0, 0, Width - 1, Height - 1), 3))
  1020.         G.DrawLine(New Pen(Color.FromArgb(65, 131, 197, 241)), 2, 1, Width - 3, 1)
  1021.  
  1022.         'Fill
  1023.         If _Value > 1 Then
  1024.             If Vertical Then
  1025.                 s = (Height - CInt(_Value / _Maximum * Height))
  1026.                 If Glossy Then
  1027.  
  1028.                     Dim p As New Pen(Color.FromArgb(34, 112, 171), 1)
  1029.                     Dim x As New LinearGradientBrush(ClientRectangle, Color.FromArgb(51, 159, 231), Color.FromArgb(33, 128, 206), LinearGradientMode.Vertical)
  1030.                     G.FillPath(x, Draw.RoundRect(New Rectangle(2, s + 3, Width - 5, CInt(_Value / _Maximum * Height) - 6), 4))
  1031.                     DrawGradient(Color.FromArgb(50, Color.White), Color.Transparent, 4, s + 3, 10, CInt(_Value / _Maximum * Height) - 7, 270S)
  1032.                     G.DrawPath(p, Draw.RoundRect(New Rectangle(2, s + 3, Width - 5, CInt(_Value / _Maximum * Height) - 6), 3))
  1033.                     G.DrawLine(New Pen(Color.FromArgb(90, 131, 197, 241)), 4, s + 4, Width - 6, s + 4)
  1034.                 ElseIf Not Glossy Then
  1035.                     Dim p As New Pen(Color.FromArgb(34, 112, 171), 1)
  1036.                     Dim x As New LinearGradientBrush(ClientRectangle, Color.FromArgb(51, 159, 231), Color.FromArgb(33, 128, 206), LinearGradientMode.Vertical)
  1037.                     G.FillPath(x, Draw.RoundRect(New Rectangle(2, s + 3, Width - 5, CInt(_Value / _Maximum * Height) - 6), 4))
  1038.                     G.DrawPath(p, Draw.RoundRect(New Rectangle(2, s + 3, Width - 5, CInt(_Value / _Maximum * Height) - 6), 3))
  1039.                     G.DrawLine(New Pen(Color.FromArgb(90, 131, 197, 241)), 4, s + 4, Width - 6, s + 4)
  1040.  
  1041.                 End If
  1042.             ElseIf Not Vertical Then
  1043.                 s = (Height - CInt(_Value / _Maximum * Width))
  1044.                 If Glossy Then
  1045.  
  1046.                     Dim p As New Pen(Color.FromArgb(34, 112, 171), 1)
  1047.                     Dim x As New LinearGradientBrush(ClientRectangle, Color.FromArgb(51, 159, 231), Color.FromArgb(33, 128, 206), LinearGradientMode.Vertical)
  1048.                     G.FillPath(x, Draw.RoundRect(New Rectangle(2, 2, CInt(_Value / _Maximum * Width) - 6, Height - 5), 4))
  1049.                     G.DrawLine(New Pen(Color.FromArgb(90, 131, 197, 241)), 4, 3, CInt(_Value / _Maximum * Width) - 7, 3)
  1050.                     DrawGradient(Color.FromArgb(60, Color.White), Color.Transparent, 3, 3, CInt(_Value / _Maximum * Width) - 7, Height / 2 - 3, 0S)
  1051.                     G.DrawPath(p, Draw.RoundRect(New Rectangle(2, 2, CInt(_Value / _Maximum * Width) - 6, Height - 5), 3))
  1052.                 ElseIf Not Glossy Then
  1053.  
  1054.  
  1055.                     Dim p As New Pen(Color.FromArgb(34, 112, 171), 1)
  1056.                     Dim x As New LinearGradientBrush(ClientRectangle, Color.FromArgb(51, 159, 231), Color.FromArgb(33, 128, 206), LinearGradientMode.Vertical)
  1057.                     G.FillPath(x, Draw.RoundRect(New Rectangle(2, 2, CInt(_Value / _Maximum * Width) - 6, Height - 5), 4))
  1058.                     G.DrawLine(New Pen(Color.FromArgb(90, 131, 197, 241)), 4, 3, CInt(_Value / _Maximum * Width) - 7, 3)
  1059.                     G.DrawPath(p, Draw.RoundRect(New Rectangle(2, 2, CInt(_Value / _Maximum * Width) - 6, Height - 5), 3))
  1060.                 End If
  1061.             End If
  1062.         End If
  1063.  
  1064.         'Borders
  1065.  
  1066.     End Sub
  1067.     Public Sub Increment(ByVal Amount As Integer)
  1068.         If Me.Value + Amount > Maximum Then
  1069.             Me.Value = Maximum
  1070.         Else
  1071.             Me.Value += Amount
  1072.         End If
  1073.     End Sub
  1074.  
  1075.     Public Sub New()
  1076.         Me.Value = 0
  1077.         Me.Maximum = 100
  1078.         AllowTransparent()
  1079.     End Sub
  1080. End Class
  1081. Class DropDownComboBox
  1082.     Inherits ComboBox
  1083.     Private X As Integer
  1084.     Private Over As Boolean
  1085.  
  1086.     Sub New()
  1087.         MyBase.New()
  1088.         Font = New Font("Tahoma", 9, FontStyle.Regular)
  1089.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or ControlStyles.DoubleBuffer, True)
  1090.         DrawMode = Windows.Forms.DrawMode.OwnerDrawFixed
  1091.         ItemHeight = 25
  1092.         DropDownStyle = ComboBoxStyle.DropDownList
  1093.     End Sub
  1094.  
  1095.     Protected Overrides Sub OnMouseMove(ByVal e As System.Windows.Forms.MouseEventArgs)
  1096.         MyBase.OnMouseMove(e)
  1097.         X = e.Location.X
  1098.         Invalidate()
  1099.     End Sub
  1100.  
  1101.     Protected Overrides Sub OnMouseEnter(ByVal e As System.EventArgs)
  1102.         MyBase.OnMouseEnter(e)
  1103.         Over = True
  1104.         Invalidate()
  1105.     End Sub
  1106.  
  1107.     Protected Overrides Sub OnMouseLeave(ByVal e As System.EventArgs)
  1108.         MyBase.OnMouseEnter(e)
  1109.         Over = False
  1110.         Invalidate()
  1111.     End Sub
  1112.  
  1113.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  1114.         Me.Font = New Font("Tahoma", 9, FontStyle.Regular)
  1115.         Dim bs As New SolidBrush(Me.ForeColor)
  1116.         If Not DropDownStyle = ComboBoxStyle.DropDownList Then DropDownStyle = ComboBoxStyle.DropDownList
  1117.         Dim B As New Bitmap(Width, Height)
  1118.         Dim G As Graphics = Graphics.FromImage(B)
  1119.         Dim m As New Font("Marlett", 11)
  1120.         G.Clear(Color.FromArgb(50, 50, 50))
  1121.         Dim GradientBrush As LinearGradientBrush = New LinearGradientBrush(New Rectangle(0, 0, Width, Height), Color.FromArgb(234, 234, 234), Color.FromArgb(242, 242, 242), 270.0F)
  1122.         G.FillRectangle(GradientBrush, New Rectangle(0, 0, Width, Height))
  1123.  
  1124.  
  1125.         Dim op As New Pen(Color.FromArgb(204, 204, 204), 1)
  1126.         Dim o As New Pen(Color.FromArgb(237, 237, 237), 6)
  1127.  
  1128.         G.DrawPath(o, Draw.RoundRect(New Rectangle(0, 0, Width - 1, Height - 1), 2))
  1129.         G.DrawPath(op, Draw.RoundRect(New Rectangle(0, 0, Width - 1, Height - 1), 2))
  1130.  
  1131.         If X >= Width - 20 And Over Then
  1132.             GradientBrush = New LinearGradientBrush(New Rectangle(0, 0, Width, Height), Color.FromArgb(239, 239, 239), Color.FromArgb(236, 236, 236), 90.0F)
  1133.             G.FillRectangle(GradientBrush, New Rectangle(Width - 22, 2, 20, Height - 4))
  1134.         ElseIf X < Width - 20 And Over Then
  1135.             GradientBrush = New LinearGradientBrush(New Rectangle(0, 0, Width, Height), Color.FromArgb(239, 239, 239), Color.FromArgb(236, 236, 236), 90.0F)
  1136.             G.FillRectangle(GradientBrush, New Rectangle(2, 2, Width - 27, Height - 4))
  1137.         End If
  1138.  
  1139.         Dim S1 As Integer = G.MeasureString(" ... ", Font).Height
  1140.         If SelectedIndex <> -1 Then
  1141.             G.DrawString(Items(SelectedIndex), Font, bs, 4, (Height \ 2 - S1 \ 2))
  1142.             G.DrawString("6", m, bs, Width - 22, (Height \ 2 - S1 \ 2))
  1143.         Else
  1144.             If Not Items Is Nothing And Items.Count > 0 Then
  1145.                 G.DrawString(Items(0), Font, bs, 4, (Height \ 2 - S1 \ 2))
  1146.                 G.DrawString("6", m, bs, Width - 22, (Height \ 2 - S1 \ 2))
  1147.             Else
  1148.                 G.DrawString(" ... ", Font, bs, 4, (Height \ 2 - S1 \ 2))
  1149.                 G.DrawString("6", m, bs, Width - 22, (Height \ 2 - S1 \ 2))
  1150.             End If
  1151.         End If
  1152.         G.DrawLine(New Pen(Color.FromArgb(120, 255, 255, 255)), 1, 1, Width - 3, 1)
  1153.         e.Graphics.DrawImage(B.Clone, 0, 0)
  1154.  
  1155.         G.Dispose() : B.Dispose()
  1156.  
  1157.     End Sub
  1158.  
  1159.     Protected Overrides Sub OnDrawItem(ByVal e As DrawItemEventArgs)
  1160.         If e.Index < 0 Then Exit Sub
  1161.         Dim rect As New Rectangle()
  1162.         rect.X = e.Bounds.X
  1163.         rect.Y = e.Bounds.Y
  1164.         rect.Width = e.Bounds.Width - 1
  1165.         rect.Height = e.Bounds.Height - 1
  1166.  
  1167.         e.DrawBackground()
  1168.         If e.State = 785 Or e.State = 17 Then
  1169.             e.Graphics.FillRectangle(New SolidBrush(Color.FromArgb(235, 235, 235)), e.Bounds)
  1170.             e.Graphics.FillRectangle(New SolidBrush(Color.FromArgb(50, Me.ForeColor)), e.Bounds)
  1171.             e.Graphics.DrawString(Me.Items(e.Index).ToString(), e.Font, Brushes.Black, e.Bounds.X, e.Bounds.Y + 5)
  1172.         Else
  1173.             e.Graphics.FillRectangle(New SolidBrush(Color.White), e.Bounds)
  1174.             e.Graphics.DrawString(Me.Items(e.Index).ToString(), e.Font, Brushes.Black, e.Bounds.X, e.Bounds.Y + 4)
  1175.         End If
  1176.         MyBase.OnDrawItem(e)
  1177.     End Sub
  1178.  
  1179.     Private Sub GhostComboBox_DropDown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.DropDown
  1180.  
  1181.     End Sub
  1182.  
  1183.     Private Sub GhostComboBox_DropDownClosed(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.DropDownClosed
  1184.         DropDownStyle = ComboBoxStyle.Simple
  1185.         Application.DoEvents()
  1186.         DropDownStyle = ComboBoxStyle.DropDownList
  1187.     End Sub
  1188.  
  1189.     Private Sub GhostCombo_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.TextChanged
  1190.         Invalidate()
  1191.     End Sub
  1192. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement