THE_LORD

Modal Theme

Jan 15th, 2017
324
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 89.63 KB | None | 0 0
  1.  
  2. '' <summary>
  3. '' Modal Theme
  4. '' Author : THE LORD
  5. '' Release Date : Monday, January 16, 2017
  6. '' HF Account : https://hackforums.net/member.php?action=profile&uid=3304362
  7. '' PM Me for any bug.
  8. '' </summary>
  9.  
  10. #Region " Namespaces "
  11.  
  12. Imports System.Drawing.Drawing2D
  13. Imports System.ComponentModel
  14.  
  15. #End Region
  16.  
  17. #Region " Helper Methods "
  18.  
  19. Public Module HelperMethods
  20.  
  21.     Public GP As GraphicsPath
  22.  
  23.     Public Enum MouseMode As Byte
  24.         NormalMode
  25.         Hovered
  26.         Pushed
  27.     End Enum
  28.  
  29.     Public Sub DrawImageFromBase64(ByVal G As Graphics, ByVal Base64Image As String, ByVal Rect As Rectangle)
  30.         Dim IM As Image = Nothing
  31.         With G
  32.             Using ms As New System.IO.MemoryStream(Convert.FromBase64String(Base64Image))
  33.                 IM = Image.FromStream(ms) : ms.Close()
  34.             End Using
  35.             .DrawImage(IM, Rect)
  36.         End With
  37.     End Sub
  38.  
  39.     Public Sub FillRoundedPath(ByVal G As Graphics, ByVal C As Color, ByVal Rect As Rectangle, ByVal Curve As Integer, _
  40.                                  Optional ByVal TopLeft As Boolean = True, Optional ByVal TopRight As Boolean = True, _
  41.                                  Optional ByVal BottomLeft As Boolean = True, Optional ByVal BottomRight As Boolean = True)
  42.         With G
  43.             .FillPath(New SolidBrush(C), RoundRec(Rect, Curve, TopLeft, TopRight, BottomLeft, BottomRight))
  44.         End With
  45.     End Sub
  46.  
  47.     Public Sub FillRoundedPath(ByVal G As Graphics, ByVal B As Brush, ByVal Rect As Rectangle, ByVal Curve As Integer, _
  48.                                  Optional ByVal TopLeft As Boolean = True, Optional ByVal TopRight As Boolean = True, _
  49.                                  Optional ByVal BottomLeft As Boolean = True, Optional ByVal BottomRight As Boolean = True)
  50.         With G
  51.             .FillPath(B, RoundRec(Rect, Curve, TopLeft, TopRight, BottomLeft, BottomRight))
  52.         End With
  53.     End Sub
  54.  
  55.     Public Sub DrawRoundedPath(ByVal G As Graphics, ByVal C As Color, ByVal Size As Single, ByVal Rect As Rectangle, ByVal Curve As Integer, _
  56.                                  Optional ByVal TopLeft As Boolean = True, Optional ByVal TopRight As Boolean = True, _
  57.                                  Optional ByVal BottomLeft As Boolean = True, Optional ByVal BottomRight As Boolean = True)
  58.         With G
  59.             .DrawPath(New Pen(C, Size), RoundRec(Rect, Curve, TopLeft, TopRight, BottomLeft, BottomRight))
  60.         End With
  61.     End Sub
  62.  
  63.     Public Function Triangle(ByVal Clr As Color, ByVal P1 As Point, ByVal P2 As Point, ByVal P3 As Point) As Point()
  64.         Return New Point() {P1, P2, P3}
  65.     End Function
  66.  
  67.     Public Function PenRGBColor(ByVal GR As Graphics, ByVal R As Integer, ByVal G As Integer, ByVal B As Integer, ByVal Size As Single) As Pen
  68.         Return New Pen(Color.FromArgb(R, G, B), Size)
  69.     End Function
  70.  
  71.     Public Function PenHTMlColor(ByVal C_WithoutHash As String, ByVal Size As Single) As Pen
  72.         Return New Pen(GetHTMLColor(C_WithoutHash), Size)
  73.     End Function
  74.  
  75.     Public Function SolidBrushRGBColor(ByVal R As Integer, ByVal G As Integer, ByVal B As Integer, Optional ByVal A As Integer = 0) As SolidBrush
  76.         Return New SolidBrush(Color.FromArgb(A, R, G, B))
  77.     End Function
  78.  
  79.     Public Function SolidBrushHTMlColor(ByVal C_WithoutHash As String) As SolidBrush
  80.         Return New SolidBrush(GetHTMLColor(C_WithoutHash))
  81.     End Function
  82.  
  83.     Public Function GetHTMLColor(ByVal C_WithoutHash As String) As Color
  84.         Return ColorTranslator.FromHtml("#" & C_WithoutHash)
  85.     End Function
  86.  
  87.     Public Function ColorToHTML(ByVal C As Color) As String
  88.         Return ColorTranslator.ToHtml(C)
  89.     End Function
  90.  
  91.     Public Sub CentreString(ByVal G As Graphics, ByVal Text As String, ByVal font As Font, ByVal brush As Brush, ByVal Rect As Rectangle)
  92.         G.DrawString(Text, font, brush, New Rectangle(Rect.X, Rect.Y, Rect.Width, Rect.Height), New StringFormat With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  93.     End Sub
  94.     Public Sub LeftString(ByVal G As Graphics, ByVal Text As String, ByVal font As Font, ByVal brush As Brush, ByVal Rect As Rectangle)
  95.         G.DrawString(Text, font, brush, New Rectangle(4, Rect.Y + (Rect.Height / 2) - (G.MeasureString(Text, font).Height / 2) + 0, Rect.Width, Rect.Height), New StringFormat With {.Alignment = StringAlignment.Near})
  96.     End Sub
  97.  
  98.     Public Sub RightString(ByVal G As Graphics, ByVal Text As String, ByVal font As Font, ByVal brush As Brush, ByVal Rect As Rectangle)
  99.         G.DrawString(Text, font, brush, New Rectangle(4, Rect.Y + (Rect.Height / 2) - (G.MeasureString(Text, font).Height / 2), Rect.Width - Rect.Height + 10, Rect.Height), New StringFormat With {.Alignment = StringAlignment.Far})
  100.     End Sub
  101.  
  102.  
  103. #Region " Round Border "
  104.  
  105.     ''' <summary>
  106.     ''' Credits : AeonHack
  107.     ''' </summary>
  108.  
  109.     Public Function RoundRec(ByVal r As Rectangle, ByVal Curve As Integer, _
  110.                                  Optional ByVal TopLeft As Boolean = True, Optional ByVal TopRight As Boolean = True, _
  111.                                  Optional ByVal BottomLeft As Boolean = True, Optional ByVal BottomRight As Boolean = True) As GraphicsPath
  112.         Dim CreateRoundPath As New GraphicsPath(FillMode.Winding)
  113.         If TopLeft Then
  114.             CreateRoundPath.AddArc(r.X, r.Y, Curve, Curve, 180.0F, 90.0F)
  115.         Else
  116.             CreateRoundPath.AddLine(r.X, r.Y, r.X, r.Y)
  117.         End If
  118.         If TopRight Then
  119.             CreateRoundPath.AddArc(r.Right - Curve, r.Y, Curve, Curve, 270.0F, 90.0F)
  120.         Else
  121.             CreateRoundPath.AddLine(r.Right - r.Width, r.Y, r.Width, r.Y)
  122.         End If
  123.         If BottomRight Then
  124.             CreateRoundPath.AddArc(r.Right - Curve, r.Bottom - Curve, Curve, Curve, 0.0F, 90.0F)
  125.         Else
  126.             CreateRoundPath.AddLine(r.Right, r.Bottom, r.Right, r.Bottom)
  127.  
  128.         End If
  129.         If BottomLeft Then
  130.             CreateRoundPath.AddArc(r.X, r.Bottom - Curve, Curve, Curve, 90.0F, 90.0F)
  131.         Else
  132.             CreateRoundPath.AddLine(r.X, r.Bottom, r.X, r.Bottom)
  133.         End If
  134.         CreateRoundPath.CloseFigure()
  135.         Return CreateRoundPath
  136.     End Function
  137.  
  138. #End Region
  139.  
  140.  
  141.  
  142. End Module
  143.  
  144. #End Region
  145.  
  146. #Region " Skin "
  147.  
  148. Public Class ModalTheme : Inherits ContainerControl
  149.  
  150. #Region " Variables "
  151.  
  152.     Private Movable As Boolean = False
  153.     Private MousePoint As New Point(0, 0)
  154.     Private MoveHeight = 50
  155.     Private _TitleTextPostion As TitlePostion = TitlePostion.Left
  156.     Private _BorderThickness As Integer = 1
  157.     Private _ShowIcon As Boolean
  158.  
  159. #End Region
  160.  
  161. #Region " Constructors "
  162.  
  163.     Sub New()
  164.         SetStyle(ControlStyles.UserPaint Or ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.SupportsTransparentBackColor Or ControlStyles.ResizeRedraw, True)
  165.         DoubleBuffered = True
  166.         Font = New Font("Ubuntu", 13, FontStyle.Bold)
  167.         UpdateStyles()
  168.     End Sub
  169.  
  170. #End Region
  171.  
  172. #Region " Properties "
  173.  
  174.     Public Property BorderThickness As Integer
  175.         Get
  176.             Return _BorderThickness
  177.         End Get
  178.         Set(value As Integer)
  179.             _BorderThickness = value
  180.             Invalidate()
  181.         End Set
  182.     End Property
  183.  
  184.  
  185.     Property ShowIcon As Boolean
  186.         Get
  187.             Return _ShowIcon
  188.         End Get
  189.         Set(ByVal value As Boolean)
  190.             If value = _ShowIcon Then Return
  191.             FindForm.ShowIcon = value
  192.             _ShowIcon = value
  193.             Invalidate()
  194.         End Set
  195.     End Property
  196.  
  197.     Public Overridable Property TitleTextPostion As TitlePostion
  198.         Get
  199.             Return _TitleTextPostion
  200.         End Get
  201.         Set(value As TitlePostion)
  202.             _TitleTextPostion = value
  203.             Invalidate()
  204.         End Set
  205.     End Property
  206.  
  207.     Enum TitlePostion
  208.         Left
  209.         Center
  210.         Right
  211.     End Enum
  212.  
  213. #End Region
  214.  
  215. #Region " Draw Control "
  216.  
  217.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  218.         With e.Graphics
  219.  
  220.             .TextRenderingHint = Drawing.Text.TextRenderingHint.ClearTypeGridFit
  221.  
  222.             .FillRectangle(SolidBrushHTMlColor("331f35"), New Rectangle(0, 0, Width, Height))
  223.  
  224.             .FillRectangle(SolidBrushHTMlColor("241525"), New Rectangle(0, 0, Width, 55))
  225.  
  226.             .DrawLine(PenHTMlColor("231024", 1), New Point(1, 55), New Point(Width - 1, 55))
  227.  
  228.             .DrawRectangle(PenHTMlColor("241525", BorderThickness), New Rectangle(0, 0, Width, Height))
  229.  
  230.             If FindForm.ShowIcon Then
  231.  
  232.                 If Not FindForm.Icon Is Nothing Then
  233.  
  234.                     Select Case TitleTextPostion
  235.                         Case TitlePostion.Left
  236.                             .DrawString(Text.ToUpper, Font, SolidBrushHTMlColor("f3ebf3"), 27, 15)
  237.                             .DrawIcon(FindForm.Icon, New Rectangle(5, 16, 20, 20))
  238.                         Case TitlePostion.Center
  239.                             CentreString(e.Graphics, Text.ToUpper, Font, SolidBrushHTMlColor("f3ebf3"), New Rectangle(0, 0, Width, 50))
  240.                             .DrawIcon(FindForm.Icon, New Rectangle(5, 16, 20, 20))
  241.                         Case TitlePostion.Right
  242.                             RightString(e.Graphics, Text.ToUpper, Font, SolidBrushHTMlColor("f3ebf3"), New Rectangle(0, 0, Width, 50))
  243.                             .DrawIcon(FindForm.Icon, New Rectangle(Width - 30, 16, 20, 20))
  244.                     End Select
  245.  
  246.                 End If
  247.  
  248.             Else
  249.  
  250.                 Select Case TitleTextPostion
  251.                     Case TitlePostion.Left
  252.                         .DrawString(Text.ToUpper, Font, SolidBrushHTMlColor("f3ebf3"), 5, 17)
  253.                     Case TitlePostion.Center
  254.                         CentreString(e.Graphics, Text.ToUpper, Font, SolidBrushHTMlColor("f3ebf3"), New Rectangle(0, 2, Width, 50))
  255.                     Case TitlePostion.Right
  256.                         RightString(e.Graphics, Text.ToUpper, Font, SolidBrushHTMlColor("f3ebf3"), New Rectangle(0, 2, Width, 50))
  257.                 End Select
  258.  
  259.             End If
  260.  
  261.  
  262.  
  263.         End With
  264.     End Sub
  265.  
  266. #End Region
  267.  
  268. #Region " Events "
  269.  
  270.     Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  271.         MyBase.OnMouseDown(e)
  272.         If e.Button = Windows.Forms.MouseButtons.Left And New Rectangle(0, 0, Width, MoveHeight).Contains(e.Location) Then
  273.             Movable = True
  274.             MousePoint = e.Location
  275.         End If
  276.     End Sub
  277.  
  278.     Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  279.         MyBase.OnMouseUp(e)
  280.         Movable = False
  281.     End Sub
  282.  
  283.     Protected Overrides Sub OnMouseMove(ByVal e As MouseEventArgs)
  284.         MyBase.OnMouseMove(e)
  285.         If Movable Then Parent.Location = MousePosition - MousePoint
  286.     End Sub
  287.  
  288.     Protected NotOverridable Overrides Sub OnCreateControl()
  289.         MyBase.OnCreateControl()
  290.         ParentForm.FormBorderStyle = FormBorderStyle.None
  291.         Dock = DockStyle.Fill
  292.         Invalidate()
  293.     End Sub
  294.  
  295. #End Region
  296.  
  297. End Class
  298.  
  299. #End Region
  300.  
  301. #Region " Flat Button "
  302.  
  303. Public Class ModalFlatButton : Inherits Control
  304.  
  305. #Region " Variables "
  306.  
  307.     Private State As MouseMode
  308.  
  309. #End Region
  310.  
  311. #Region " Constructors "
  312.  
  313.     Sub New()
  314.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or ControlStyles.OptimizedDoubleBuffer Or _
  315.          ControlStyles.SupportsTransparentBackColor, True)
  316.         DoubleBuffered = True
  317.         BackColor = Color.Transparent
  318.         Font = New Font("Ubuntu", 14, FontStyle.Regular, GraphicsUnit.Pixel)
  319.         UpdateStyles()
  320.  
  321.     End Sub
  322.  
  323. #End Region
  324.  
  325. #Region " Draw Control "
  326.  
  327.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  328.         Using B As New Bitmap(Width, Height), G As Graphics = Graphics.FromImage(B)
  329.             G.SmoothingMode = SmoothingMode.AntiAlias
  330.             G.TextRenderingHint = Drawing.Text.TextRenderingHint.ClearTypeGridFit
  331.             Dim Rect As New Rectangle(0, 0, Width - 1, Height - 1)
  332.             Select Case State
  333.  
  334.                 Case MouseMode.NormalMode
  335.  
  336.                     FillRoundedPath(G, SolidBrushHTMlColor("291a2a"), Rect, 2)
  337.  
  338.                     DrawRoundedPath(G, GetHTMLColor("231625"), 1, Rect, 2)
  339.  
  340.  
  341.                 Case MouseMode.Hovered
  342.                     Cursor = Cursors.Hand
  343.  
  344.                     FillRoundedPath(G, SolidBrushHTMlColor("231625"), Rect, 2)
  345.  
  346.                     DrawRoundedPath(G, GetHTMLColor("231625"), 1, Rect, 2)
  347.  
  348.  
  349.                 Case MouseMode.Pushed
  350.  
  351.                     FillRoundedPath(G, SolidBrushHTMlColor("291a2a"), Rect, 2)
  352.                     DrawRoundedPath(G, GetHTMLColor("231625"), 1, Rect, 2)
  353.  
  354.             End Select
  355.  
  356.             CentreString(G, Text, Font, SolidBrushHTMlColor("e5d2e6"), New Rectangle(0, 0, Width - 2, Height - 4))
  357.  
  358.             e.Graphics.DrawImage(B.Clone, 0, 0)
  359.             G.Dispose() : B.Dispose()
  360.         End Using
  361.     End Sub
  362.  
  363. #End Region
  364.  
  365. #Region " Events "
  366.  
  367.     Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  368.         MyBase.OnMouseUp(e)
  369.         State = MouseMode.Hovered : Invalidate()
  370.     End Sub
  371.  
  372.     Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  373.         MyBase.OnMouseUp(e)
  374.         State = MouseMode.Pushed : Invalidate()
  375.     End Sub
  376.  
  377.     Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
  378.         MyBase.OnMouseEnter(e)
  379.         State = MouseMode.Hovered : Invalidate()
  380.     End Sub
  381.  
  382.     Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
  383.         MyBase.OnMouseEnter(e)
  384.         State = MouseMode.NormalMode : Invalidate()
  385.     End Sub
  386.  
  387. #End Region
  388.  
  389. End Class
  390.  
  391. #End Region
  392.  
  393. #Region " Button "
  394.  
  395. Public Class ModalButton : Inherits Control
  396.  
  397. #Region " Variables "
  398.  
  399.     Private State As MouseMode
  400.  
  401. #End Region
  402.  
  403. #Region " Constructors "
  404.  
  405.     Sub New()
  406.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or ControlStyles.OptimizedDoubleBuffer Or _
  407.          ControlStyles.SupportsTransparentBackColor, True)
  408.         DoubleBuffered = True
  409.         BackColor = Color.Transparent
  410.         Font = New Font("Ubuntu", 14, FontStyle.Regular, GraphicsUnit.Pixel)
  411.         UpdateStyles()
  412.     End Sub
  413.  
  414. #End Region
  415.  
  416. #Region " Draw Control "
  417.  
  418.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  419.         Using B As New Bitmap(Width, Height), G As Graphics = Graphics.FromImage(B)
  420.             G.SmoothingMode = SmoothingMode.AntiAlias
  421.             G.TextRenderingHint = Drawing.Text.TextRenderingHint.ClearTypeGridFit
  422.             Dim Rect As New Rectangle(0, 0, Width - 1, Height - 1)
  423.             Select Case State
  424.  
  425.                 Case MouseMode.NormalMode
  426.  
  427.                     Using HB As LinearGradientBrush = New LinearGradientBrush(Rect, Color.FromArgb(200, GetHTMLColor("431448")), Color.FromArgb(200, GetHTMLColor("5b2960")), 270S)
  428.                         FillRoundedPath(G, HB, Rect, 2)
  429.                         Using HB2 As LinearGradientBrush = New LinearGradientBrush(Rect, Color.FromArgb(230, GetHTMLColor("431448")), Color.FromArgb(230, GetHTMLColor("5b2960")), 270S)
  430.                             FillRoundedPath(G, HB2, Rect, 2)
  431.                         End Using
  432.                         DrawRoundedPath(G, GetHTMLColor("311833"), 1, Rect, 2)
  433.                     End Using
  434.  
  435.                 Case MouseMode.Hovered
  436.                     Cursor = Cursors.Hand
  437.                     Using HB As LinearGradientBrush = New LinearGradientBrush(Rect, Color.FromArgb(200, GetHTMLColor("241525")), Color.FromArgb(200, GetHTMLColor("241525")), 270S)
  438.                         FillRoundedPath(G, HB, Rect, 2)
  439.                         Using HB2 As LinearGradientBrush = New LinearGradientBrush(Rect, Color.FromArgb(230, GetHTMLColor("431448")), Color.FromArgb(230, GetHTMLColor("5b2960")), 270S)
  440.                             FillRoundedPath(G, HB2, Rect, 2)
  441.                         End Using
  442.                         DrawRoundedPath(G, GetHTMLColor("311833"), 1, Rect, 2)
  443.                     End Using
  444.  
  445.                 Case MouseMode.Pushed
  446.  
  447.                     Using HB As LinearGradientBrush = New LinearGradientBrush(Rect, Color.FromArgb(200, GetHTMLColor("431448")), Color.FromArgb(200, GetHTMLColor("5b2960")), 270S)
  448.                         FillRoundedPath(G, HB, Rect, 2)
  449.                         Using HB2 As LinearGradientBrush = New LinearGradientBrush(Rect, Color.FromArgb(230, GetHTMLColor("431448")), Color.FromArgb(230, GetHTMLColor("5b2960")), 270S)
  450.                             FillRoundedPath(G, HB2, Rect, 2)
  451.                         End Using
  452.                         DrawRoundedPath(G, GetHTMLColor("311833"), 1, Rect, 2)
  453.                     End Using
  454.  
  455.             End Select
  456.  
  457.             CentreString(G, Text, Font, SolidBrushHTMlColor("e5d2e6"), New Rectangle(0, 0, Width - 1, Height - 4))
  458.  
  459.             e.Graphics.DrawImage(B.Clone, 0, 0)
  460.             G.Dispose() : B.Dispose()
  461.         End Using
  462.     End Sub
  463.  
  464. #End Region
  465.  
  466. #Region " Events "
  467.  
  468.     Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  469.         MyBase.OnMouseUp(e)
  470.         State = MouseMode.Hovered : Invalidate()
  471.     End Sub
  472.  
  473.     Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  474.         MyBase.OnMouseUp(e)
  475.         State = MouseMode.Pushed : Invalidate()
  476.     End Sub
  477.  
  478.     Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
  479.         MyBase.OnMouseEnter(e)
  480.         State = MouseMode.Hovered : Invalidate()
  481.     End Sub
  482.  
  483.     Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
  484.         MyBase.OnMouseEnter(e)
  485.         State = MouseMode.NormalMode : Invalidate()
  486.     End Sub
  487.  
  488. #End Region
  489.  
  490. End Class
  491.  
  492. #End Region
  493.  
  494. #Region " TextBox "
  495.  
  496. <DefaultEvent("TextChanged")> Public Class ModalTextbox : Inherits Control
  497.  
  498. #Region " Variables "
  499.  
  500.     Private WithEvents T As New TextBox
  501.     Private _TextAlign As HorizontalAlignment = HorizontalAlignment.Left
  502.     Private _MaxLength As Integer = 32767
  503.     Private _ReadOnly As Boolean = False
  504.     Private _UseSystemPasswordChar As Boolean = False
  505.     Private _WatermarkText As String = String.Empty
  506.     Private _SideImage As Image
  507.     Private TBC = GetHTMLColor("291a2a")
  508.     Private TFC = GetHTMLColor("a89ea9")
  509.     Private State As MouseMode = MouseMode.NormalMode
  510.  
  511. #End Region
  512.  
  513. #Region " Native Methods "
  514.  
  515.     Private Declare Auto Function SendMessage Lib "user32.dll" (hWnd As IntPtr, msg As Integer, wParam As Integer, <System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr)> lParam As String) As Int32
  516.  
  517. #End Region
  518.  
  519. #Region " Properties "
  520.  
  521.     <Browsable(False), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
  522.     ReadOnly Property BorderStyle As BorderStyle
  523.         Get
  524.             Return BorderStyle.None
  525.         End Get
  526.     End Property
  527.  
  528.     Public Overridable Shadows Property TextAlign() As HorizontalAlignment
  529.         Get
  530.             Return _TextAlign
  531.         End Get
  532.         Set(ByVal value As HorizontalAlignment)
  533.             _TextAlign = value
  534.             If T IsNot Nothing Then
  535.                 T.TextAlign = value
  536.             End If
  537.         End Set
  538.     End Property
  539.  
  540.     Public Overridable Shadows Property MaxLength() As Integer
  541.         Get
  542.             Return _MaxLength
  543.         End Get
  544.         Set(ByVal value As Integer)
  545.             _MaxLength = value
  546.             If T IsNot Nothing Then
  547.                 T.MaxLength = value
  548.             End If
  549.         End Set
  550.     End Property
  551.  
  552.     Public Overridable Shadows Property [ReadOnly]() As Boolean
  553.         Get
  554.             Return _ReadOnly
  555.         End Get
  556.         Set(ByVal value As Boolean)
  557.             _ReadOnly = value
  558.             If T IsNot Nothing Then
  559.                 T.ReadOnly = value
  560.             End If
  561.         End Set
  562.     End Property
  563.  
  564.     Public Overridable Shadows Property UseSystemPasswordChar() As Boolean
  565.         Get
  566.             Return _UseSystemPasswordChar
  567.         End Get
  568.         Set(ByVal value As Boolean)
  569.             _UseSystemPasswordChar = value
  570.             If T IsNot Nothing Then
  571.                 T.UseSystemPasswordChar = value
  572.             End If
  573.         End Set
  574.     End Property
  575.  
  576.     <Browsable(False), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
  577.     Public Overridable Shadows ReadOnly Property Multiline() As Boolean
  578.         Get
  579.             Return False
  580.         End Get
  581.     End Property
  582.  
  583.     <Browsable(False), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
  584.     Public Overridable Shadows ReadOnly Property BackgroundImage() As Image
  585.         Get
  586.             Return Nothing
  587.         End Get
  588.     End Property
  589.  
  590.     Public Overridable Shadows Property Text As String
  591.         Get
  592.             Return MyBase.Text
  593.         End Get
  594.         Set(ByVal value As String)
  595.             MyBase.Text = value
  596.             If T IsNot Nothing Then
  597.                 T.Text = value
  598.             End If
  599.         End Set
  600.     End Property
  601.  
  602.     Public Property WatermarkText As String
  603.         Get
  604.             Return _WatermarkText
  605.         End Get
  606.         Set(value As String)
  607.             _WatermarkText = value
  608.             SendMessage(T.Handle, &H1501, 0, value)
  609.             Invalidate()
  610.         End Set
  611.     End Property
  612.  
  613.     <Browsable(True)>
  614.     Public Property SideImage As Image
  615.         Get
  616.             Return _SideImage
  617.         End Get
  618.         Set(value As Image)
  619.             _SideImage = value
  620.             Invalidate()
  621.         End Set
  622.     End Property
  623.  
  624.     Enum SideAligin
  625.         Left
  626.         Right
  627.     End Enum
  628.     Private _SideImageAlign As SideAligin = SideAligin.Left
  629.     <Browsable(True)>
  630.     Public Property SideImageAlign As SideAligin
  631.         Get
  632.             Return _SideImageAlign
  633.         End Get
  634.         Set(value As SideAligin)
  635.             _SideImageAlign = value
  636.             Invalidate()
  637.         End Set
  638.     End Property
  639.  
  640. #End Region
  641.  
  642. #Region " Initilization "
  643.  
  644.     Sub New()
  645.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or _
  646.                   ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer Or _
  647.                   ControlStyles.SupportsTransparentBackColor, True)
  648.         DoubleBuffered = True
  649.         BackColor = Color.Transparent
  650.         Font = New Font("Ubuntu", 10, FontStyle.Regular)
  651.         With T
  652.             .Multiline = False
  653.             .Cursor = Cursors.IBeam
  654.             .BackColor = TBC
  655.             .ForeColor = TFC
  656.             .BorderStyle = BorderStyle.None
  657.             .Location = New Point(7, 7)
  658.             .Font = Font
  659.             .Size = New Size(Width - 10, 30)
  660.             .UseSystemPasswordChar = _UseSystemPasswordChar
  661.         End With
  662.         Size = New Size(135, 30)
  663.         UpdateStyles()
  664.  
  665.     End Sub
  666.  
  667. #End Region
  668.  
  669. #Region " Events "
  670.  
  671.     Private Sub T_TextChanged(ByVal sender As Object, ByVal e As EventArgs) Handles T.TextChanged
  672.         Text = T.Text
  673.     End Sub
  674.  
  675.     Private Sub T_KeyDown(ByVal sender As Object, ByVal e As KeyEventArgs) Handles T.KeyDown
  676.         If e.Control AndAlso e.KeyCode = Keys.A Then e.SuppressKeyPress = True
  677.         If e.Control AndAlso e.KeyCode = Keys.C Then
  678.             T.Copy()
  679.             e.SuppressKeyPress = True
  680.         End If
  681.     End Sub
  682.  
  683.     Protected NotOverridable Overrides Sub OnCreateControl()
  684.         MyBase.OnCreateControl()
  685.         If Not Controls.Contains(T) Then Controls.Add(T)
  686.     End Sub
  687.  
  688.     Protected NotOverridable Overrides Sub OnResize(e As EventArgs)
  689.         MyBase.OnResize(e)
  690.         Height = 30
  691.     End Sub
  692.  
  693.     Private Sub T_MouseHover(ByVal sender As Object, e As EventArgs) Handles T.MouseHover
  694.         State = MouseMode.Hovered
  695.         Invalidate()
  696.     End Sub
  697.  
  698.     Private Sub T_MouseLeave(ByVal sender As Object, e As EventArgs) Handles T.MouseLeave
  699.         State = MouseMode.NormalMode
  700.         Invalidate()
  701.     End Sub
  702.  
  703.     Private Sub T_MouseUp(ByVal sender As Object, e As MouseEventArgs) Handles T.MouseUp
  704.         State = MouseMode.NormalMode
  705.         Invalidate()
  706.     End Sub
  707.  
  708.     Private Sub T_MouseEnter(ByVal sender As Object, e As EventArgs) Handles T.MouseEnter
  709.         State = MouseMode.NormalMode
  710.         Invalidate()
  711.     End Sub
  712.  
  713.     Private Sub T_MouseDown(ByVal sender As Object, e As EventArgs) Handles T.MouseDown
  714.         State = MouseMode.Pushed
  715.         Invalidate()
  716.     End Sub
  717.  
  718. #End Region
  719.  
  720. #Region " Draw Control "
  721.  
  722.     Protected NotOverridable Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  723.         Using B As New Bitmap(Width, Height), G As Graphics = Graphics.FromImage(B)
  724.             Dim Rect As New Rectangle(0, 0, Width - 1, Height - 1)
  725.             Height = 30
  726.  
  727.             With G
  728.  
  729.                 .TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
  730.  
  731.                 .FillRectangle(SolidBrushHTMlColor("291a2a"), Rect)
  732.  
  733.                 .DrawLine(PenHTMlColor("231625", 1), New Point(0, Height - 1), New Point(Width - 2, Height - 1))
  734.  
  735.                 If Not SideImage Is Nothing Then
  736.                     If SideImageAlign = SideAligin.Right Then
  737.                         T.Location = New Point(7, 5)
  738.                         T.Width = Width - 60
  739.                         .InterpolationMode = InterpolationMode.HighQualityBicubic
  740.                         .DrawImage(SideImage, New Rectangle(Rect.Width - 24, 6, 16, 16))
  741.                     Else
  742.                         T.Location = New Point(33, 5)
  743.                         T.Width = Width - 60
  744.                         .InterpolationMode = InterpolationMode.HighQualityBicubic
  745.                         .DrawImage(SideImage, New Rectangle(8, 6, 16, 16))
  746.                     End If
  747.  
  748.                 Else
  749.                     T.Location = New Point(7, 5)
  750.                     T.Width = Width - 10
  751.                 End If
  752.  
  753.                 If Not ContextMenuStrip Is Nothing Then T.ContextMenuStrip = ContextMenuStrip
  754.  
  755.             End With
  756.  
  757.             e.Graphics.DrawImage(B.Clone(), 0, 0)
  758.             G.Dispose() : B.Dispose()
  759.  
  760.         End Using
  761.     End Sub
  762.  
  763. #End Region
  764.  
  765. End Class
  766.  
  767. #End Region
  768.  
  769. #Region " ComboBox "
  770.  
  771. Public Class ModalComboBox : Inherits ComboBox
  772.  
  773. #Region " Variables "
  774.  
  775.     Private _StartIndex As Integer = 0
  776.  
  777. #End Region
  778.  
  779. #Region " Constructors "
  780.  
  781.     Sub New()
  782.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint, True)
  783.         BackColor = GetHTMLColor("291a2a")
  784.         Font = New Font("Ubuntu", 12, FontStyle.Regular)
  785.         DrawMode = Windows.Forms.DrawMode.OwnerDrawFixed
  786.         DoubleBuffered = True
  787.         StartIndex = 0
  788.         DropDownHeight = 100
  789.         DropDownStyle = ComboBoxStyle.DropDownList
  790.         UpdateStyles()
  791.  
  792.     End Sub
  793.  
  794. #End Region
  795.  
  796. #Region " Properties "
  797.  
  798.     Private Property StartIndex As Integer
  799.         Get
  800.             Return _StartIndex
  801.         End Get
  802.         Set(ByVal value As Integer)
  803.             _StartIndex = value
  804.             Try
  805.                 MyBase.SelectedIndex = value
  806.             Catch
  807.             End Try
  808.             Invalidate()
  809.         End Set
  810.     End Property
  811.  
  812. #End Region
  813.  
  814. #Region " Draw Control "
  815.  
  816.     Protected Overrides Sub OnDrawItem(e As DrawItemEventArgs)
  817.         Try
  818.             Dim G As Graphics = e.Graphics
  819.             With G
  820.                 .TextRenderingHint = Drawing.Text.TextRenderingHint.ClearTypeGridFit
  821.                 If (e.State And DrawItemState.Selected) = DrawItemState.Selected Then
  822.                     Cursor = Cursors.Hand
  823.                     .FillRectangle(New SolidBrush(Color.FromArgb(220, GetHTMLColor("291a2a"))), New Rectangle(e.Bounds.X + 1, e.Bounds.Y + 2, e.Bounds.Width - 2, e.Bounds.Height - 2))
  824.                     CentreString(G, Items(e.Index), New Font("Ubuntu", 10, FontStyle.Bold), SolidBrushHTMlColor("a89ea9"), New Rectangle(e.Bounds.X + 1, e.Bounds.Y + 3, e.Bounds.Width - 2, e.Bounds.Height - 2))
  825.                 Else
  826.                     .FillRectangle(SolidBrushHTMlColor("291a2a"), New Rectangle(e.Bounds.X + 1, e.Bounds.Y + 2, e.Bounds.Width - 2, e.Bounds.Height - 2))
  827.                     CentreString(G, Items(e.Index), New Font("Ubuntu", 10, FontStyle.Regular), Brushes.Gainsboro, New Rectangle(e.Bounds.X + 1, e.Bounds.Y + 2, e.Bounds.Width - 2, e.Bounds.Height - 2))
  828.                 End If
  829.             End With
  830.         Catch
  831.         End Try
  832.         Invalidate()
  833.     End Sub
  834.  
  835.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  836.         Dim Rect As New Rectangle(0, 0, Width - 1, Height - 1)
  837.         With e.Graphics
  838.             .TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
  839.             .FillRectangle(SolidBrushHTMlColor("291a2a"), Rect)
  840.  
  841.             .DrawLine(PenHTMlColor("231625", 2), New Point(Width - 21, (Height / 2) - 3), New Point(Width - 7, (Height / 2) - 3))
  842.             .DrawLine(PenHTMlColor("231625", 2), New Point(Width - 21, (Height / 2)), New Point(Width - 7, (Height / 2)))
  843.             .DrawLine(PenHTMlColor("231625", 2), New Point(Width - 21, (Height / 2) + 5), New Point(Width - 7, (Height / 2) + 5))
  844.  
  845.             .DrawLine(PenHTMlColor("231625", 1), New Point(1, Height - 1), New Point(Width - 2, Height - 1))
  846.             .DrawString(Text, Font, New SolidBrush(GetHTMLColor("a89ea9")), New Rectangle(5, 1, Width - 1, Height - 1), New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Near})
  847.         End With
  848.     End Sub
  849.  
  850. #End Region
  851.  
  852. #Region " Events "
  853.  
  854.     Protected Overrides Sub OnResize(e As EventArgs)
  855.         MyBase.OnResize(e)
  856.         Invalidate()
  857.     End Sub
  858.  
  859. #End Region
  860.  
  861. End Class
  862.  
  863. #End Region
  864.  
  865. #Region " CheckBox "
  866.  
  867. <DefaultEvent("CheckedChanged")> Public Class ModalCheckBox : Inherits Control
  868.  
  869. #Region " Variables "
  870.  
  871.     Private _Checked As Boolean
  872.     Protected State As MouseMode = MouseMode.NormalMode
  873.  
  874. #End Region
  875.  
  876. #Region " Events "
  877.  
  878.     Event CheckedChanged(ByVal sender As Object)
  879.  
  880. #End Region
  881.  
  882. #Region " Properties "
  883.  
  884.     Property Checked As Boolean
  885.         Get
  886.             Return _Checked
  887.         End Get
  888.         Set(ByVal value As Boolean)
  889.             _Checked = value
  890.             RaiseEvent CheckedChanged(Me)
  891.             Invalidate()
  892.         End Set
  893.     End Property
  894.  
  895. #End Region
  896.  
  897. #Region " Constructors "
  898.  
  899.     Sub New()
  900.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or _
  901.     ControlStyles.SupportsTransparentBackColor Or ControlStyles.UserPaint, True)
  902.         DoubleBuffered = True
  903.         Cursor = Cursors.Hand
  904.         BackColor = Color.Transparent
  905.         Font = New Font("Ubuntu", 11, FontStyle.Regular)
  906.         UpdateStyles()
  907.     End Sub
  908.  
  909. #End Region
  910.  
  911. #Region " Draw Control "
  912.  
  913.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  914.         Using B As New Bitmap(Width, Height), G As Graphics = Graphics.FromImage(B)
  915.             Dim R As New Rectangle(1, 1, 18, 18)
  916.             G.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
  917.             G.FillRectangle(SolidBrushHTMlColor("291a2a"), R)
  918.             G.DrawRectangle(PenHTMlColor("231625", 1.5), R)
  919.             If Checked Then
  920.                 G.DrawString("b", New Font("Marlett", 16, FontStyle.Regular), SolidBrushHTMlColor("5b2960"), New Rectangle(-2.7, 0, Width - 4, Height))
  921.             End If
  922.             G.DrawString(Text, Font, SolidBrushHTMlColor("a89ea9"), New Rectangle(22, 1.8, Width, Height - 2), New StringFormat With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Center})
  923.             e.Graphics.DrawImage(B, 0, 0)
  924.             G.Dispose()
  925.             B.Dispose()
  926.         End Using
  927.     End Sub
  928.  
  929. #End Region
  930.  
  931. #Region " Events "
  932.  
  933.     Protected Overrides Sub OnClick(ByVal e As EventArgs)
  934.         _Checked = Not Checked
  935.         RaiseEvent CheckedChanged(Me)
  936.         MyBase.OnClick(e)
  937.         Invalidate()
  938.     End Sub
  939.  
  940.     Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
  941.         Invalidate() : MyBase.OnTextChanged(e)
  942.     End Sub
  943.  
  944.     Protected Overrides Sub OnResize(ByVal e As System.EventArgs)
  945.         MyBase.OnResize(e)
  946.         Height = 20
  947.         Invalidate()
  948.     End Sub
  949.  
  950.     Protected Overrides Sub OnMouseHover(e As EventArgs)
  951.         MyBase.OnMouseHover(e)
  952.         State = MouseMode.Hovered
  953.         Invalidate()
  954.     End Sub
  955.  
  956.     Protected Overrides Sub OnMouseLeave(e As EventArgs)
  957.         MyBase.OnMouseLeave(e)
  958.         State = MouseMode.NormalMode
  959.         Invalidate()
  960.     End Sub
  961.  
  962. #End Region
  963.  
  964. End Class
  965.  
  966. #End Region
  967.  
  968. #Region " Radio Button "
  969.  
  970. <DefaultEvent("TextChanged")> Public Class ModalRadioButton : Inherits Control
  971.  
  972. #Region " Variables "
  973.  
  974.     Private _Checked As Boolean
  975.     Protected _Group As Integer = 1
  976.     Protected State As MouseMode = MouseMode.NormalMode
  977.  
  978. #End Region
  979.  
  980. #Region " Events "
  981.  
  982.     Event CheckedChanged(ByVal sender As Object)
  983.  
  984. #End Region
  985.  
  986. #Region " Properties "
  987.  
  988.     Property Checked As Boolean
  989.         Get
  990.             Return _Checked
  991.         End Get
  992.         Set(ByVal value As Boolean)
  993.             _Checked = value
  994.             RaiseEvent CheckedChanged(Me)
  995.             Invalidate()
  996.         End Set
  997.     End Property
  998.  
  999.     Property Group As Integer
  1000.         Get
  1001.             Return _Group
  1002.         End Get
  1003.         Set(ByVal value As Integer)
  1004.             _Group = value
  1005.             Invalidate()
  1006.         End Set
  1007.     End Property
  1008.  
  1009. #End Region
  1010.  
  1011. #Region " Constructors "
  1012.  
  1013.     Sub New()
  1014.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or _
  1015.     ControlStyles.SupportsTransparentBackColor Or ControlStyles.UserPaint, True)
  1016.         DoubleBuffered = True
  1017.         Cursor = Cursors.Hand
  1018.         BackColor = Color.Transparent
  1019.         Font = New Font("Ubuntu", 11, FontStyle.Regular)
  1020.         UpdateStyles()
  1021.     End Sub
  1022.  
  1023. #End Region
  1024.  
  1025. #Region " Draw Control "
  1026.  
  1027.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  1028.  
  1029.         Using B As New Bitmap(Width, Height), G As Graphics = Graphics.FromImage(B)
  1030.  
  1031.             G.SmoothingMode = SmoothingMode.AntiAlias
  1032.  
  1033.             G.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
  1034.  
  1035.             G.FillEllipse(SolidBrushHTMlColor("291a2a"), New Rectangle(1, 1, 18, 18))
  1036.             G.DrawEllipse(PenHTMlColor("231625", 2.8), New Rectangle(1, 1, 18, 18))
  1037.  
  1038.             If Checked Then
  1039.  
  1040.                 G.DrawString("-", Font, SolidBrushHTMlColor("5b2960"), New Rectangle(5, 0.8, Width - 4, Height))
  1041.  
  1042.             Else
  1043.  
  1044.                 G.DrawString("+", Font, SolidBrushHTMlColor("5b2960"), New Rectangle(4.5, 1, Width - 4, Height))
  1045.  
  1046.             End If
  1047.  
  1048.             G.DrawString(Text, Font, SolidBrushHTMlColor("a89ea9"), New Rectangle(22, 1.6, Width, Height - 2), New StringFormat With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Center})
  1049.  
  1050.             e.Graphics.DrawImage(B, 0, 0)
  1051.             G.Dispose()
  1052.             B.Dispose()
  1053.  
  1054.         End Using
  1055.  
  1056.     End Sub
  1057.  
  1058. #End Region
  1059.  
  1060. #Region " Events "
  1061.  
  1062.     Private Sub UpdateState()
  1063.         If Not IsHandleCreated OrElse Not Checked Then Return
  1064.         For Each C As Control In Parent.Controls
  1065.             If C IsNot Me AndAlso TypeOf C Is ModalRadioButton AndAlso DirectCast(C, ModalRadioButton).Group = _Group Then
  1066.                 DirectCast(C, ModalRadioButton).Checked = False
  1067.             End If
  1068.         Next
  1069.     End Sub
  1070.  
  1071.     Protected Overrides Sub OnClick(ByVal e As EventArgs)
  1072.         _Checked = Not Checked
  1073.         UpdateState()
  1074.         MyBase.OnClick(e)
  1075.         Invalidate()
  1076.     End Sub
  1077.  
  1078.     Protected Overrides Sub OnCreateControl()
  1079.         MyBase.OnCreateControl()
  1080.         UpdateState()
  1081.     End Sub
  1082.  
  1083.     Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
  1084.         Invalidate() : MyBase.OnTextChanged(e)
  1085.     End Sub
  1086.  
  1087.     Protected Overrides Sub OnResize(ByVal e As System.EventArgs)
  1088.         MyBase.OnResize(e)
  1089.         Height = 21
  1090.         Invalidate()
  1091.     End Sub
  1092.  
  1093.     Protected Overrides Sub OnMouseHover(e As EventArgs)
  1094.         MyBase.OnMouseHover(e)
  1095.         State = MouseMode.Hovered
  1096.         Invalidate()
  1097.     End Sub
  1098.  
  1099.     Protected Overrides Sub OnMouseLeave(e As EventArgs)
  1100.         MyBase.OnMouseLeave(e)
  1101.         State = MouseMode.NormalMode
  1102.         Invalidate()
  1103.     End Sub
  1104.  
  1105. #End Region
  1106.  
  1107. End Class
  1108.  
  1109. #End Region
  1110.  
  1111. #Region " Label "
  1112.  
  1113. <DefaultEvent("TextChanged")> Public Class ModalLabel : Inherits Control
  1114.  
  1115. #Region " Draw Cotnrol "
  1116.  
  1117.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  1118.         With e.Graphics
  1119.             .TextRenderingHint = Drawing.Text.TextRenderingHint.ClearTypeGridFit
  1120.             .DrawString(Text, Font, SolidBrushHTMlColor("a89ea9"), ClientRectangle)
  1121.         End With
  1122.     End Sub
  1123.  
  1124. #End Region
  1125.  
  1126. #Region " Constructors "
  1127.  
  1128.     Sub New()
  1129.         SetStyle(ControlStyles.SupportsTransparentBackColor Or ControlStyles.UserPaint Or ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer, True)
  1130.         DoubleBuffered = True
  1131.         BackColor = Color.Transparent
  1132.         Font = New Font("Ubuntu", 12, FontStyle.Regular)
  1133.         UpdateStyles()
  1134.     End Sub
  1135.  
  1136. #End Region
  1137.  
  1138. #Region " Events "
  1139.  
  1140.     Protected Overrides Sub OnResize(e As EventArgs)
  1141.         Height = Font.Height
  1142.     End Sub
  1143.  
  1144.     Protected Overrides Sub OnTextChanged(e As EventArgs)
  1145.         MyBase.OnTextChanged(e)
  1146.         Invalidate()
  1147.     End Sub
  1148.  
  1149. #End Region
  1150.  
  1151. End Class
  1152.  
  1153. #End Region
  1154.  
  1155. #Region " LinkLabel "
  1156.  
  1157. <DefaultEvent("TextChanged")> Public Class ModalLinkLabel : Inherits Control
  1158.  
  1159. #Region " Variables "
  1160.  
  1161.     Private State As MouseMode = MouseMode.NormalMode
  1162.     Private _URL As String = String.Empty
  1163.     Private _HoverColor As Color = GetHTMLColor("311833")
  1164.     Private _PushedColor As Color = GetHTMLColor("431448")
  1165.  
  1166. #End Region
  1167.  
  1168. #Region " Properties "
  1169.  
  1170.     Public Property URL As String
  1171.         Get
  1172.             Return _URL
  1173.         End Get
  1174.         Set(value As String)
  1175.             _URL = value
  1176.             Invalidate()
  1177.         End Set
  1178.     End Property
  1179.  
  1180.     Public Property HoverColor As Color
  1181.         Get
  1182.             Return _HoverColor
  1183.         End Get
  1184.         Set(value As Color)
  1185.             _HoverColor = value
  1186.             Invalidate()
  1187.         End Set
  1188.     End Property
  1189.  
  1190.     Public Property PushedColor As Color
  1191.         Get
  1192.             Return _PushedColor
  1193.         End Get
  1194.         Set(value As Color)
  1195.             _PushedColor = value
  1196.             Invalidate()
  1197.         End Set
  1198.     End Property
  1199.  
  1200. #End Region
  1201.  
  1202. #Region " Draw Control "
  1203.  
  1204.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  1205.         With e.Graphics
  1206.             .TextRenderingHint = Drawing.Text.TextRenderingHint.ClearTypeGridFit
  1207.             Select Case State
  1208.                 Case 0
  1209.                     .DrawString(Text, Font, SolidBrushHTMlColor("a89ea9"), ClientRectangle)
  1210.                 Case 1
  1211.                     Cursor = Cursors.Hand
  1212.                     .DrawString(Text, Font, New SolidBrush(HoverColor), ClientRectangle)
  1213.                 Case 2
  1214.                     .DrawString(Text, Font, New SolidBrush(PushedColor), ClientRectangle)
  1215.             End Select
  1216.  
  1217.         End With
  1218.     End Sub
  1219.  
  1220. #End Region
  1221.  
  1222. #Region " Constructors "
  1223.  
  1224.     Sub New()
  1225.         SetStyle(ControlStyles.SupportsTransparentBackColor Or ControlStyles.UserPaint Or ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer, True)
  1226.         DoubleBuffered = True
  1227.         BackColor = Color.Transparent
  1228.         Font = New Font("Ubuntu", 12, FontStyle.Underline)
  1229.         UpdateStyles()
  1230.     End Sub
  1231.  
  1232. #End Region
  1233.  
  1234. #Region " Events "
  1235.  
  1236.     Protected Overrides Sub OnResize(e As EventArgs)
  1237.         Height = Font.Height + 2
  1238.     End Sub
  1239.     Protected Overrides Sub OnClick(e As EventArgs)
  1240.         MyBase.OnClick(e)
  1241.         If URL <> String.Empty Then
  1242.             If Not URL.StartsWith("http://www.") Then
  1243.                 URL = "http://www." & URL
  1244.                 Process.Start(URL)
  1245.             End If
  1246.         End If
  1247.     End Sub
  1248.     Protected Overrides Sub OnTextChanged(e As EventArgs)
  1249.         MyBase.OnTextChanged(e)
  1250.         Invalidate()
  1251.     End Sub
  1252.  
  1253.     Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  1254.         MyBase.OnMouseUp(e)
  1255.         State = MouseMode.Hovered : Invalidate()
  1256.     End Sub
  1257.  
  1258.     Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  1259.         MyBase.OnMouseUp(e)
  1260.         State = MouseMode.Pushed : Invalidate()
  1261.     End Sub
  1262.  
  1263.     Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
  1264.         MyBase.OnMouseEnter(e)
  1265.         State = MouseMode.Hovered : Invalidate()
  1266.     End Sub
  1267.  
  1268.     Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
  1269.         MyBase.OnMouseEnter(e)
  1270.         State = MouseMode.NormalMode : Invalidate()
  1271.     End Sub
  1272.  
  1273. #End Region
  1274.  
  1275. End Class
  1276.  
  1277. #End Region
  1278.  
  1279. #Region " Seperator "
  1280.  
  1281. Public Class ModalSeperator : Inherits Control
  1282.  
  1283. #Region " Variables "
  1284.  
  1285.     Private _SepStyle As Style = Style.Horizental
  1286.  
  1287. #End Region
  1288.  
  1289. #Region " Enumerators "
  1290.  
  1291.     Enum Style
  1292.         Horizental
  1293.         Vertiacal
  1294.     End Enum
  1295.  
  1296. #End Region
  1297.  
  1298. #Region " Constructors "
  1299.  
  1300.     Sub New()
  1301.         SetStyle(ControlStyles.SupportsTransparentBackColor Or ControlStyles.UserPaint, True)
  1302.         DoubleBuffered = True
  1303.         BackColor = Color.Transparent
  1304.         UpdateStyles()
  1305.     End Sub
  1306.  
  1307. #End Region
  1308.  
  1309. #Region " Draw Control "
  1310.  
  1311.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  1312.         Using B As New Bitmap(Width, Height), G As Graphics = Graphics.FromImage(B)
  1313.             With G
  1314.                 Select Case SepStyle
  1315.                     Case Style.Horizental
  1316.                         .DrawLine(PenHTMlColor("231625", 1), 0, 1, Width, 1)
  1317.                     Case Style.Vertiacal
  1318.                         .DrawLine(PenHTMlColor("231625", 1), 1, 0, 1, Height)
  1319.                 End Select
  1320.             End With
  1321.             e.Graphics.DrawImage(B, 0, 0)
  1322.             G.Dispose()
  1323.             B.Dispose()
  1324.         End Using
  1325.     End Sub
  1326.  
  1327. #End Region
  1328.  
  1329. #Region " Events "
  1330.  
  1331.     Protected Overrides Sub OnResize(e As EventArgs)
  1332.         If SepStyle = Style.Horizental Then
  1333.             Height = 4
  1334.         Else
  1335.             Width = 4
  1336.         End If
  1337.     End Sub
  1338.  
  1339. #End Region
  1340.  
  1341. #Region " Properties "
  1342.  
  1343.     Public Property SepStyle As Style
  1344.         Get
  1345.             Return _SepStyle
  1346.         End Get
  1347.         Set(value As Style)
  1348.             _SepStyle = value
  1349.             If value = Style.Horizental Then
  1350.                 Height = 4
  1351.             Else
  1352.                 Width = 4
  1353.             End If
  1354.         End Set
  1355.     End Property
  1356.  
  1357. #End Region
  1358.  
  1359. End Class
  1360.  
  1361. #End Region
  1362.  
  1363. #Region " Panel "
  1364.  
  1365. Public Class ModalPanel : Inherits ContainerControl
  1366.  
  1367. #Region " Constructors "
  1368.  
  1369.     Sub New()
  1370.         SetStyle(ControlStyles.UserPaint Or ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.SupportsTransparentBackColor, True)
  1371.         DoubleBuffered = True
  1372.         BackColor = Color.Transparent
  1373.         UpdateStyles()
  1374.     End Sub
  1375.  
  1376. #End Region
  1377.  
  1378. #Region " Draw Control "
  1379.  
  1380.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  1381.         Using B As New Bitmap(Width, Height), G As Graphics = Graphics.FromImage(B)
  1382.             Dim Rect As New Rectangle(0, 0, Width - 1, Height - 1)
  1383.             With G
  1384.  
  1385.                 FillRoundedPath(G, SolidBrushHTMlColor("291a2a"), Rect, 2)
  1386.  
  1387.                 DrawRoundedPath(G, GetHTMLColor("231625"), 1, Rect, 2)
  1388.  
  1389.             End With
  1390.  
  1391.             e.Graphics.DrawImage(B, 0, 0)
  1392.             G.Dispose()
  1393.             B.Dispose()
  1394.  
  1395.         End Using
  1396.     End Sub
  1397.  
  1398. #End Region
  1399.  
  1400. End Class
  1401.  
  1402. #End Region
  1403.  
  1404. #Region " GroupBox "
  1405.  
  1406. Public Class ModalGroupBox : Inherits ContainerControl
  1407.  
  1408. #Region " Variables "
  1409.  
  1410.     Private _GroupBoxStyle As Style = Style.I
  1411.  
  1412. #End Region
  1413.  
  1414. #Region " Properties "
  1415.  
  1416.     Public Property GroupBoxStyle As Style
  1417.         Get
  1418.             Return _GroupBoxStyle
  1419.         End Get
  1420.         Set(value As Style)
  1421.             _GroupBoxStyle = value
  1422.             Invalidate()
  1423.         End Set
  1424.     End Property
  1425.  
  1426. #End Region
  1427.  
  1428. #Region " Enumerators "
  1429.  
  1430.     Public Enum Style
  1431.         I
  1432.         O
  1433.     End Enum
  1434.  
  1435. #End Region
  1436.  
  1437. #Region " Constructors "
  1438.  
  1439.     Sub New()
  1440.         SetStyle(ControlStyles.UserPaint Or ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.SupportsTransparentBackColor, True)
  1441.         DoubleBuffered = True
  1442.         Font = New Font("Ubuntu", 11, FontStyle.Regular)
  1443.         BackColor = Color.Transparent
  1444.         UpdateStyles()
  1445.     End Sub
  1446.  
  1447. #End Region
  1448.  
  1449. #Region " Draw Control "
  1450.  
  1451.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  1452.         Using B As New Bitmap(Width, Height), G As Graphics = Graphics.FromImage(B)
  1453.             Dim Rect As New Rectangle(0, 0, Width - 1, Height - 1)
  1454.             With G
  1455.  
  1456.                 .TextRenderingHint = Drawing.Text.TextRenderingHint.ClearTypeGridFit
  1457.  
  1458.                 If GroupBoxStyle = Style.I Then
  1459.                     FillRoundedPath(G, SolidBrushHTMlColor("291a2a"), Rect, 2)
  1460.                     DrawRoundedPath(G, GetHTMLColor("231625"), 1, Rect, 2)
  1461.  
  1462.                     G.DrawString(Text, Font, SolidBrushHTMlColor("a89ea9"), New Point(5, 6), StringFormat.GenericTypographic)
  1463.                     G.DrawLine(PenHTMlColor("231625", 1), New Point(3, 32), New Point(130, 32))
  1464.                 Else
  1465.                     FillRoundedPath(G, SolidBrushHTMlColor("291a2a"), New Rectangle(0, 0, Width - 1, 32), 2)
  1466.                     DrawRoundedPath(G, GetHTMLColor("231625"), 1, Rect, 2)
  1467.  
  1468.                     G.DrawString(Text, Font, SolidBrushHTMlColor("a89ea9"), New Point(5, 6), StringFormat.GenericTypographic)
  1469.                     G.DrawLine(PenHTMlColor("231625", 1), New Point(1, 32), New Point(Width - 1, 32))
  1470.  
  1471.                 End If
  1472.  
  1473.  
  1474.  
  1475.             End With
  1476.  
  1477.             e.Graphics.DrawImage(B, 0, 0)
  1478.             G.Dispose()
  1479.             B.Dispose()
  1480.  
  1481.         End Using
  1482.     End Sub
  1483.  
  1484. #End Region
  1485.  
  1486. End Class
  1487.  
  1488. #End Region
  1489.  
  1490. #Region " Progress "
  1491.  
  1492. Public Class ModalProgressBar : Inherits Control
  1493.  
  1494. #Region " Variables "
  1495.  
  1496.     Private _Maximum As Integer = 100
  1497.     Private _Value As Integer = 0
  1498.  
  1499. #End Region
  1500.  
  1501. #Region " Constructors "
  1502.  
  1503.     Sub New()
  1504.  
  1505.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or ControlStyles.ResizeRedraw Or _
  1506.                        ControlStyles.OptimizedDoubleBuffer Or ControlStyles.SupportsTransparentBackColor, True)
  1507.         DoubleBuffered = True
  1508.         BackColor = Color.Transparent
  1509.         UpdateStyles()
  1510.  
  1511.     End Sub
  1512.  
  1513. #End Region
  1514.  
  1515. #Region " Properties "
  1516.  
  1517.     Public Property Value() As Integer
  1518.         Get
  1519.             If _Value < 0 Then
  1520.                 Return 0
  1521.             Else
  1522.                 Return _Value
  1523.             End If
  1524.         End Get
  1525.         Set(ByVal Value As Integer)
  1526.             If Value > Maximum Then
  1527.                 Value = Maximum
  1528.             End If
  1529.             _Value = Value
  1530.             Invalidate()
  1531.         End Set
  1532.     End Property
  1533.  
  1534.     Public Property Maximum() As Integer
  1535.         Get
  1536.             Return _Maximum
  1537.         End Get
  1538.         Set(ByVal Value As Integer)
  1539.             Select Case Value
  1540.                 Case Is < _Value
  1541.                     _Value = Value
  1542.             End Select
  1543.             _Maximum = Value
  1544.             Invalidate()
  1545.         End Set
  1546.     End Property
  1547.  
  1548. #End Region
  1549.  
  1550. #Region " Draw Control "
  1551.  
  1552.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  1553.         Using B As New Bitmap(Width, Height), G As Graphics = Graphics.FromImage(B)
  1554.  
  1555.             With G
  1556.  
  1557.                 Dim CurrentValue As Integer = CInt(Value / Maximum * Width)
  1558.  
  1559.                 Dim Rect As New Rectangle(0, 0, Width, Height)
  1560.  
  1561.                 .FillRectangle(SolidBrushHTMlColor("291a2a"), Rect)
  1562.                 .DrawRectangle(PenHTMlColor("231625", 1), New Rectangle(0, 0, Width - 1, Height - 1))
  1563.  
  1564.                 If Not CurrentValue = 0 Then
  1565.                     .FillRectangle(New SolidBrush(Color.FromArgb(130, GetHTMLColor("5b2960"))), New Rectangle(Rect.X + 1, Rect.Y + 1, CurrentValue - 2, Rect.Height - 2))
  1566.                 End If
  1567.  
  1568.             End With
  1569.  
  1570.             e.Graphics.DrawImage(B, 0, 0)
  1571.             G.Dispose()
  1572.             B.Dispose()
  1573.  
  1574.         End Using
  1575.     End Sub
  1576.  
  1577. #End Region
  1578.  
  1579. End Class
  1580.  
  1581. #End Region
  1582.  
  1583. #Region " Slider "
  1584.  
  1585. <DefaultEvent("Scroll")> Public Class ModalTrack : Inherits Control
  1586.  
  1587. #Region " Variables "
  1588.  
  1589.     Protected Variable As Boolean
  1590.     Private Track, TrackSide As Rectangle
  1591.     Protected _Maximum As Integer = 100
  1592.     Private _Minimum As Integer
  1593.     Private _Value As Integer
  1594.     Private CurrentValue As Integer = CInt(Value / Maximum - 2 * (Width))
  1595.  
  1596. #End Region
  1597.  
  1598. #Region " Properties "
  1599.  
  1600.     Property Maximum As Integer
  1601.         Get
  1602.             Return _Maximum
  1603.         End Get
  1604.         Set(ByVal value As Integer)
  1605.             _Maximum = value
  1606.             RenewCurrentValue()
  1607.             MoveTrack()
  1608.             Invalidate()
  1609.         End Set
  1610.  
  1611.     End Property
  1612.  
  1613.     Property Minimum As Integer
  1614.         Get
  1615.             Return _Minimum
  1616.         End Get
  1617.         Set(ByVal value As Integer)
  1618.             If Not value < 0 Then
  1619.                 _Minimum = value
  1620.                 RenewCurrentValue()
  1621.                 MoveTrack()
  1622.                 Invalidate()
  1623.             End If
  1624.         End Set
  1625.     End Property
  1626.  
  1627.     Property Value As Integer
  1628.         Get
  1629.             Return _Value
  1630.         End Get
  1631.         Set(ByVal value As Integer)
  1632.             If value <> _Value Then
  1633.                 _Value = value
  1634.                 RenewCurrentValue()
  1635.                 MoveTrack()
  1636.                 Invalidate()
  1637.                 RaiseEvent Scroll(Me)
  1638.             End If
  1639.         End Set
  1640.  
  1641.     End Property
  1642.  
  1643. #End Region
  1644.  
  1645. #Region " Constructors "
  1646.  
  1647.     Sub New()
  1648.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or _
  1649.         ControlStyles.ResizeRedraw Or ControlStyles.SupportsTransparentBackColor Or ControlStyles.UserPaint, True)
  1650.         DoubleBuffered = True
  1651.         BackColor = Color.Transparent
  1652.         UpdateStyles()
  1653.     End Sub
  1654.  
  1655. #End Region
  1656.  
  1657. #Region " Events "
  1658.  
  1659.     Event Scroll(ByVal sender As Object)
  1660.  
  1661.     Protected Overrides Sub OnKeyDown(ByVal e As KeyEventArgs)
  1662.         If e.KeyCode = Keys.Subtract OrElse e.KeyCode = Keys.Down OrElse e.KeyCode = Keys.Left Then
  1663.             If Value = 0 Then Exit Sub
  1664.             Value -= 1
  1665.         ElseIf e.KeyCode = Keys.Add OrElse e.KeyCode = Keys.Up OrElse e.KeyCode = Keys.Right Then
  1666.             If Value = Maximum Then Exit Sub
  1667.             Value += 1
  1668.         End If
  1669.         MyBase.OnKeyDown(e)
  1670.     End Sub
  1671.  
  1672.     Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  1673.         If e.Button = MouseButtons.Left AndAlso Height > 0 Then
  1674.             RenewCurrentValue()
  1675.             If Width > 0 AndAlso Height > 0 Then
  1676.                 Try
  1677.                     Track = New Rectangle(CurrentValue + 0.8, 0, 25, 24)
  1678.                 Catch
  1679.                 End Try
  1680.  
  1681.             End If
  1682.             Variable = New Rectangle(CurrentValue, 0, 24, Height).Contains(e.Location)
  1683.         End If
  1684.         MyBase.OnMouseDown(e)
  1685.     End Sub
  1686.  
  1687.     Protected Overrides Sub OnMouseMove(ByVal e As MouseEventArgs)
  1688.         If Variable AndAlso e.X > -1 AndAlso e.X < Width + 1 Then Value = Minimum + CInt((Maximum - Minimum) * (e.X / Width))
  1689.         MyBase.OnMouseMove(e)
  1690.     End Sub
  1691.  
  1692.     Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  1693.         Variable = False : MyBase.OnMouseUp(e)
  1694.     End Sub
  1695.  
  1696.     Protected Overrides Sub OnResize(ByVal e As EventArgs)
  1697.         If Width > 0 AndAlso Height > 0 Then
  1698.             RenewCurrentValue()
  1699.             MoveTrack()
  1700.         End If
  1701.         Invalidate()
  1702.         MyBase.OnResize(e)
  1703.         Height = 19
  1704.     End Sub
  1705.  
  1706.     Sub RenewCurrentValue()
  1707.         CurrentValue = CInt((Value - Minimum) / (Maximum - Minimum) * (Width - 22.5))
  1708.     End Sub
  1709.  
  1710.     Protected Sub MoveTrack()
  1711.         If Height > 0 AndAlso Width > 0 Then Track = New Rectangle(CurrentValue, 0, 21, 18.5)
  1712.         TrackSide = New Rectangle(CurrentValue + 5.6, 5, 8, 8)
  1713.     End Sub
  1714.  
  1715. #End Region
  1716.  
  1717. #Region " Draw Control "
  1718.  
  1719.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  1720.         Using B As New Bitmap(Width, Height), G As Graphics = Graphics.FromImage(B)
  1721.             With G
  1722.  
  1723.                 Cursor = Cursors.Hand
  1724.                 .FillRectangle(SolidBrushHTMlColor("291a2a"), New Rectangle(0, 5.5, Width, 8))
  1725.                 .DrawRectangle(PenHTMlColor("231625", 1), New Rectangle(0, 5, Width - 1, 8))
  1726.                 If Not CurrentValue = 0 Then
  1727.                     .FillRectangle(New SolidBrush(Color.FromArgb(130, GetHTMLColor("5b2960"))), New Rectangle(1, 5.5, CurrentValue + 4, 7))
  1728.                 End If
  1729.                 .FillRectangle(SolidBrushHTMlColor("291a2a"), Track)
  1730.                 .DrawRectangle(PenHTMlColor("231625", 1), Track)
  1731.                 .FillRectangle(New SolidBrush(Color.FromArgb(130, GetHTMLColor("5b2960"))), TrackSide)
  1732.                 .DrawRectangle(PenHTMlColor("231625", 1), TrackSide)
  1733.  
  1734.             End With
  1735.  
  1736.             e.Graphics.DrawImage(B, 0, 0)
  1737.             G.Dispose()
  1738.             B.Dispose()
  1739.  
  1740.         End Using
  1741.     End Sub
  1742.  
  1743. #End Region
  1744.  
  1745. End Class
  1746.  
  1747. #End Region
  1748.  
  1749. #Region " Control Button "
  1750.  
  1751. Class ModalControlButton : Inherits Control
  1752.  
  1753. #Region " Variables "
  1754.  
  1755.     Private State As MouseMode
  1756.     Private _ControlStyle As Style = Style.Close
  1757.  
  1758. #End Region
  1759.  
  1760. #Region " Constructors "
  1761.  
  1762.     Sub New()
  1763.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or ControlStyles.OptimizedDoubleBuffer Or _
  1764.          ControlStyles.SupportsTransparentBackColor, True)
  1765.         DoubleBuffered = True
  1766.         BackColor = Color.Transparent
  1767.         UpdateStyles()
  1768.  
  1769.     End Sub
  1770.  
  1771. #End Region
  1772.  
  1773. #Region " Draw Control "
  1774.  
  1775.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  1776.         Using B As New Bitmap(Width, Height), G As Graphics = Graphics.FromImage(B)
  1777.             Dim Rect As New Rectangle(0, 0, 18.5, 21)
  1778.             With G
  1779.  
  1780.                 .SmoothingMode = SmoothingMode.AntiAlias
  1781.  
  1782.                 Select Case State
  1783.  
  1784.                     Case MouseMode.NormalMode
  1785.  
  1786.                         FillRoundedPath(G, SolidBrushHTMlColor("291a2a"), Rect, 2)
  1787.                         DrawRoundedPath(G, GetHTMLColor("231625"), 1, Rect, 2)
  1788.                         Select Case ControlStyle
  1789.  
  1790.                             Case Style.Close
  1791.                                 FillRoundedPath(G, New SolidBrush(Color.FromArgb(130, GetHTMLColor("5b2960"))), New Rectangle(5.4, 5.4, 8, 11), 2)
  1792.                                 DrawRoundedPath(G, GetHTMLColor("231625"), 1, New Rectangle(5.4, 5.4, 8, 11), 2)
  1793.                             Case Style.Maximize
  1794.                                 FillRoundedPath(G, New SolidBrush(Color.FromArgb(130, GetHTMLColor("5b2960"))), New Rectangle(4.5, 6, 9, 9), 2)
  1795.                                 DrawRoundedPath(G, GetHTMLColor("231625"), 1, New Rectangle(4.5, 6, 9, 9), 2)
  1796.                             Case Style.Minimize
  1797.                                 FillRoundedPath(G, New SolidBrush(Color.FromArgb(130, GetHTMLColor("5b2960"))), New Rectangle(3, 7.5, 12, 5), 2)
  1798.                                 DrawRoundedPath(G, GetHTMLColor("231625"), 1, New Rectangle(3, 7.5, 12, 5), 2)
  1799.                         End Select
  1800.  
  1801.  
  1802.                     Case MouseMode.Hovered
  1803.  
  1804.                         Cursor = Cursors.Hand
  1805.                         FillRoundedPath(G, New SolidBrush(Color.FromArgb(130, GetHTMLColor("291a2a"))), Rect, 2)
  1806.                         DrawRoundedPath(G, Color.FromArgb(130, GetHTMLColor("231625")), 1, New Rectangle(0, 0, 18.5, 21), 2)
  1807.                         Select Case ControlStyle
  1808.                             Case Style.Close
  1809.                                 FillRoundedPath(G, New SolidBrush(Color.FromArgb(130, GetHTMLColor("5b2960"))), New Rectangle(5.4, 5.4, 8, 11), 2)
  1810.                                 DrawRoundedPath(G, GetHTMLColor("231625"), 1, New Rectangle(5.4, 5.4, 8, 11), 2)
  1811.                             Case Style.Maximize
  1812.                                 FillRoundedPath(G, New SolidBrush(Color.FromArgb(130, GetHTMLColor("5b2960"))), New Rectangle(4.5, 6, 9, 9), 2)
  1813.                                 DrawRoundedPath(G, GetHTMLColor("231625"), 1, New Rectangle(4.5, 6, 9, 9), 2)
  1814.                             Case Style.Minimize
  1815.                                 FillRoundedPath(G, New SolidBrush(Color.FromArgb(130, GetHTMLColor("5b2960"))), New Rectangle(3, 7.5, 12, 5), 2)
  1816.                                 DrawRoundedPath(G, GetHTMLColor("231625"), 1, New Rectangle(3, 7.5, 12, 5), 2)
  1817.                         End Select
  1818.  
  1819.  
  1820.                     Case MouseMode.Pushed
  1821.  
  1822.                         FillRoundedPath(G, SolidBrushHTMlColor("291a2a"), Rect, 2)
  1823.                         DrawRoundedPath(G, GetHTMLColor("231625"), 1, New Rectangle(0, 0, 18.5, 21), 2)
  1824.                         Select Case ControlStyle
  1825.  
  1826.                             Case Style.Close
  1827.                                 FillRoundedPath(G, New SolidBrush(Color.FromArgb(130, GetHTMLColor("5b2960"))), New Rectangle(5.4, 5.4, 8, 11), 2)
  1828.                                 DrawRoundedPath(G, GetHTMLColor("231625"), 1, New Rectangle(5.4, 5.4, 8, 11), 2)
  1829.                             Case Style.Maximize
  1830.                                 FillRoundedPath(G, New SolidBrush(Color.FromArgb(130, GetHTMLColor("5b2960"))), New Rectangle(4.5, 6, 9, 9), 2)
  1831.                                 DrawRoundedPath(G, GetHTMLColor("231625"), 1, New Rectangle(4.5, 6, 9, 9), 2)
  1832.                             Case Style.Minimize
  1833.                                 FillRoundedPath(G, New SolidBrush(Color.FromArgb(130, GetHTMLColor("5b2960"))), New Rectangle(3, 7.5, 12, 5), 2)
  1834.                                 DrawRoundedPath(G, GetHTMLColor("231625"), 1, New Rectangle(3, 7.5, 12, 5), 2)
  1835.                         End Select
  1836.  
  1837.                 End Select
  1838.  
  1839.  
  1840.             End With
  1841.  
  1842.             e.Graphics.DrawImage(B, 0, 0)
  1843.             G.Dispose()
  1844.             B.Dispose()
  1845.         End Using
  1846.     End Sub
  1847.  
  1848. #End Region
  1849.  
  1850. #Region " Properties "
  1851.  
  1852.     Public Property ControlStyle As Style
  1853.         Get
  1854.             Return _ControlStyle
  1855.         End Get
  1856.         Set(value As Style)
  1857.             _ControlStyle = value
  1858.             Invalidate()
  1859.         End Set
  1860.     End Property
  1861.  
  1862. #End Region
  1863.  
  1864. #Region " Enumerators "
  1865.  
  1866.     Enum Style
  1867.         Close
  1868.         Minimize
  1869.         Maximize
  1870.     End Enum
  1871.  
  1872. #End Region
  1873.  
  1874. #Region " Events "
  1875.  
  1876.     Protected Overrides Sub OnClick(e As EventArgs)
  1877.         MyBase.OnClick(e)
  1878.         If ControlStyle = Style.Close Then
  1879.             Environment.Exit(0)
  1880.             Application.Exit()
  1881.         ElseIf ControlStyle = Style.Minimize Then
  1882.             If FindForm.WindowState = FormWindowState.Normal Then
  1883.                 FindForm.WindowState = FormWindowState.Minimized
  1884.             End If
  1885.         ElseIf ControlStyle = Style.Maximize Then
  1886.             If FindForm.WindowState = FormWindowState.Normal Then
  1887.                 FindForm.WindowState = FormWindowState.Maximized
  1888.             ElseIf FindForm.WindowState = FormWindowState.Maximized Then
  1889.                 FindForm.WindowState = FormWindowState.Normal
  1890.             End If
  1891.         End If
  1892.     End Sub
  1893.  
  1894.     Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  1895.         MyBase.OnMouseUp(e)
  1896.         State = MouseMode.Hovered : Invalidate()
  1897.     End Sub
  1898.  
  1899.     Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  1900.         MyBase.OnMouseUp(e)
  1901.         State = MouseMode.Pushed : Invalidate()
  1902.     End Sub
  1903.  
  1904.     Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
  1905.         MyBase.OnMouseEnter(e)
  1906.         State = MouseMode.Hovered : Invalidate()
  1907.     End Sub
  1908.  
  1909.     Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
  1910.         MyBase.OnMouseEnter(e)
  1911.         State = MouseMode.NormalMode : Invalidate()
  1912.     End Sub
  1913.  
  1914.     Protected Overrides Sub OnResize(e As EventArgs)
  1915.         MyBase.OnResize(e)
  1916.         Size = New Size(20, 23)
  1917.     End Sub
  1918.  
  1919. #End Region
  1920.  
  1921. End Class
  1922.  
  1923. #End Region
  1924.  
  1925. #Region " Horizental TabControl "
  1926.  
  1927. Public Class ModalHorizentalTabControl : Inherits TabControl
  1928.  
  1929. #Region " Variables "
  1930.  
  1931.     Private TabColor As Color = GetHTMLColor("331f35")
  1932.  
  1933. #End Region
  1934.  
  1935. #Region " Constructors "
  1936.  
  1937.     Sub New()
  1938.         SetStyle(ControlStyles.UserPaint Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.AllPaintingInWmPaint, True)
  1939.         Alignment = TabAlignment.Top
  1940.         SizeMode = TabSizeMode.Fixed
  1941.         DrawMode = TabDrawMode.OwnerDrawFixed
  1942.         Dock = DockStyle.None
  1943.         DoubleBuffered = True
  1944.         ItemSize = New Size(110, 35)
  1945.         Font = New Font("Ubuntu", 13, FontStyle.Regular, GraphicsUnit.Pixel)
  1946.         UpdateStyles()
  1947.     End Sub
  1948.  
  1949. #End Region
  1950.  
  1951. #Region " Draw Control "
  1952.  
  1953.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  1954.         Using B As New Bitmap(Width, Height), G As Graphics = Graphics.FromImage(B)
  1955.             With G
  1956.                 .Clear(GetHTMLColor("331f35"))
  1957.                 .TextRenderingHint = Drawing.Text.TextRenderingHint.ClearTypeGridFit
  1958.                 .DrawLine(New Pen(Color.FromArgb(130, GetHTMLColor("5b2960")), 2), New Point(4, ItemSize.Height + 1), New Point(Width - 4, ItemSize.Height + 1))
  1959.                 For i = 0 To TabCount - 1
  1960.                     Dim R As Rectangle = GetTabRect(i)
  1961.                     If i = SelectedIndex Then
  1962.                         .DrawLine(PenHTMlColor("5b2960", 2), New Point(R.X + 10, ItemSize.Height + 1), New Point(R.X - 10 + R.Width, ItemSize.Height + 1))
  1963.                         CentreString(G, TabPages(i).Text, Font, SolidBrushHTMlColor("5b2960"), R)
  1964.                         CentreString(G, TabPages(i).Text, Font, New SolidBrush(Color.FromArgb(30, Color.White)), R)
  1965.                     Else
  1966.                         CentreString(G, TabPages(i).Text, Font, SolidBrushHTMlColor("a89ea9"), R)
  1967.                     End If
  1968.                 Next
  1969.             End With
  1970.             e.Graphics.DrawImage(B, 0, 0)
  1971.             G.Dispose()
  1972.             B.Dispose()
  1973.         End Using
  1974.     End Sub
  1975.  
  1976. #End Region
  1977.  
  1978. #Region " Events "
  1979.  
  1980.     Protected Overrides Sub OnCreateControl()
  1981.         MyBase.OnCreateControl()
  1982.         For Each Tab As TabPage In MyBase.TabPages
  1983.             Tab.BackColor = TabColor
  1984.         Next
  1985.     End Sub
  1986.  
  1987. #End Region
  1988.  
  1989. End Class
  1990.  
  1991. #End Region
  1992.  
  1993. #Region " Vertical TabControl "
  1994.  
  1995. Public Class ModalVerticalTabControl : Inherits TabControl
  1996.  
  1997. #Region " Variables "
  1998.  
  1999.     Private TabColor As Color = GetHTMLColor("331f35")
  2000.     Private _ShowBorder As Boolean = True
  2001.  
  2002. #End Region
  2003.  
  2004. #Region " Constructors "
  2005.  
  2006.     Sub New()
  2007.         SetStyle(ControlStyles.UserPaint Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.AllPaintingInWmPaint, True)
  2008.         SizeMode = TabSizeMode.Fixed
  2009.         DrawMode = TabDrawMode.OwnerDrawFixed
  2010.         Dock = DockStyle.None
  2011.         ItemSize = New Size(30, 120)
  2012.         Alignment = TabAlignment.Left
  2013.         DoubleBuffered = True
  2014.         Font = New Font("Ubuntu", 13, FontStyle.Regular, GraphicsUnit.Pixel)
  2015.         UpdateStyles()
  2016.     End Sub
  2017.  
  2018. #End Region
  2019.  
  2020. #Region " Properties "
  2021.  
  2022.     Public Property ShowBorder As Boolean
  2023.         Get
  2024.             Return _ShowBorder
  2025.         End Get
  2026.         Set(value As Boolean)
  2027.             _ShowBorder = value
  2028.             Invalidate()
  2029.         End Set
  2030.     End Property
  2031.  
  2032. #End Region
  2033.  
  2034. #Region " Draw Control "
  2035.  
  2036.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  2037.         Using B As New Bitmap(Width, Height), G As Graphics = Graphics.FromImage(B)
  2038.             With G
  2039.                 .Clear(GetHTMLColor("331f35"))
  2040.                 For i = 0 To TabCount - 1
  2041.                     Dim R As Rectangle = GetTabRect(i)
  2042.                     If TabPages(i).Tag IsNot Nothing Then
  2043.                         .DrawString(TabPages(i).Text.ToUpper, Font, New SolidBrush(Color.FromArgb(180, GetHTMLColor("5b2960"))), New Point(R.X + 5, R.Y + 9))
  2044.                     ElseIf SelectedIndex = i Then
  2045.                         .FillRectangle(New SolidBrush(Color.FromArgb(130, GetHTMLColor("5b2960"))), R)
  2046.                         .FillRectangle(New SolidBrush(Color.FromArgb(230, GetHTMLColor("291a2a"))), New Rectangle(R.X, R.Y, 5, R.Height))
  2047.                         CentreString(G, TabPages(i).Text, Font, SolidBrushHTMlColor("5b2960"), R)
  2048.                         CentreString(G, TabPages(i).Text, Font, New SolidBrush(Color.FromArgb(30, Color.White)), R)
  2049.                     Else
  2050.                         CentreString(G, TabPages(i).Text, Font, SolidBrushHTMlColor("a89ea9"), R)
  2051.                     End If
  2052.                 Next
  2053.                 If ShowBorder Then
  2054.                     .DrawRectangle(PenHTMlColor("291a2a", 1), New Rectangle(0, 0, Width - 1, Height - 1))
  2055.                 End If
  2056.             End With
  2057.             e.Graphics.DrawImage(B.Clone, 0, 0)
  2058.             G.Dispose() : B.Dispose()
  2059.         End Using
  2060.     End Sub
  2061.  
  2062. #End Region
  2063.  
  2064. #Region " Events "
  2065.  
  2066.  
  2067.     Protected Overrides Sub OnCreateControl()
  2068.         MyBase.OnCreateControl()
  2069.         For Each Tab As TabPage In MyBase.TabPages
  2070.             Tab.BackColor = TabColor
  2071.         Next
  2072.     End Sub
  2073.  
  2074. #End Region
  2075.  
  2076. End Class
  2077.  
  2078. #End Region
  2079.  
  2080. #Region " RichTextBox "
  2081.  
  2082. <DefaultEvent("TextChanged")> Public Class ModalRichTextbox : Inherits Control
  2083.  
  2084. #Region " Variables "
  2085.  
  2086.     Private WithEvents T As New RichTextBox
  2087.     Private _ReadOnly As Boolean = False
  2088.     Private _SideImage As Image
  2089.     Private TBC = GetHTMLColor("291a2a")
  2090.     Private TFC = GetHTMLColor("a89ea9")
  2091.     Private State As MouseMode = MouseMode.NormalMode
  2092.     Private _WordWrap As Boolean
  2093.     Private _AutoWordSelection As Boolean
  2094.  
  2095. #End Region
  2096.  
  2097. #Region " Native Methods "
  2098.  
  2099.     Private Declare Auto Function SendMessage Lib "user32.dll" (hWnd As IntPtr, msg As Integer, wParam As Integer, <System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr)> lParam As String) As Int32
  2100.  
  2101. #End Region
  2102.  
  2103. #Region " Properties "
  2104.  
  2105.     <Browsable(False), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
  2106.     ReadOnly Property BorderStyle As BorderStyle
  2107.         Get
  2108.             Return BorderStyle.None
  2109.         End Get
  2110.     End Property
  2111.  
  2112.     <Browsable(False), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
  2113.     Public Overridable Shadows ReadOnly Property ForeColor As Color
  2114.         Get
  2115.             Return Color.Transparent
  2116.         End Get
  2117.     End Property
  2118.  
  2119.     <Browsable(False), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
  2120.     Public Overridable Shadows ReadOnly Property BackColor As Color
  2121.         Get
  2122.             Return Color.Transparent
  2123.         End Get
  2124.     End Property
  2125.  
  2126.     <Browsable(False), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
  2127.     Public Overridable Shadows ReadOnly Property BackgroungImage As Image()
  2128.         Get
  2129.             Return Nothing
  2130.         End Get
  2131.     End Property
  2132.  
  2133.     Public Overridable Shadows Property [ReadOnly]() As Boolean
  2134.         Get
  2135.             Return _ReadOnly
  2136.         End Get
  2137.         Set(ByVal value As Boolean)
  2138.             _ReadOnly = value
  2139.             If T IsNot Nothing Then
  2140.                 T.ReadOnly = value
  2141.             End If
  2142.         End Set
  2143.     End Property
  2144.  
  2145.     <Browsable(False), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
  2146.     Public Overridable Shadows ReadOnly Property Multiline() As Boolean
  2147.         Get
  2148.             Return True
  2149.         End Get
  2150.     End Property
  2151.  
  2152.     Public Overridable Shadows Property Text As String
  2153.         Get
  2154.             Return MyBase.Text
  2155.         End Get
  2156.         Set(ByVal value As String)
  2157.             MyBase.Text = value
  2158.             If T IsNot Nothing Then
  2159.                 T.Text = value
  2160.             End If
  2161.         End Set
  2162.     End Property
  2163.  
  2164.     Public Property WordWrap() As Boolean
  2165.         Get
  2166.             Return _WordWrap
  2167.         End Get
  2168.         Set(ByVal value As Boolean)
  2169.             _WordWrap = value
  2170.             If T IsNot Nothing Then
  2171.                 T.WordWrap = value
  2172.             End If
  2173.         End Set
  2174.     End Property
  2175.  
  2176.     Public Property AutoWordSelection() As Boolean
  2177.         Get
  2178.             Return _AutoWordSelection
  2179.         End Get
  2180.         Set(ByVal value As Boolean)
  2181.             _AutoWordSelection = value
  2182.             If T IsNot Nothing Then
  2183.                 T.AutoWordSelection = value
  2184.             End If
  2185.         End Set
  2186.     End Property
  2187.  
  2188. #End Region
  2189.  
  2190. #Region " Initilization "
  2191.  
  2192.     Sub New()
  2193.         SetStyle(ControlStyles.UserPaint Or _
  2194.                   ControlStyles.OptimizedDoubleBuffer Or _
  2195.                   ControlStyles.SupportsTransparentBackColor, True)
  2196.         DoubleBuffered = True
  2197.         WordWrap = True
  2198.         AutoWordSelection = False
  2199.         Font = New Font("Ubuntu", 10, FontStyle.Regular)
  2200.         With T
  2201.             .Size = New Size(Width, Height)
  2202.             .Multiline = True
  2203.             .Cursor = Cursors.IBeam
  2204.             .BackColor = TBC
  2205.             .ForeColor = TFC
  2206.             .BorderStyle = BorderStyle.None
  2207.             .Location = New Point(7, 5)
  2208.             .Font = Font
  2209.         End With
  2210.         UpdateStyles()
  2211.     End Sub
  2212.  
  2213. #End Region
  2214.  
  2215. #Region " Events "
  2216.  
  2217.     Private Sub T_TextChanged(ByVal sender As Object, ByVal e As EventArgs) Handles T.TextChanged
  2218.         Text = T.Text
  2219.     End Sub
  2220.  
  2221.     Private Sub T_KeyDown(ByVal sender As Object, ByVal e As KeyEventArgs) Handles T.KeyDown
  2222.         If e.Control AndAlso e.KeyCode = Keys.A Then e.SuppressKeyPress = True
  2223.         If e.Control AndAlso e.KeyCode = Keys.C Then
  2224.             T.Copy()
  2225.             e.SuppressKeyPress = True
  2226.         End If
  2227.     End Sub
  2228.  
  2229.     Protected NotOverridable Overrides Sub OnCreateControl()
  2230.         MyBase.OnCreateControl()
  2231.         If Not Controls.Contains(T) Then Controls.Add(T)
  2232.     End Sub
  2233.  
  2234.     Private Sub T_MouseHover(ByVal sender As Object, e As EventArgs) Handles T.MouseHover
  2235.         State = MouseMode.Hovered
  2236.         Invalidate()
  2237.     End Sub
  2238.  
  2239.     Private Sub T_MouseLeave(ByVal sender As Object, e As EventArgs) Handles T.MouseLeave
  2240.         State = MouseMode.NormalMode
  2241.         Invalidate()
  2242.     End Sub
  2243.  
  2244.     Private Sub T_MouseUp(ByVal sender As Object, e As MouseEventArgs) Handles T.MouseUp
  2245.         State = MouseMode.NormalMode
  2246.         Invalidate()
  2247.     End Sub
  2248.  
  2249.     Private Sub T_MouseEnter(ByVal sender As Object, e As EventArgs) Handles T.MouseEnter
  2250.         State = MouseMode.NormalMode
  2251.         Invalidate()
  2252.     End Sub
  2253.  
  2254.     Private Sub T_MouseDown(ByVal sender As Object, e As EventArgs) Handles T.MouseDown
  2255.         State = MouseMode.Pushed
  2256.         Invalidate()
  2257.     End Sub
  2258.  
  2259.     Protected Overrides Sub OnFontChanged(ByVal e As System.EventArgs)
  2260.         MyBase.OnFontChanged(e)
  2261.         T.Font = Font
  2262.     End Sub
  2263.  
  2264.     Protected Overrides Sub OnSizeChanged(ByVal e As System.EventArgs)
  2265.         MyBase.OnSizeChanged(e)
  2266.         T.Size = New Size(Width - 10, Height - 5)
  2267.     End Sub
  2268.  
  2269. #End Region
  2270.  
  2271. #Region " Draw Control "
  2272.  
  2273.     Protected NotOverridable Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  2274.         Using B As New Bitmap(Width, Height), G As Graphics = Graphics.FromImage(B)
  2275.             Dim Rect As New Rectangle(0, 0, Width - 1, Height - 1)
  2276.  
  2277.             With G
  2278.  
  2279.                 .TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
  2280.  
  2281.                 .FillRectangle(SolidBrushHTMlColor("291a2a"), Rect)
  2282.                 .DrawRectangle(PenHTMlColor("231625", 1), Rect)
  2283.  
  2284.                 If ContextMenuStrip IsNot Nothing Then T.ContextMenuStrip = ContextMenuStrip
  2285.  
  2286.             End With
  2287.  
  2288.             e.Graphics.DrawImage(B.Clone(), 0, 0)
  2289.             G.Dispose() : B.Dispose()
  2290.  
  2291.         End Using
  2292.     End Sub
  2293.  
  2294. #End Region
  2295.  
  2296. End Class
  2297.  
  2298. #End Region
  2299.  
  2300. #Region " Switch "
  2301.  
  2302. <DefaultEvent("Switch")> Public Class ModalSwitch : Inherits Control
  2303.  
  2304. #Region " Variables "
  2305.  
  2306.     Private _Switched As Boolean = False
  2307.  
  2308. #End Region
  2309.  
  2310. #Region " Properties "
  2311.  
  2312.     Public Property Switched() As Boolean
  2313.         Get
  2314.             Return _Switched
  2315.         End Get
  2316.         Set(ByVal value As Boolean)
  2317.             _Switched = value
  2318.             Invalidate()
  2319.         End Set
  2320.     End Property
  2321.  
  2322. #End Region
  2323.  
  2324. #Region " Constructors "
  2325.  
  2326.     Sub New()
  2327.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or _
  2328.                     ControlStyles.OptimizedDoubleBuffer Or ControlStyles.SupportsTransparentBackColor, True)
  2329.         DoubleBuffered = True
  2330.         BackColor = Color.Transparent
  2331.         Cursor = Cursors.Hand
  2332.         Font = New Font("Ubuntu", 10, FontStyle.Regular)
  2333.         Size = New Size(70, 28)
  2334.     End Sub
  2335.  
  2336. #End Region
  2337.  
  2338. #Region " Draw Control "
  2339.  
  2340.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  2341.  
  2342.         Using B As New Bitmap(Width, Height), G As Graphics = Graphics.FromImage(B)
  2343.  
  2344.             With G
  2345.  
  2346.                 .TextRenderingHint = Drawing.Text.TextRenderingHint.ClearTypeGridFit
  2347.                 If Switched Then
  2348.  
  2349.                     .FillRectangle(New SolidBrush(Color.FromArgb(130, GetHTMLColor("5b2960"))), New Rectangle(0, 0, 70, 27))
  2350.  
  2351.                     .FillRectangle(SolidBrushHTMlColor("291a2a"), New Rectangle(Width - 28.5, 1.5, 25, 23))
  2352.                     .DrawRectangle(PenHTMlColor("231625", 1), New Rectangle(Width - 28.5, 1.5, 25, 23))
  2353.                     .DrawLine(PenHTMlColor("5b2960", 1), Width - 13, 8, Width - 13, 18)
  2354.                     .DrawLine(PenHTMlColor("5b2960", 1), Width - 16, 7, Width - 16, 19)
  2355.                     .DrawLine(PenHTMlColor("5b2960", 1), Width - 19, 8, Width - 19, 18)
  2356.  
  2357.                     .DrawString("ON", Font, Brushes.Silver, New Point(Width - 62, 5))
  2358.                 Else
  2359.  
  2360.                     .FillRectangle(SolidBrushHTMlColor("291a2a"), New Rectangle(0, 0, 70, 27))
  2361.  
  2362.                     .FillRectangle(New SolidBrush(Color.FromArgb(130, GetHTMLColor("5b2960"))), New Rectangle(3, 1.5, 25, 23))
  2363.                     .DrawRectangle(PenHTMlColor("231625", 1), New Rectangle(3, 1.5, 25, 23))
  2364.  
  2365.                     .DrawLine(PenHTMlColor("231625", 1), 12, 8, 12, 18)
  2366.                     .DrawLine(PenHTMlColor("231625", 1), 15, 7, 15, 19)
  2367.                     .DrawLine(PenHTMlColor("231625", 1), 18, 8, 18, 18)
  2368.  
  2369.                     .DrawString("OFF", Font, SolidBrushHTMlColor("a89ea9"), New Point(33, 5))
  2370.  
  2371.                 End If
  2372.                 .DrawRectangle(PenHTMlColor("231625", 1), New Rectangle(0, 0, 69, 27))
  2373.             End With
  2374.  
  2375.             e.Graphics.DrawImage(B.Clone(), 0, 0)
  2376.             G.Dispose() : B.Dispose()
  2377.  
  2378.         End Using
  2379.  
  2380.     End Sub
  2381.  
  2382. #End Region
  2383.  
  2384. #Region " Events "
  2385.  
  2386.     Event Switch(ByVal sender As Object)
  2387.     Protected Overrides Sub OnClick(ByVal e As EventArgs)
  2388.         _Switched = Not _Switched
  2389.         RaiseEvent Switch(Me)
  2390.         MyBase.OnClick(e)
  2391.         Invalidate()
  2392.     End Sub
  2393.  
  2394.     Protected Overrides Sub OnResize(ByVal e As EventArgs)
  2395.         MyBase.OnResize(e)
  2396.         Size = New Size(70, 28)
  2397.     End Sub
  2398.  
  2399. #End Region
  2400.  
  2401. End Class
  2402.  
  2403. #End Region
  2404.  
  2405. #Region " ContextMenuStrip "
  2406.  
  2407. Public Class ModalContextMenuStrip : Inherits ContextMenuStrip
  2408.  
  2409. #Region " Variables "
  2410.  
  2411.     Private ClickedEventArgs As ToolStripItemClickedEventArgs
  2412.  
  2413. #End Region
  2414.  
  2415. #Region " Constructors "
  2416.  
  2417.     Public Sub New()
  2418.         Renderer = New ModalToolStripRender()
  2419.         BackColor = GetHTMLColor("291a2a")
  2420.     End Sub
  2421.  
  2422. #End Region
  2423.  
  2424. #Region " Events "
  2425.  
  2426.     Event Clicked(ByVal sender As Object)
  2427.  
  2428.     Protected Overrides Sub OnItemClicked(e As ToolStripItemClickedEventArgs)
  2429.         If Not e.ClickedItem Is Nothing AndAlso Not (TypeOf e.ClickedItem Is ToolStripSeparator) Then
  2430.             If e Is ClickedEventArgs Then OnItemClicked(e) Else ClickedEventArgs = e : RaiseEvent Clicked(Me)
  2431.         End If
  2432.     End Sub
  2433.  
  2434.     Protected Overrides Sub OnMouseHover(e As EventArgs)
  2435.         MyBase.OnMouseHover(e)
  2436.         Cursor = Cursors.Hand
  2437.         Invalidate()
  2438.     End Sub
  2439.  
  2440.     Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
  2441.         MyBase.OnMouseUp(e)
  2442.         Cursor = Cursors.Hand
  2443.         Invalidate()
  2444.     End Sub
  2445.  
  2446. #End Region
  2447.  
  2448.     NotInheritable Class ModalToolStripMenuItem : Inherits ToolStripMenuItem
  2449.  
  2450. #Region " Constructors "
  2451.  
  2452.         Public Sub New()
  2453.             AutoSize = False
  2454.             Size = New Size(160, 30)
  2455.         End Sub
  2456.  
  2457. #End Region
  2458.  
  2459. #Region " Adding DropDowns "
  2460.  
  2461.         Protected Overrides Function CreateDefaultDropDown() As ToolStripDropDown
  2462.             If DesignMode Then Return MyBase.CreateDefaultDropDown()
  2463.             Dim DP = New ModalContextMenuStrip()
  2464.             DP.Items.AddRange(MyBase.CreateDefaultDropDown().Items)
  2465.             Return DP
  2466.         End Function
  2467.  
  2468. #End Region
  2469.  
  2470.     End Class
  2471.  
  2472.     NotInheritable Class ModalToolStripRender : Inherits ToolStripProfessionalRenderer
  2473.  
  2474. #Region " Drawing Text "
  2475.  
  2476.         Protected Overrides Sub OnRenderItemText(e As ToolStripItemTextRenderEventArgs)
  2477.             With e.Graphics
  2478.                 .TextRenderingHint = Drawing.Text.TextRenderingHint.ClearTypeGridFit
  2479.                 Dim textRect = New Rectangle(25, e.Item.ContentRectangle.Y, e.Item.ContentRectangle.Width - (24 + 16), e.Item.ContentRectangle.Height - 4)
  2480.                 Using F As New Font("Ubuntu", 11, FontStyle.Regular), B As Brush = If(e.Item.Enabled, SolidBrushHTMlColor("a89ea9"), New SolidBrush(Color.FromArgb(70, GetHTMLColor("5b2960")))), St As New StringFormat() With {.LineAlignment = StringAlignment.Center}
  2481.                     .DrawString(e.Text, F, B, textRect)
  2482.                 End Using
  2483.             End With
  2484.         End Sub
  2485.  
  2486. #End Region
  2487.  
  2488. #Region " Drawing Backgrounds "
  2489.  
  2490.         Protected Overrides Sub OnRenderToolStripBackground(e As ToolStripRenderEventArgs)
  2491.             MyBase.OnRenderToolStripBackground(e)
  2492.             With e.Graphics
  2493.                 .SmoothingMode = SmoothingMode.AntiAlias
  2494.                 .InterpolationMode = InterpolationMode.High
  2495.                 .Clear(GetHTMLColor("291a2a"))
  2496.             End With
  2497.         End Sub
  2498.  
  2499.         Protected Overrides Sub OnRenderMenuItemBackground(e As ToolStripItemRenderEventArgs)
  2500.             With e.Graphics
  2501.                 .InterpolationMode = InterpolationMode.High
  2502.                 .Clear(GetHTMLColor("291a2a"))
  2503.                 Dim R As New Rectangle(0, e.Item.ContentRectangle.Y - 2, e.Item.ContentRectangle.Width + 4, e.Item.ContentRectangle.Height + 3)
  2504.  
  2505.                 .FillRectangle(If(e.Item.Selected AndAlso e.Item.Enabled, New SolidBrush(Color.FromArgb(130, GetHTMLColor("5b2960"))), SolidBrushHTMlColor("291a2a")), R)
  2506.  
  2507.             End With
  2508.         End Sub
  2509.  
  2510. #End Region
  2511.  
  2512. #Region " Set Image Margin "
  2513.  
  2514.         Protected Overrides Sub OnRenderImageMargin(e As ToolStripRenderEventArgs)
  2515.             'MyBase.OnRenderImageMargin(e)
  2516.             'I Make above line comment which makes users to be able to add images to ToolStrips
  2517.         End Sub
  2518.  
  2519. #End Region
  2520.  
  2521. #Region " Drawing Seperators & Borders "
  2522.  
  2523.         Protected Overrides Sub OnRenderSeparator(e As ToolStripSeparatorRenderEventArgs)
  2524.             With e.Graphics
  2525.                 .SmoothingMode = SmoothingMode.AntiAlias
  2526.                 .DrawLine(New Pen(Color.FromArgb(200, GetHTMLColor("231625")), 1), New Point(e.Item.Bounds.Left, e.Item.Bounds.Height / 2), New Point(e.Item.Bounds.Right - 5, e.Item.Bounds.Height / 2))
  2527.             End With
  2528.         End Sub
  2529.  
  2530.         Protected Overrides Sub OnRenderToolStripBorder(e As ToolStripRenderEventArgs)
  2531.             With e.Graphics
  2532.                 .InterpolationMode = InterpolationMode.High
  2533.                 .SmoothingMode = SmoothingMode.AntiAlias
  2534.                 DrawRoundedPath(e.Graphics, GetHTMLColor("231625"), 1, New Rectangle(e.AffectedBounds.X, e.AffectedBounds.Y, e.AffectedBounds.Width - 1, e.AffectedBounds.Height - 1), 4)
  2535.             End With
  2536.         End Sub
  2537.  
  2538. #End Region
  2539.  
  2540. #Region " Drawing DropDown Arrows "
  2541.  
  2542.         Protected Overrides Sub OnRenderArrow(e As ToolStripArrowRenderEventArgs)
  2543.             With e.Graphics
  2544.                 Dim ArrowX, ArrowY As Integer
  2545.                 ArrowX = e.ArrowRectangle.X + e.ArrowRectangle.Width / 2
  2546.                 ArrowY = e.ArrowRectangle.Y + e.ArrowRectangle.Height / 2
  2547.                 Dim ArrowPoints As Point() = New Point() {New Point(ArrowX - 5, ArrowY - 5), New Point(ArrowX, ArrowY), New Point(ArrowX - 5, ArrowY + 5)}
  2548.                 If e.Item.Enabled Then
  2549.                     .FillPolygon(New SolidBrush(Color.FromArgb(130, GetHTMLColor("5b2960"))), ArrowPoints)
  2550.                 Else
  2551.                     .FillPolygon(New SolidBrush(Color.FromArgb(40, GetHTMLColor("5b2960"))), ArrowPoints)
  2552.                 End If
  2553.             End With
  2554.         End Sub
  2555.  
  2556. #End Region
  2557.  
  2558.     End Class
  2559.  
  2560. End Class
  2561.  
  2562. #End Region
  2563.  
  2564. #Region " Numerical UP & Down "
  2565.  
  2566. Public Class ModalNumericUpDown : Inherits Control
  2567.  
  2568. #Region " Variables "
  2569.  
  2570.     Private X, Y, _Value, _Maximum, _Minimum As Integer
  2571.  
  2572. #End Region
  2573.  
  2574. #Region " Properties "
  2575.  
  2576.     Public Property Value() As Long
  2577.         Get
  2578.             Return _Value
  2579.         End Get
  2580.         Set(value As Long)
  2581.             If value <= Maximum And value >= Minimum Then _Value = value
  2582.             Invalidate()
  2583.         End Set
  2584.  
  2585.     End Property
  2586.  
  2587.     Public Property Maximum() As Integer
  2588.         Get
  2589.             Return _Maximum
  2590.         End Get
  2591.         Set(ByVal value As Integer)
  2592.             If value > Minimum Then _Maximum = value
  2593.             If value > _Maximum Then value = _Maximum
  2594.             Invalidate()
  2595.         End Set
  2596.     End Property
  2597.  
  2598.     Public Property Minimum() As Integer
  2599.         Get
  2600.             Return _Minimum
  2601.         End Get
  2602.         Set(ByVal value As Integer)
  2603.             If value < Maximum Then _Minimum = value
  2604.             If value < _Minimum Then value = _Minimum
  2605.             Invalidate()
  2606.         End Set
  2607.     End Property
  2608.  
  2609. #End Region
  2610.  
  2611. #Region " Constructors "
  2612.  
  2613.     Sub New()
  2614.         SetStyle(ControlStyles.UserPaint Or ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.SupportsTransparentBackColor, True)
  2615.         DoubleBuffered = True
  2616.         BackColor = Color.Transparent
  2617.         Font = New Font("Ubuntu", 10, FontStyle.Regular)
  2618.     End Sub
  2619.  
  2620. #End Region
  2621.  
  2622. #Region " Draw Control "
  2623.  
  2624.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  2625.  
  2626.         Using B As New Bitmap(Width, Height), G As Graphics = Graphics.FromImage(B)
  2627.  
  2628.             With G
  2629.  
  2630.                 .SmoothingMode = SmoothingMode.AntiAlias
  2631.                 .TextRenderingHint = Drawing.Text.TextRenderingHint.ClearTypeGridFit
  2632.  
  2633.                 Dim Rect As New Rectangle(1, 1, Width - 2, Height - 2)
  2634.  
  2635.                 .FillRectangle(SolidBrushHTMlColor("291a2a"), Rect)
  2636.  
  2637.                 G.FillPath(New SolidBrush(Color.FromArgb(130, GetHTMLColor("5b2960"))), RoundRec(New Rectangle(Width - 25, 0.6, 23, Height - 2.6), 2))
  2638.                 .DrawLine(PenHTMlColor("231625", 1), New Point(Width - 25, 1), New Point(Width - 25, Height - 2))
  2639.                 .DrawRectangle(PenHTMlColor("231625", 1), Rect)
  2640.  
  2641.                 Using AboveWardTriangle As New GraphicsPath
  2642.                     AboveWardTriangle.AddLine(Width - 17, 12, Width - 2, 12)
  2643.                     AboveWardTriangle.AddLine(Width - 9, 12, Width - 13, CInt(4.7))
  2644.                     AboveWardTriangle.CloseFigure()
  2645.                     G.FillPath(SolidBrushHTMlColor("291a2a"), AboveWardTriangle)
  2646.                 End Using
  2647.  
  2648.                 Using DownWardTriangle As New GraphicsPath
  2649.                     DownWardTriangle.AddLine(Width - 17, 15, Width - 2, 15)
  2650.                     DownWardTriangle.AddLine(Width - 9, 15, Width - 13, 22)
  2651.                     DownWardTriangle.CloseFigure()
  2652.                     G.FillPath(SolidBrushHTMlColor("291a2a"), DownWardTriangle)
  2653.                 End Using
  2654.  
  2655.                 CentreString(G, Value, Font, SolidBrushHTMlColor("a89ea9"), New Rectangle(0, 0, Width - 18, Height - 1))
  2656.  
  2657.             End With
  2658.  
  2659.             e.Graphics.DrawImage(B.Clone, 0, 0)
  2660.             G.Dispose() : B.Dispose()
  2661.  
  2662.         End Using
  2663.  
  2664.     End Sub
  2665.  
  2666. #End Region
  2667.  
  2668. #Region " Events "
  2669.  
  2670.     Protected Overrides Sub OnCreateControl()
  2671.         MyBase.OnCreateControl()
  2672.         Maximum = Integer.MaxValue
  2673.         Minimum = 0
  2674.     End Sub
  2675.  
  2676.     Protected Overrides Sub OnMouseMove(ByVal e As System.Windows.Forms.MouseEventArgs)
  2677.         MyBase.OnMouseMove(e)
  2678.         X = e.Location.X
  2679.         Y = e.Location.Y
  2680.         Invalidate()
  2681.         If e.X < Width - 23 Then Cursor = Cursors.IBeam Else Cursor = Cursors.Hand
  2682.     End Sub
  2683.  
  2684.     Protected Overrides Sub OnResize(ByVal e As System.EventArgs)
  2685.         MyBase.OnResize(e)
  2686.         Me.Height = 26
  2687.     End Sub
  2688.  
  2689.     Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  2690.         MyBase.OnMouseClick(e)
  2691.         If X > Width - 17 AndAlso X < Width - 3 Then
  2692.             If Y < 13 Then
  2693.                 If (Value + 1) <= Maximum Then Value += 1
  2694.             Else
  2695.                 If (Value - 1) >= Minimum Then Value -= 1
  2696.             End If
  2697.         End If
  2698.         Invalidate()
  2699.     End Sub
  2700.  
  2701. #End Region
  2702.  
  2703. End Class
  2704.  
  2705.  
  2706. #End Region
  2707.  
  2708. #Region "ListBox"
  2709.  
  2710. Public Class ModalListBox : Inherits Control
  2711.  
  2712. #Region "Variables"
  2713.  
  2714.     Private WithEvents LB As New ListBox()
  2715.     Private _Items As String() = New String() {String.Empty}
  2716.  
  2717. #End Region
  2718.  
  2719. #Region "Properties"
  2720.  
  2721.     Public Property Items() As String()
  2722.         Get
  2723.             Return _Items
  2724.         End Get
  2725.         Set(value As String())
  2726.             _Items = value
  2727.             LB.Items.Clear()
  2728.             LB.Items.AddRange(value)
  2729.             Invalidate()
  2730.         End Set
  2731.     End Property
  2732.  
  2733.     Public ReadOnly Property SelectedItem() As String
  2734.         Get
  2735.             Return LB.SelectedItem
  2736.         End Get
  2737.     End Property
  2738.  
  2739.     Public ReadOnly Property SelectedIndex() As Integer
  2740.         Get
  2741.             If LB.SelectedIndex < 0 Then
  2742.                 Return 0
  2743.             Else
  2744.                 Return LB.SelectedIndex
  2745.             End If
  2746.         End Get
  2747.     End Property
  2748.  
  2749.     Public Sub Clear()
  2750.         LB.Items.Clear()
  2751.     End Sub
  2752.  
  2753. #End Region
  2754.  
  2755. #Region "Events"
  2756.  
  2757.     Public Sub ClearSelected()
  2758.         Dim i As Integer = (LB.SelectedItems.Count - 1)
  2759.         While i >= 0
  2760.             LB.Items.Remove(LB.SelectedItems(i))
  2761.             i += -1
  2762.         End While
  2763.     End Sub
  2764.  
  2765.     Protected Overrides Sub OnCreateControl()
  2766.         MyBase.OnCreateControl()
  2767.         With LB
  2768.             .DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed
  2769.             .ScrollAlwaysVisible = False
  2770.             .HorizontalScrollbar = False
  2771.             .BorderStyle = BorderStyle.None
  2772.             .ItemHeight = 20
  2773.             .IntegralHeight = False
  2774.         End With
  2775.         If Not Controls.Contains(LB) Then Controls.Add(LB)
  2776.  
  2777.     End Sub
  2778.  
  2779.     Public Sub AddRange(items As Object())
  2780.         With LB
  2781.             .Items.Remove(String.Empty)
  2782.             .Items.AddRange(items)
  2783.         End With
  2784.     End Sub
  2785.  
  2786.     Public Sub AddItem(item As Object)
  2787.         With LB
  2788.             .Items.Remove(String.Empty)
  2789.             .Items.Add(item)
  2790.         End With
  2791.     End Sub
  2792.  
  2793.     Private Sub LB_SelectIndexChanged(sender As Object, e As EventArgs) Handles LB.SelectedIndexChanged
  2794.         LB.Invalidate()
  2795.     End Sub
  2796.  
  2797. #End Region
  2798.  
  2799. #Region "Constructors"
  2800.  
  2801.     Public Sub New()
  2802.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.SupportsTransparentBackColor, True)
  2803.         DoubleBuffered = True
  2804.         Font = New Font("Ubuntu", 10, FontStyle.Regular)
  2805.         BackColor = Color.Transparent
  2806.         With LB
  2807.             .BackColor = GetHTMLColor("291a2a")
  2808.             .ForeColor = GetHTMLColor("a89ea9")
  2809.             .Location = New Point(2, 2)
  2810.             .Font = Font
  2811.             .Items.Clear()
  2812.         End With
  2813.         Size = New Size(130, 100)
  2814.     End Sub
  2815.  
  2816. #End Region
  2817.  
  2818. #Region "Draw Control"
  2819.  
  2820.     Protected Sub OnDrawItem(sender As Object, e As DrawItemEventArgs) Handles LB.DrawItem
  2821.         'e.DrawBackground();
  2822.  
  2823.         Using B As New Bitmap(Width, Height)
  2824.             Using G As Graphics = Graphics.FromImage(B)
  2825.                 G.SmoothingMode = SmoothingMode.HighQuality
  2826.                 G.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit
  2827.  
  2828.                 If e.Index < 0 Or Items.Length < 1 Then
  2829.                     Return
  2830.                 End If
  2831.  
  2832.  
  2833.                 Dim MainRect As New Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width + 2, e.Bounds.Height - 1)
  2834.                 Dim ItemRect As New Rectangle(e.Bounds.X - 1, e.Bounds.Y + 4, e.Bounds.Width, e.Bounds.Height + 2)
  2835.  
  2836.                 G.FillRectangle(SolidBrushHTMlColor("291a2a"), ItemRect)
  2837.  
  2838.  
  2839.                 If e.State > 0 Then
  2840.                     G.FillRectangle(New SolidBrush(Color.FromArgb(130, GetHTMLColor("5b2960"))), ItemRect)
  2841.                     G.DrawRectangle(PenHTMlColor("231625", 1), ItemRect)
  2842.                     G.DrawString(Items(e.Index).ToString(), Font, SolidBrushHTMlColor("a89ea9"), 3, e.Bounds.Y + 4)
  2843.                 Else
  2844.                     G.DrawString(Items(e.Index).ToString(), Font, SolidBrushHTMlColor("a89ea9"), 3, e.Bounds.Y + 4)
  2845.                 End If
  2846.  
  2847.  
  2848.                 e.Graphics.DrawImage(B, 0, 0)
  2849.                 G.Dispose()
  2850.  
  2851.                 B.Dispose()
  2852.             End Using
  2853.         End Using
  2854.  
  2855.     End Sub
  2856.  
  2857.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  2858.         Using B As New Bitmap(Width, Height)
  2859.             Using G As Graphics = Graphics.FromImage(B)
  2860.  
  2861.                 G.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit
  2862.  
  2863.                 Dim MainRect As New Rectangle(0, 0, Width - 1, Height - 1)
  2864.  
  2865.                 LB.Size = New Size(Width - 6, Height - 5)
  2866.                 G.FillRectangle(SolidBrushHTMlColor("291a2a"), MainRect)
  2867.                 G.DrawRectangle(PenHTMlColor("231625", 1), MainRect)
  2868.  
  2869.  
  2870.                 e.Graphics.DrawImage(B, 0, 0)
  2871.                 G.Dispose()
  2872.  
  2873.                 B.Dispose()
  2874.             End Using
  2875.         End Using
  2876.     End Sub
  2877.  
  2878. #End Region
  2879.  
  2880. End Class
  2881.  
  2882. #End Region
Add Comment
Please, Sign In to add comment