Advertisement
Guest User

Hurrycan theme

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