Controller

[THEME][VB.NET] VibeLander Theme 2.0

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