Advertisement
Guest User

Dark Hura Theme

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