THE_LORD

Ethereal Theme

Dec 26th, 2016
1,272
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 63.65 KB | None | 0 0
  1. '' <summary>
  2. '' Ethereal Theme
  3. '' Author : THE LORD
  4. '' Credits : Aeonhack(Round Rectangle Function)
  5. '' Credits : Mavamaarten(TabPage Mouse Hover & Mouse Leave Event)
  6. '' Release Date : Tuesday, December 27, 2016
  7. '' Last Update : Monday, January 9, 2017
  8. '' Update Purpose : Customizable Colors
  9. '' </summary>
  10.  
  11. #Region " Namespaces "
  12.  
  13. Imports System.Drawing.Drawing2D
  14. Imports System.ComponentModel
  15.  
  16. #End Region
  17.  
  18. #Region " Helper Methods "
  19.  
  20. Public Module HelperMethods
  21.  
  22.     Public GP As GraphicsPath
  23.  
  24.     Public Enum MouseMode As Byte
  25.         NormalMode
  26.         Hovered
  27.         Pushed
  28.     End Enum
  29.  
  30.     Public Sub DrawImageFromBase64(ByVal G As Graphics, ByVal Base64Image As String, ByVal Rect As Rectangle)
  31.         Dim IM As Image = Nothing
  32.         With G
  33.             Using ms As New System.IO.MemoryStream(Convert.FromBase64String(Base64Image))
  34.                 IM = Image.FromStream(ms) : ms.Close()
  35.             End Using
  36.             .DrawImage(IM, Rect)
  37.         End With
  38.     End Sub
  39.  
  40.     Function RoundRec(ByVal r As Rectangle, ByVal Curve As Integer) As GraphicsPath
  41.         Dim CreateRoundPath As New GraphicsPath(FillMode.Winding)
  42.         CreateRoundPath.AddArc(r.X, r.Y, Curve, Curve, 180.0F, 90.0F)
  43.         CreateRoundPath.AddArc(r.Right - Curve, r.Y, Curve, Curve, 270.0F, 90.0F)
  44.         CreateRoundPath.AddArc(r.Right - Curve, r.Bottom - Curve, Curve, Curve, 0.0F, 90.0F)
  45.         CreateRoundPath.AddArc(r.X, r.Bottom - Curve, Curve, Curve, 90.0F, 90.0F)
  46.         CreateRoundPath.CloseFigure()
  47.         Return CreateRoundPath
  48.     End Function
  49.  
  50.     Public Sub FillRoundedPath(ByVal G As Graphics, ByVal C As Color, ByVal Rect As Rectangle, ByVal Curve As Integer)
  51.         With G
  52.             .FillPath(New SolidBrush(C), RoundRec(Rect, Curve))
  53.         End With
  54.     End Sub
  55.  
  56.     Public Sub FillRoundedPath(ByVal G As Graphics, ByVal B As Brush, ByVal Rect As Rectangle, ByVal Curve As Integer)
  57.         With G
  58.             .FillPath(B, RoundRec(Rect, Curve))
  59.         End With
  60.     End Sub
  61.  
  62.     Public Sub DrawRoundedPath(ByVal G As Graphics, ByVal C As Color, ByVal Size As Single, ByVal Rect As Rectangle, ByVal Curve As Integer)
  63.         With G
  64.             .DrawPath(New Pen(C, Size), RoundRec(Rect, Curve))
  65.         End With
  66.     End Sub
  67.  
  68.     Public Sub DrawTriangle(ByVal G As Graphics, ByVal C As Color, ByVal Size As Integer, ByVal P1_0 As Point, ByVal P1_1 As Point, ByVal P2_0 As Point, ByVal P2_1 As Point, ByVal P3_0 As Point, ByVal P3_1 As Point)
  69.         With G
  70.             .DrawLine(New Pen(C, Size), P1_0, P1_1)
  71.             .DrawLine(New Pen(C, Size), P2_0, P2_1)
  72.             .DrawLine(New Pen(C, Size), P3_0, P3_1)
  73.         End With
  74.     End Sub
  75.  
  76.     Public Function PenRGBColor(ByVal GR As Graphics, ByVal R As Integer, ByVal G As Integer, ByVal B As Integer, ByVal Size As Single) As Pen
  77.         Return New Pen(Color.FromArgb(R, G, B), Size)
  78.     End Function
  79.  
  80.     Public Function PenHTMlColor(ByVal C_WithoutHash As String, ByVal Size As Single) As Pen
  81.         Return New Pen(GetHTMLColor(C_WithoutHash), Size)
  82.     End Function
  83.  
  84.     Public Function SolidBrushRGBColor(ByVal R As Integer, ByVal G As Integer, ByVal B As Integer) As SolidBrush
  85.         Return New SolidBrush(Color.FromArgb(R, G, B))
  86.     End Function
  87.  
  88.     Public Function SolidBrushHTMlColor(ByVal C_WithoutHash As String) As SolidBrush
  89.         Return New SolidBrush(GetHTMLColor(C_WithoutHash))
  90.     End Function
  91.  
  92.     Public Function GetHTMLColor(ByVal C_WithoutHash As String) As Color
  93.         Return ColorTranslator.FromHtml("#" & C_WithoutHash)
  94.     End Function
  95.  
  96.     Public Function ColorToHTML(ByVal C As Color) As String
  97.         Return ColorTranslator.ToHtml(C)
  98.     End Function
  99.  
  100.     Public Function SetARGB(ByVal A As Integer, ByVal R As Integer, ByVal G As Integer, ByVal B As Integer) As Color
  101.         Return Color.FromArgb(A, R, G, B)
  102.     End Function
  103.  
  104.     Public Function SetRGB(ByVal R As Integer, ByVal G As Integer, ByVal B As Integer) As Color
  105.         Return Color.FromArgb(R, G, B)
  106.     End Function
  107.  
  108.     Public Sub CentreString(ByVal G As Graphics, ByVal Text As String, ByVal font As Font, ByVal brush As Brush, ByVal Rect As Rectangle)
  109.         G.DrawString(Text, font, brush, New Rectangle(0, Rect.Y + (Rect.Height / 2) - (G.MeasureString(Text, font).Height / 2) + 0, Rect.Width, Rect.Height), New StringFormat With {.Alignment = StringAlignment.Center})
  110.     End Sub
  111.  
  112.     Public Sub LeftString(ByVal G As Graphics, ByVal Text As String, ByVal font As Font, ByVal brush As Brush, ByVal Rect As Rectangle)
  113.         G.DrawString(Text, font, brush, New Rectangle(4, Rect.Y + (Rect.Height / 2) - (G.MeasureString(Text, font).Height / 2) + 0, Rect.Width, Rect.Height), New StringFormat With {.Alignment = StringAlignment.Near})
  114.     End Sub
  115.  
  116.     Public Sub FillRect(ByVal G As Graphics, ByVal Br As Brush, ByVal Rect As Rectangle)
  117.         G.FillRectangle(Br, Rect)
  118.     End Sub
  119.  
  120. End Module
  121.  
  122. #End Region
  123.  
  124. #Region " Skin "
  125.  
  126. Public Class EtherealTheme : Inherits ContainerControl
  127.  
  128. #Region " Variables "
  129.  
  130.     Private Movable As Boolean = False
  131.     Private MousePoint As New Point(0, 0)
  132.     Private MoveHeight = 50
  133.     Private _TitleTextPostion As TitlePostion = TitlePostion.Left
  134.     Private _HeaderColor As Color = GetHTMLColor("3f2153")
  135.     Private _BackColor As Color = Color.White
  136.     Private _BorderColor As Color = GetHTMLColor("3f2153")
  137.     Private Property _ShowIcon As Boolean = False
  138.  
  139. #End Region
  140.  
  141. #Region " Properties"
  142.  
  143.     Public Property HeaderColor As Color
  144.         Get
  145.             Return _HeaderColor
  146.         End Get
  147.         Set(value As Color)
  148.             _HeaderColor = value
  149.             Invalidate()
  150.         End Set
  151.     End Property
  152.     Public Overridable Shadows Property BackColor As Color
  153.         Get
  154.             Return _BackColor
  155.         End Get
  156.         Set(value As Color)
  157.             _BackColor = value
  158.             MyBase.BackColor = value
  159.             Invalidate()
  160.         End Set
  161.     End Property
  162.     Public Property BorderColor As Color
  163.         Get
  164.             Return _BorderColor
  165.         End Get
  166.         Set(value As Color)
  167.             _BorderColor = value
  168.             Invalidate()
  169.         End Set
  170.     End Property
  171.  
  172.     Public Overridable Shadows Property ShowIcon As Boolean
  173.         Get
  174.             Return _ShowIcon
  175.         End Get
  176.         Set(ByVal value As Boolean)
  177.             If value = _ShowIcon Then Return
  178.             FindForm().ShowIcon = value
  179.             Invalidate()
  180.             _ShowIcon = value
  181.         End Set
  182.     End Property
  183.  
  184.     Public Overridable Property TitleTextPostion As TitlePostion
  185.         Get
  186.             Return _TitleTextPostion
  187.         End Get
  188.         Set(value As TitlePostion)
  189.             _TitleTextPostion = value
  190.         End Set
  191.     End Property
  192.  
  193.     Enum TitlePostion
  194.         Left
  195.         Center
  196.     End Enum
  197.  
  198. #End Region
  199.  
  200. #Region " Initialization "
  201.  
  202.     Sub New()
  203.  
  204.         SetStyle(ControlStyles.UserPaint Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.AllPaintingInWmPaint Or ControlStyles.ResizeRedraw, True)
  205.         DoubleBuffered = True
  206.         MyBase.Dock = DockStyle.None
  207.         Font = New Font("Proxima Nova", 14, FontStyle.Bold)
  208.     End Sub
  209.  
  210. #End Region
  211.  
  212. #Region " Draw Control "
  213.  
  214.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  215.         Dim B As New Bitmap(Width, Height), G = Graphics.FromImage(B)
  216.         With G
  217.             .TextRenderingHint = Drawing.Text.TextRenderingHint.ClearTypeGridFit
  218.             FillRect(G, New SolidBrush(HeaderColor), New Rectangle(0, 0, Width, 50))
  219.             .DrawRectangle(New Pen(BorderColor, 2), New Rectangle(1, 1, Width - 2, Height - 2))
  220.  
  221.             If FindForm().ShowIcon = True Then
  222.                 G.DrawIcon(FindForm().Icon, New Rectangle(5, 13, 20, 20))
  223.                 Select Case TitleTextPostion
  224.                     Case TitlePostion.Left
  225.                         G.DrawString(Text, Font, Brushes.White, 27, 10)
  226.                         Exit Select
  227.                     Case TitlePostion.Center
  228.                         HelperMethods.CentreString(G, Text, Font, Brushes.White, New Rectangle(0, 0, Width, 50))
  229.                         Exit Select
  230.                 End Select
  231.             Else
  232.                 Select Case TitleTextPostion
  233.                     Case TitlePostion.Left
  234.                         G.DrawString(Text, Font, Brushes.White, 5, 10)
  235.                         Exit Select
  236.                     Case TitlePostion.Center
  237.                         HelperMethods.CentreString(G, Text, Font, Brushes.White, New Rectangle(0, 0, Width, 50))
  238.                         Exit Select
  239.                 End Select
  240.             End If
  241.  
  242.         End With
  243.         MyBase.OnPaint(e)
  244.         e.Graphics.DrawImage(B.Clone, 0, 0)
  245.         G.Dispose() : B.Dispose()
  246.     End Sub
  247.  
  248.     Protected Overrides Sub CreateHandle()
  249.         MyBase.CreateHandle()
  250.     End Sub
  251.  
  252.     Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  253.         MyBase.OnMouseDown(e)
  254.         If e.Button = Windows.Forms.MouseButtons.Left And New Rectangle(0, 0, Width, MoveHeight).Contains(e.Location) Then
  255.             Movable = True
  256.             MousePoint = e.Location
  257.         End If
  258.     End Sub
  259.  
  260.     Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  261.         MyBase.OnMouseUp(e) : Movable = False
  262.     End Sub
  263.     Protected Overrides Sub OnMouseMove(ByVal e As MouseEventArgs)
  264.         MyBase.OnMouseMove(e)
  265.         If Movable Then Parent.Location = MousePosition - MousePoint
  266.     End Sub
  267.  
  268.     Protected Overrides Sub OnCreateControl()
  269.         MyBase.OnCreateControl()
  270.         ParentForm.FormBorderStyle = FormBorderStyle.None
  271.         ParentForm.AllowTransparency = False
  272.         ParentForm.TransparencyKey = Color.Fuchsia
  273.         ParentForm.FindForm.StartPosition = FormStartPosition.CenterScreen
  274.         Dock = DockStyle.Fill
  275.         Invalidate()
  276.     End Sub
  277.  
  278. #End Region
  279.  
  280. End Class
  281.  
  282. #End Region
  283.  
  284. #Region " TabControl "
  285.  
  286. Public Class EtherealTabControl : Inherits TabControl
  287.  
  288. #Region " Variables "
  289.  
  290.     Private State As New MouseMode
  291.     Private _TabsColor As Color = GetHTMLColor("432e58")
  292.     Private _SeletedTabTriangleColor As Color = Color.White
  293.     Private _LeftColor As Color = GetHTMLColor("4e3a62")
  294.     Private _RightColor As Color = Color.White
  295.     Private _LineColor As Color = GetHTMLColor("3b2551")
  296.     Private _NoneSelectedTabColors As Color = GetHTMLColor("432e58")
  297.     Private _HoverColor As Color = GetHTMLColor("3b2551")
  298.     Private _TextColor As Color = Color.White
  299.     Private _TabPageColor As Color = Color.White
  300.  
  301. #End Region
  302.  
  303. #Region " Properties "
  304.  
  305.     Public Property TabsColor As Color
  306.         Get
  307.             Return _TabsColor
  308.         End Get
  309.         Set(value As Color)
  310.             _TabsColor = value
  311.             Invalidate()
  312.         End Set
  313.     End Property
  314.  
  315.     Public Property SeletedTabTriangleColor As Color
  316.         Get
  317.             Return _SeletedTabTriangleColor
  318.         End Get
  319.         Set(value As Color)
  320.             _SeletedTabTriangleColor = value
  321.             Invalidate()
  322.         End Set
  323.     End Property
  324.  
  325.     Public Property LeftColor As Color
  326.         Get
  327.             Return _LeftColor
  328.         End Get
  329.         Set(value As Color)
  330.             _LeftColor = value
  331.             Invalidate()
  332.         End Set
  333.     End Property
  334.  
  335.     Public Property RightColor As Color
  336.         Get
  337.             Return _RightColor
  338.         End Get
  339.         Set(value As Color)
  340.             _RightColor = value
  341.             Invalidate()
  342.         End Set
  343.     End Property
  344.  
  345.     Public Property LineColor As Color
  346.         Get
  347.             Return _LineColor
  348.         End Get
  349.         Set(value As Color)
  350.             _LineColor = value
  351.             Invalidate()
  352.         End Set
  353.     End Property
  354.  
  355.     Public Property NoneSelectedTabColors As Color
  356.         Get
  357.             Return _NoneSelectedTabColors
  358.         End Get
  359.         Set(value As Color)
  360.             _NoneSelectedTabColors = value
  361.             Invalidate()
  362.         End Set
  363.     End Property
  364.  
  365.     Public Property TextColor As Color
  366.         Get
  367.             Return _TextColor
  368.         End Get
  369.         Set(value As Color)
  370.             _TextColor = value
  371.             Invalidate()
  372.         End Set
  373.     End Property
  374.  
  375.     Public Property HoverColor As Color
  376.         Get
  377.             Return _HoverColor
  378.         End Get
  379.         Set(value As Color)
  380.             _HoverColor = value
  381.             Invalidate()
  382.         End Set
  383.     End Property
  384.  
  385.     Public Property TabPageColor As Color
  386.         Get
  387.             Return _TabPageColor
  388.         End Get
  389.         Set(value As Color)
  390.             _TabPageColor = value
  391.             Invalidate()
  392.         End Set
  393.     End Property
  394.  
  395. #End Region
  396.  
  397. #Region " Stractures "
  398.  
  399.     Private Structure MouseMode
  400.         Dim Hover As Boolean
  401.         Dim Coordinates As Point
  402.     End Structure
  403.  
  404. #End Region
  405.  
  406. #Region " Initialization "
  407.  
  408.     Sub New()
  409.         SetStyle(ControlStyles.UserPaint Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.AllPaintingInWmPaint Or ControlStyles.SupportsTransparentBackColor, True)
  410.         DoubleBuffered = True
  411.         SizeMode = TabSizeMode.Fixed
  412.         Dock = DockStyle.None
  413.         ItemSize = New Size(40, 150)
  414.         Alignment = TabAlignment.Left
  415.     End Sub
  416.  
  417. #End Region
  418.  
  419. #Region " Draw Control "
  420.  
  421.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  422.         Using B As New Bitmap(Width, Height), G As Graphics = Graphics.FromImage(B)
  423.             With G
  424.                 .TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
  425.                 .InterpolationMode = InterpolationMode.HighQualityBicubic
  426.                 FillRect(G, New SolidBrush(LeftColor), New Rectangle(0, 1, 150, Height))
  427.                 For i = 0 To TabCount - 1
  428.                     Dim R As Rectangle = GetTabRect(i)
  429.  
  430.                     FillRect(G, New SolidBrush(NoneSelectedTabColors), New Rectangle(R.X - 1, R.Y - 1, R.Width - 3, R.Height))
  431.  
  432.                     If i = SelectedIndex Then
  433.                         .SmoothingMode = SmoothingMode.AntiAlias
  434.                         Dim P1 As New Point(ItemSize.Height - 12, R.Location.Y + 20), _
  435.                             P2 As New Point(ItemSize.Height + 2, R.Location.Y + 10), _
  436.                             P3 As New Point(ItemSize.Height + 2, R.Location.Y + 30)
  437.                         .FillPolygon(New SolidBrush(SeletedTabTriangleColor), New Point() {P1, P2, P3})
  438.                     Else
  439.                         If State.Hover AndAlso R.Contains(State.Coordinates) Then
  440.                             Cursor = Cursors.Hand
  441.                             FillRect(G, New SolidBrush(HoverColor), New Rectangle(R.X, R.Y, R.Width - 3, R.Height))
  442.                         End If
  443.                     End If
  444.  
  445.                     .DrawString(TabPages(i).Text, New Font("Segoe UI", 8, FontStyle.Bold), New SolidBrush(TextColor), R.X + 28, R.Y + 13)
  446.  
  447.                     If ImageList IsNot Nothing Then
  448.                         .DrawImage(ImageList.Images(i), New Rectangle(R.X + 6, R.Y + 11, 16, 16))
  449.                     End If
  450.  
  451.                     .DrawLine(New Pen(LineColor, 1), New Point(R.X - 1, R.Bottom - 2), New Point(R.Width - 2, R.Bottom - 2))
  452.  
  453.                 Next
  454.                 .FillRectangle(New SolidBrush(RightColor), New Rectangle(150, 1.3, Width, Height - 2))
  455.                 .DrawRectangle(New Pen(LineColor, 1), New Rectangle(0, 0, Width - 1, Height - 1))
  456.             End With
  457.             e.Graphics.DrawImage(B, 0, 0)
  458.             G.Dispose()
  459.             B.Dispose()
  460.         End Using
  461.     End Sub
  462.  
  463. #End Region
  464.  
  465. #Region " Events "
  466.  
  467.     Protected Overrides Sub OnMouseEnter(e As System.EventArgs)
  468.         State.Hover = True
  469.         MyBase.OnMouseHover(e)
  470.     End Sub
  471.  
  472.     Protected Overrides Sub OnMouseLeave(e As System.EventArgs)
  473.         State.Hover = False
  474.         For Each Tab As TabPage In MyBase.TabPages
  475.             If Tab.DisplayRectangle.Contains(State.Coordinates) Then
  476.                 Invalidate()
  477.                 Exit For
  478.             End If
  479.         Next
  480.         MyBase.OnMouseHover(e)
  481.     End Sub
  482.  
  483.     Protected Overrides Sub OnMouseMove(e As System.Windows.Forms.MouseEventArgs)
  484.         State.Coordinates = e.Location
  485.         For Each Tab As TabPage In MyBase.TabPages
  486.             If Tab.DisplayRectangle.Contains(e.Location) Then
  487.                 Invalidate()
  488.                 Exit For
  489.             End If
  490.         Next
  491.         MyBase.OnMouseMove(e)
  492.     End Sub
  493.  
  494.     Protected Overrides Sub OnCreateControl()
  495.         MyBase.OnCreateControl()
  496.         For Each T As TabPage In TabPages
  497.             T.BackColor = TabPageColor
  498.         Next
  499.     End Sub
  500.  
  501. #End Region
  502.  
  503. End Class
  504.  
  505. #End Region
  506.  
  507. #Region " Button "
  508.  
  509. Public Class EtherealButton : Inherits Control
  510.  
  511. #Region " Variables "
  512.  
  513.     Private State As MouseMode
  514.     Public Property ButtonStyle As Style
  515.     Private NoneColor As Color = GetHTMLColor("222222")
  516.     Private _RoundRadius As Integer = 5
  517.  
  518. #End Region
  519.  
  520. #Region " Properties "
  521.  
  522.     Public Property RoundRadius As Integer
  523.         Get
  524.             Return _RoundRadius
  525.         End Get
  526.         Set(value As Integer)
  527.             _RoundRadius = value
  528.             Invalidate()
  529.         End Set
  530.     End Property
  531.  
  532. #End Region
  533.  
  534. #Region " Initialization "
  535.  
  536.     Sub New()
  537.         SetStyle(ControlStyles.DoubleBuffer Or ControlStyles.AllPaintingInWmPaint Or _
  538.         ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or _
  539.         ControlStyles.Selectable Or ControlStyles.SupportsTransparentBackColor, True)
  540.         DoubleBuffered = True
  541.         BackColor = Color.Transparent
  542.     End Sub
  543.  
  544. #End Region
  545.  
  546. #Region " Enumerators "
  547.  
  548.     Public Enum Style As Byte
  549.         Clear
  550.         DarkClear
  551.         SemiBlack
  552.         DarkPink
  553.         LightPink
  554.     End Enum
  555.  
  556. #End Region
  557.  
  558. #Region " Draw Control "
  559.  
  560.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  561.         Using B As New Bitmap(Width, Height), G As Graphics = Graphics.FromImage(B)
  562.             Dim Rect As Rectangle = New Rectangle(0, 0, Width - 1, Height - 1)
  563.             With G
  564.                 GP = RoundRec(Rect, RoundRadius)
  565.                 .TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
  566.                 .SmoothingMode = SmoothingMode.HighQuality
  567.  
  568.                 Select Case State
  569.                     Case MouseMode.NormalMode
  570.                         Select Case ButtonStyle
  571.                             Case Style.Clear
  572.                                 NoneColor = GetHTMLColor("ececec")
  573.                                 DrawRoundedPath(G, NoneColor, 1, Rect, RoundRadius)
  574.                                 CentreString(G, Text, New Font("Segoe UI", 9, FontStyle.Bold), SolidBrushHTMlColor("b9b9b9"), Rect)
  575.                             Case Style.DarkClear
  576.                                 NoneColor = GetHTMLColor("444444")
  577.                                 DrawRoundedPath(G, NoneColor, 1, Rect, RoundRadius)
  578.                                 CentreString(G, Text, New Font("Segoe UI", 9, FontStyle.Bold), SolidBrushHTMlColor("444444"), Rect)
  579.                             Case Style.SemiBlack
  580.                                 NoneColor = GetHTMLColor("222222")
  581.                                 FillRoundedPath(G, NoneColor, Rect, RoundRadius)
  582.                                 DrawRoundedPath(G, GetHTMLColor("121212"), 1, Rect, RoundRadius)
  583.                                 CentreString(G, Text, New Font("Segoe UI", 9, FontStyle.Bold), Brushes.White, Rect)
  584.                             Case Style.DarkPink
  585.                                 NoneColor = GetHTMLColor("3b2551")
  586.                                 FillRoundedPath(G, NoneColor, Rect, RoundRadius)
  587.                                 DrawRoundedPath(G, GetHTMLColor("6d5980"), 1, Rect, RoundRadius)
  588.                                 CentreString(G, Text, New Font("Segoe UI", 9, FontStyle.Bold), Brushes.White, Rect)
  589.                             Case Style.LightPink
  590.                                 NoneColor = GetHTMLColor("9d92a8")
  591.                                 FillRoundedPath(G, NoneColor, Rect, RoundRadius)
  592.                                 DrawRoundedPath(G, GetHTMLColor("573d71"), 1, Rect, RoundRadius)
  593.                                 CentreString(G, Text, New Font("Segoe UI", 9, FontStyle.Bold), Brushes.White, Rect)
  594.                         End Select
  595.                     Case MouseMode.Hovered
  596.                         NoneColor = GetHTMLColor("444444")
  597.                         Select Case ButtonStyle
  598.                             Case Style.Clear
  599.                                 NoneColor = GetHTMLColor("444444")
  600.                                 DrawRoundedPath(G, NoneColor, 1, Rect, RoundRadius)
  601.                                 CentreString(G, Text, New Font("Segoe UI", 9, FontStyle.Bold), SolidBrushHTMlColor("444444"), Rect)
  602.                             Case Style.DarkClear
  603.                                 NoneColor = GetHTMLColor("ececec")
  604.                                 DrawRoundedPath(G, NoneColor, 1, Rect, RoundRadius)
  605.                                 CentreString(G, Text, New Font("Segoe UI", 9, FontStyle.Bold), SolidBrushHTMlColor("b9b9b9"), Rect)
  606.                             Case Style.SemiBlack
  607.                                 NoneColor = GetHTMLColor("444444")
  608.                                 .FillPath(New SolidBrush(Color.Transparent), GP)
  609.                                 DrawRoundedPath(G, NoneColor, 1, Rect, RoundRadius)
  610.                                 CentreString(G, Text, New Font("Segoe UI", 9, FontStyle.Bold), SolidBrushHTMlColor("444444"), Rect)
  611.                             Case Style.DarkPink
  612.                                 NoneColor = GetHTMLColor("444444")
  613.                                 FillRect(G, New SolidBrush(Color.Transparent), Rect)
  614.                                 DrawRoundedPath(G, NoneColor, 1, Rect, RoundRadius)
  615.                                 CentreString(G, Text, New Font("Segoe UI", 9, FontStyle.Bold), SolidBrushHTMlColor("444444"), Rect)
  616.                             Case Style.LightPink
  617.                                 NoneColor = GetHTMLColor("9d92a8")
  618.                                 FillRect(G, New SolidBrush(Color.Transparent), Rect)
  619.                                 DrawRoundedPath(G, NoneColor, 1, Rect, RoundRadius)
  620.                                 CentreString(G, Text, New Font("Segoe UI", 9, FontStyle.Bold), SolidBrushHTMlColor("444444"), Rect)
  621.                         End Select
  622.                     Case MouseMode.Pushed
  623.                         Select Case ButtonStyle
  624.                             Case Style.Clear, Style.DarkClear
  625.                                 NoneColor = GetHTMLColor("444444")
  626.                                 FillRect(G, New SolidBrush(Color.Transparent), Rect)
  627.                                 DrawRoundedPath(G, NoneColor, 1, Rect, 5)
  628.                                 CentreString(G, Text, New Font("Segoe UI", 9, FontStyle.Bold), SolidBrushHTMlColor("444444"), Rect)
  629.                             Case Style.DarkPink, Style.LightPink, Style.SemiBlack
  630.                                 NoneColor = GetHTMLColor("ececec")
  631.                                 DrawRoundedPath(G, NoneColor, 1, Rect, 5)
  632.                                 CentreString(G, Text, New Font("Segoe UI", 9, FontStyle.Bold), SolidBrushHTMlColor("b9b9b9"), Rect)
  633.                         End Select
  634.                 End Select
  635.  
  636.             End With
  637.             e.Graphics.DrawImage(B.Clone, 0, 0)
  638.             G.Dispose() : B.Dispose()
  639.         End Using
  640.     End Sub
  641.  
  642. #End Region
  643.  
  644. #Region " Events "
  645.  
  646.     Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  647.         MyBase.OnMouseUp(e)
  648.         State = MouseMode.Hovered : Invalidate()
  649.     End Sub
  650.  
  651.     Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  652.         MyBase.OnMouseUp(e)
  653.         State = MouseMode.Pushed : Invalidate()
  654.     End Sub
  655.  
  656.     Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
  657.         MyBase.OnMouseEnter(e)
  658.         State = MouseMode.Hovered : Invalidate()
  659.     End Sub
  660.  
  661.     Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
  662.         MyBase.OnMouseEnter(e)
  663.         State = MouseMode.NormalMode : Invalidate()
  664.     End Sub
  665.  
  666. #End Region
  667.  
  668. End Class
  669.  
  670. #End Region
  671.  
  672. #Region " ComboBox "
  673.  
  674. Public Class EtherealComboBox : Inherits ComboBox
  675.  
  676. #Region " Variables "
  677.  
  678.     Private _StartIndex As Integer = 0
  679.     Private _BorderColor As Color = GetHTMLColor("ececec")
  680.     Private _TextColor As Color = GetHTMLColor("b8c6d6")
  681.     Private _TriangleColor As Color = GetHTMLColor("999999")
  682.  
  683. #End Region
  684.  
  685. #Region " Properties "
  686.  
  687.     Private Property StartIndex As Integer
  688.         Get
  689.             Return _StartIndex
  690.         End Get
  691.         Set(ByVal value As Integer)
  692.             _StartIndex = value
  693.             Try
  694.                 MyBase.SelectedIndex = value
  695.             Catch
  696.             End Try
  697.             Invalidate()
  698.         End Set
  699.     End Property
  700.  
  701.     Public Property BorderColor As Color
  702.         Get
  703.             Return _BorderColor
  704.         End Get
  705.         Set(value As Color)
  706.             _BorderColor = value
  707.             Invalidate()
  708.         End Set
  709.     End Property
  710.  
  711.     Public Property TextColor As Color
  712.         Get
  713.             Return _TextColor
  714.         End Get
  715.         Set(value As Color)
  716.             _TextColor = value
  717.             Invalidate()
  718.         End Set
  719.     End Property
  720.  
  721.     Public Property TriangleColor As Color
  722.         Get
  723.             Return _TriangleColor
  724.         End Get
  725.         Set(value As Color)
  726.             _TriangleColor = value
  727.             Invalidate()
  728.         End Set
  729.     End Property
  730.  
  731. #End Region
  732.  
  733. #Region " Initialization "
  734.  
  735.     Sub New()
  736.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or _
  737.                   ControlStyles.OptimizedDoubleBuffer Or ControlStyles.SupportsTransparentBackColor, True)
  738.         DrawMode = Windows.Forms.DrawMode.OwnerDrawFixed
  739.         Size = New Size(200, 35)
  740.         DropDownStyle = ComboBoxStyle.DropDownList
  741.         BackColor = Color.Transparent
  742.         Font = New Font("Segoe UI", 15)
  743.         DoubleBuffered = True
  744.     End Sub
  745.  
  746. #End Region
  747.  
  748. #Region " Draw Control "
  749.  
  750.     Sub MyBase_DrawItem(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles MyBase.DrawItem
  751.         Try
  752.             With e.Graphics
  753.                 .SmoothingMode = SmoothingMode.HighQuality
  754.                 .TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
  755.                 e.DrawBackground()
  756.                 If (e.State And DrawItemState.Selected) = DrawItemState.Selected Then
  757.                     .FillRectangle(SolidBrushHTMlColor("3b2551"), e.Bounds)
  758.                     .DrawString(MyBase.GetItemText(MyBase.Items(e.Index)), New Font("Segoe UI", 10, FontStyle.Bold), New SolidBrush(Color.WhiteSmoke), 1, e.Bounds.Top + 5)
  759.                 Else
  760.                     .FillRectangle(New SolidBrush(e.BackColor), e.Bounds)
  761.                     .DrawString(MyBase.GetItemText(MyBase.Items(e.Index)), New Font("Segoe UI", 10, FontStyle.Bold), SolidBrushHTMlColor("b8c6d6"), 1, e.Bounds.Top + 5)
  762.                 End If
  763.             End With
  764.         Catch
  765.         End Try
  766.         Invalidate()
  767.     End Sub
  768.  
  769.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  770.         Using B As New Bitmap(Width, Height), G As Graphics = Graphics.FromImage(B)
  771.             Dim Rect As New Rectangle(1, 1, Width - 2, Height - 2)
  772.             With G
  773.                 .TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias : .SmoothingMode = SmoothingMode.HighQuality : .PixelOffsetMode = PixelOffsetMode.HighQuality
  774.                 DrawTriangle(G, TriangleColor, 2, _
  775.                 New Point(Width - 20, 16), New Point(Width - 16, 20), _
  776.                 New Point(Width - 16, 20), New Point(Width - 12, 16), _
  777.                 New Point(Width - 16, 21), New Point(Width - 16, 20) _
  778.                 )
  779.                 DrawRoundedPath(G, BorderColor, 1.5, Rect, 4)
  780.                 .DrawString(Text, Font, New SolidBrush(TextColor), New Rectangle(7, 0, Width - 1, Height - 1), New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Near})
  781.             End With
  782.             e.Graphics.DrawImage(B, 0, 0)
  783.             G.Dispose()
  784.             B.Dispose()
  785.         End Using
  786.     End Sub
  787.  
  788. #End Region
  789.  
  790. End Class
  791.  
  792. #End Region
  793.  
  794. #Region " Textbox "
  795.  
  796. Public Class EtherealTextbox : Inherits Control
  797.  
  798. #Region " Variables "
  799.  
  800.     Private WithEvents T As New TextBox
  801.     Private _TextAlign As HorizontalAlignment = HorizontalAlignment.Left
  802.     Private _MaxLength As Integer = 32767
  803.     Private _ReadOnly As Boolean = False
  804.     Private _UseSystemPasswordChar As Boolean = False
  805.     Private _WatermarkText As String = String.Empty
  806.     Private _SideImage As Image
  807.     Private _BackColor As Color = Color.White
  808.     Private _BorderColor As Color = GetHTMLColor("ececec")
  809.     Private _ForeColor As Color = Color.Gray
  810.  
  811. #End Region
  812.  
  813. #Region " Native Methods "
  814.  
  815.     Private Declare Auto Function SendMessage Lib "user32.dll" (hWnd As IntPtr, msg As Integer, wParam As Integer, <System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr)> lParam As String) As Int32
  816.  
  817. #End Region
  818.  
  819. #Region " Properties "
  820.  
  821.     <Browsable(False), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
  822.     Property BorderStyle As BorderStyle
  823.         Get
  824.             Return BorderStyle.None
  825.         End Get
  826.         Set(ByVal value As BorderStyle)
  827.         End Set
  828.     End Property
  829.  
  830.     Public Property WatermarkText As String
  831.         Get
  832.             Return _WatermarkText
  833.         End Get
  834.         Set(value As String)
  835.             _WatermarkText = value
  836.             SendMessage(T.Handle, &H1501, 0, value)
  837.             Invalidate()
  838.         End Set
  839.     End Property
  840.  
  841.     Public Overridable Shadows Property TextAlign() As HorizontalAlignment
  842.         Get
  843.             Return _TextAlign
  844.         End Get
  845.         Set(ByVal value As HorizontalAlignment)
  846.             _TextAlign = value
  847.             If T IsNot Nothing Then
  848.                 T.TextAlign = value
  849.             End If
  850.         End Set
  851.     End Property
  852.  
  853.     Public Overridable Shadows Property MaxLength() As Integer
  854.         Get
  855.             Return _MaxLength
  856.         End Get
  857.         Set(ByVal value As Integer)
  858.             _MaxLength = value
  859.             If T IsNot Nothing Then
  860.                 T.MaxLength = value
  861.             End If
  862.         End Set
  863.     End Property
  864.  
  865.     Public Overridable Shadows Property [ReadOnly]() As Boolean
  866.         Get
  867.             Return _ReadOnly
  868.         End Get
  869.         Set(ByVal value As Boolean)
  870.             _ReadOnly = value
  871.             If T IsNot Nothing Then
  872.                 T.ReadOnly = value
  873.             End If
  874.         End Set
  875.     End Property
  876.  
  877.     Public Overridable Shadows Property UseSystemPasswordChar() As Boolean
  878.         Get
  879.             Return _UseSystemPasswordChar
  880.         End Get
  881.         Set(ByVal value As Boolean)
  882.             _UseSystemPasswordChar = value
  883.             If T IsNot Nothing Then
  884.                 T.UseSystemPasswordChar = value
  885.             End If
  886.         End Set
  887.     End Property
  888.  
  889.     Public Overridable Shadows ReadOnly Property Multiline() As Boolean
  890.         Get
  891.             Return False
  892.         End Get
  893.     End Property
  894.  
  895.     Public Overridable Shadows Property Text As String
  896.         Get
  897.             Return MyBase.Text
  898.         End Get
  899.         Set(ByVal value As String)
  900.             MyBase.Text = value
  901.             If T IsNot Nothing Then
  902.                 T.Text = value
  903.             End If
  904.         End Set
  905.     End Property
  906.  
  907.     <Browsable(False)>
  908.     Public Overridable Shadows ReadOnly Property Font As Font
  909.         Get
  910.             Return New Font("Segoe UI", 10, FontStyle.Regular)
  911.         End Get
  912.     End Property
  913.  
  914.     Public Overridable Shadows Property ForeColor As Color
  915.         Get
  916.             Return _ForeColor
  917.         End Get
  918.         Set(value As Color)
  919.             MyBase.ForeColor = value
  920.             T.ForeColor = value
  921.             _ForeColor = value
  922.             Invalidate()
  923.         End Set
  924.     End Property
  925.  
  926.     <Browsable(True)>
  927.     Public Property SideImage As Image
  928.         Get
  929.             Return _SideImage
  930.         End Get
  931.         Set(value As Image)
  932.             _SideImage = value
  933.         End Set
  934.     End Property
  935.  
  936.     Protected Overrides Sub OnCreateControl()
  937.         MyBase.OnCreateControl()
  938.         If Not Controls.Contains(T) Then
  939.             Controls.Add(T)
  940.         End If
  941.     End Sub
  942.  
  943.     Private Sub T_TextChanged(ByVal sender As Object, ByVal e As EventArgs) Handles T.TextChanged
  944.         Text = T.Text
  945.     End Sub
  946.  
  947.     Private Sub T_KeyDown(ByVal sender As Object, ByVal e As KeyEventArgs) Handles T.KeyDown
  948.         If e.Control AndAlso e.KeyCode = Keys.A Then e.SuppressKeyPress = True
  949.  
  950.         If e.Control AndAlso e.KeyCode = Keys.C Then
  951.             T.Copy()
  952.             e.SuppressKeyPress = True
  953.         End If
  954.     End Sub
  955.  
  956.     Public Overridable Shadows Property BackColor As Color
  957.         Get
  958.             Return _BackColor
  959.         End Get
  960.         Set(value As Color)
  961.             MyBase.BackColor = value
  962.             T.BackColor = value
  963.             _BackColor = value
  964.             Invalidate()
  965.         End Set
  966.     End Property
  967.  
  968.     Public Property BorderColor As Color
  969.         Get
  970.             Return _BorderColor
  971.         End Get
  972.         Set(value As Color)
  973.             _BorderColor = value
  974.             Invalidate()
  975.         End Set
  976.     End Property
  977.  
  978. #End Region
  979.  
  980. #Region " Initialization "
  981.  
  982.     Sub New()
  983.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or _
  984.                   ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer Or _
  985.                   ControlStyles.SupportsTransparentBackColor, True)
  986.         DoubleBuffered = True
  987.         With T
  988.             .Multiline = False
  989.             .Cursor = Cursors.IBeam
  990.             .BackColor = BackColor
  991.             .ForeColor = ForeColor
  992.             .Text = WatermarkText
  993.             .BorderStyle = BorderStyle.None
  994.             .Location = New Point(7, 7)
  995.             .Font = Font
  996.             .Size = New Size(Width - 10, 34)
  997.             .UseSystemPasswordChar = _UseSystemPasswordChar
  998.             Text = WatermarkText
  999.         End With
  1000.         Size = New Size(135, 34)
  1001.     End Sub
  1002.  
  1003. #End Region
  1004.  
  1005. #Region " Draw Control "
  1006.  
  1007.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  1008.         Using B As New Bitmap(Width, Height), G As Graphics = Graphics.FromImage(B)
  1009.             Height = 34
  1010.             With G
  1011.                 .SmoothingMode = SmoothingMode.HighQuality
  1012.                 .Clear(BackColor)
  1013.                 DrawRoundedPath(G, BorderColor, 1.8, New Rectangle(0, 0, Width - 1, Height - 1), 4)
  1014.                 If Not SideImage Is Nothing Then
  1015.                     T.Location = New Point(45, 7)
  1016.                     T.Width = Width - 60
  1017.                     .DrawRectangle(New Pen(BorderColor, 1), New Rectangle(-1, -1, 35, Height + 1))
  1018.                     .DrawImage(SideImage, New Rectangle(8, 7, 16, 16))
  1019.                 Else
  1020.                     T.Location = New Point(7, 7)
  1021.                     T.Width = Width - 10
  1022.                 End If
  1023.             End With
  1024.             e.Graphics.DrawImage(B.Clone(), 0, 0)
  1025.             G.Dispose() : B.Dispose()
  1026.         End Using
  1027.     End Sub
  1028.  
  1029. #End Region
  1030.  
  1031. End Class
  1032.  
  1033. #End Region
  1034.  
  1035. #Region " Seperator "
  1036.  
  1037. Public Class EtherealSeperator : Inherits Control
  1038.  
  1039. #Region " Variables "
  1040.  
  1041.     Public Property SepStyle As Style = Style.Horizental
  1042.  
  1043. #End Region
  1044.  
  1045. #Region " Enumerators "
  1046.  
  1047.     Enum Style
  1048.         Horizental
  1049.         Vertiacal
  1050.     End Enum
  1051.  
  1052. #End Region
  1053.  
  1054. #Region " Initialization "
  1055.  
  1056.     Sub New()
  1057.         SetStyle(ControlStyles.SupportsTransparentBackColor Or ControlStyles.UserPaint, True)
  1058.         DoubleBuffered = True
  1059.         BackColor = Color.Transparent
  1060.         ForeColor = GetHTMLColor("3b2551")
  1061.     End Sub
  1062.  
  1063. #End Region
  1064.  
  1065. #Region " Draw Control "
  1066.  
  1067.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  1068.         Dim B As New Bitmap(Width, Height), G = e.Graphics
  1069.         With G
  1070.             .SmoothingMode = SmoothingMode.HighQuality
  1071.             Dim BL1, BL2 As New ColorBlend
  1072.             BL1.Positions = New Single() {0.0F, 0.15F, 0.85F, 1.0F}
  1073.             BL1.Colors = New Color() {Color.Transparent, ForeColor, ForeColor, Color.Transparent}
  1074.             Select Case SepStyle
  1075.                 Case Style.Horizental
  1076.                     Dim lb1 As New LinearGradientBrush(ClientRectangle, Color.Empty, Color.Empty, 0.0F)
  1077.                     lb1.InterpolationColors = BL1
  1078.                     .DrawLine(New Pen(lb1), 0, 1, Width, 1)
  1079.                 Case Style.Vertiacal
  1080.                     Dim lb1 As New LinearGradientBrush(ClientRectangle, Color.Empty, Color.Empty, 90.0F)
  1081.                     lb1.InterpolationColors = BL1
  1082.                     .DrawLine(New Pen(lb1), 1, 0, 1, Height)
  1083.             End Select
  1084.         End With
  1085.     End Sub
  1086.  
  1087. #End Region
  1088.  
  1089. End Class
  1090.  
  1091. #End Region
  1092.  
  1093. #Region " Radio Button "
  1094.  
  1095. <DefaultEvent("CheckedChanged")> Public Class EtherealRadioButton : Inherits Control
  1096.  
  1097. #Region " Variables "
  1098.  
  1099.     Private _Checked As Boolean
  1100.     Private _Group As Integer = 1
  1101.     Event CheckedChanged(ByVal sender As Object)
  1102.     Private _BorderColor As Color = GetHTMLColor("746188")
  1103.     Private _CheckColor As Color = GetHTMLColor("746188")
  1104.  
  1105. #End Region
  1106.  
  1107. #Region " Properties "
  1108.  
  1109.     Property Checked As Boolean
  1110.         Get
  1111.             Return _Checked
  1112.         End Get
  1113.         Set(ByVal value As Boolean)
  1114.             _Checked = value
  1115.             RaiseEvent CheckedChanged(Me)
  1116.             Invalidate()
  1117.         End Set
  1118.     End Property
  1119.  
  1120.     Public Property CheckColor As Color
  1121.         Get
  1122.             Return _CheckColor
  1123.         End Get
  1124.         Set(value As Color)
  1125.             _CheckColor = value
  1126.             Invalidate()
  1127.         End Set
  1128.     End Property
  1129.  
  1130.     Public Property BorderColor As Color
  1131.         Get
  1132.             Return _BorderColor
  1133.         End Get
  1134.         Set(value As Color)
  1135.             _BorderColor = value
  1136.             Invalidate()
  1137.         End Set
  1138.     End Property
  1139.  
  1140.     Property Group As Integer
  1141.         Get
  1142.             Return _Group
  1143.         End Get
  1144.         Set(ByVal value As Integer)
  1145.             _Group = value
  1146.         End Set
  1147.     End Property
  1148.  
  1149.     Private Sub UpdateState()
  1150.         If Not IsHandleCreated OrElse Not Checked Then Return
  1151.         For Each C As Control In Parent.Controls
  1152.             If C IsNot Me AndAlso TypeOf C Is EtherealRadioButton AndAlso DirectCast(C, EtherealRadioButton).Group = _Group Then
  1153.                 DirectCast(C, EtherealRadioButton).Checked = False
  1154.             End If
  1155.         Next
  1156.     End Sub
  1157. #End Region
  1158.  
  1159. #Region " Initialization "
  1160.  
  1161.     Sub New()
  1162.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or _
  1163.      ControlStyles.SupportsTransparentBackColor Or ControlStyles.UserPaint, True)
  1164.         DoubleBuffered = True
  1165.         Cursor = Cursors.Hand
  1166.         Font = New Font("Proxima Nova", 11, FontStyle.Regular)
  1167.     End Sub
  1168.  
  1169. #End Region
  1170.  
  1171. #Region " Draw Control "
  1172.  
  1173.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  1174.  
  1175.         Using B As New Bitmap(Width, Height), G As Graphics = Graphics.FromImage(B)
  1176.  
  1177.             With G
  1178.                 .SmoothingMode = SmoothingMode.HighQuality
  1179.                 .TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
  1180.  
  1181.                 .DrawEllipse(New Pen(BorderColor, 2.5), 1, 1, 18, 18)
  1182.                 .DrawString(Text, Font, Brushes.Gray, New Rectangle(23, -0.3, Width, Height))
  1183.  
  1184.                 If Checked Then .FillEllipse(New SolidBrush(CheckColor), New Rectangle(5, 5, 10, 10))
  1185.  
  1186.  
  1187.             End With
  1188.  
  1189.             e.Graphics.DrawImage(B.Clone(), 0, 0)
  1190.             G.Dispose() : B.Dispose()
  1191.  
  1192.         End Using
  1193.  
  1194.     End Sub
  1195.  
  1196. #End Region
  1197.  
  1198. #Region " Events "
  1199.  
  1200.     Protected Overrides Sub OnClick(ByVal e As EventArgs)
  1201.         _Checked = Not Checked
  1202.         UpdateState()
  1203.         MyBase.OnClick(e)
  1204.         Invalidate()
  1205.     End Sub
  1206.  
  1207.     Protected Overrides Sub OnCreateControl()
  1208.         UpdateState()
  1209.         MyBase.OnCreateControl()
  1210.     End Sub
  1211.  
  1212.     Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
  1213.         Invalidate() : MyBase.OnTextChanged(e)
  1214.     End Sub
  1215.  
  1216.     Protected Overrides Sub OnResize(ByVal e As System.EventArgs)
  1217.         Invalidate()
  1218.         MyBase.OnResize(e)
  1219.         Height = 21
  1220.     End Sub
  1221.  
  1222. #End Region
  1223.  
  1224. End Class
  1225.  
  1226. #End Region
  1227.  
  1228. #Region " CheckBox "
  1229.  
  1230. <DefaultEvent("CheckedChanged")> _
  1231. Public Class EtherealCheckBox : Inherits Control
  1232.  
  1233. #Region " Variables "
  1234.  
  1235.     Private _Checked As Boolean = False
  1236.     Event CheckedChanged(ByVal sender As Object)
  1237.     Private _BorderColor As Color = GetHTMLColor("746188")
  1238.     Private _CheckColor As Color = GetHTMLColor("746188")
  1239.  
  1240. #End Region
  1241.  
  1242. #Region " Properties "
  1243.  
  1244.     Property Checked() As Boolean
  1245.         Get
  1246.             Return _Checked
  1247.         End Get
  1248.         Set(ByVal value As Boolean)
  1249.             _Checked = value
  1250.             Invalidate()
  1251.         End Set
  1252.     End Property
  1253.  
  1254.     Public Property CheckColor As Color
  1255.         Get
  1256.             Return _CheckColor
  1257.         End Get
  1258.         Set(value As Color)
  1259.             _CheckColor = value
  1260.             Invalidate()
  1261.         End Set
  1262.     End Property
  1263.  
  1264.     Public Property BorderColor As Color
  1265.         Get
  1266.             Return _BorderColor
  1267.         End Get
  1268.         Set(value As Color)
  1269.             _BorderColor = value
  1270.             Invalidate()
  1271.         End Set
  1272.     End Property
  1273.  
  1274. #End Region
  1275.  
  1276. #Region " Initialization "
  1277.  
  1278.     Sub New()
  1279.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or _
  1280.                    ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer _
  1281.                    Or ControlStyles.SupportsTransparentBackColor, True)
  1282.         DoubleBuffered = True
  1283.         Cursor = Cursors.Hand
  1284.         Size = New Size(200, 20)
  1285.         Font = New Font("Proxima Nova", 11, FontStyle.Regular)
  1286.         BackColor = Color.Transparent
  1287.     End Sub
  1288.  
  1289. #End Region
  1290.  
  1291. #Region " Events "
  1292.  
  1293.     Protected Overrides Sub OnClick(ByVal e As EventArgs)
  1294.         _Checked = Not _Checked
  1295.         RaiseEvent CheckedChanged(Me)
  1296.         MyBase.OnClick(e)
  1297.         Invalidate()
  1298.     End Sub
  1299.  
  1300.     Protected Overrides Sub OnResize(ByVal e As EventArgs)
  1301.         MyBase.OnResize(e)
  1302.         Height = 20
  1303.     End Sub
  1304.  
  1305. #End Region
  1306.  
  1307. #Region " Draw Control "
  1308.  
  1309.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  1310.  
  1311.         Using B As New Bitmap(Width, Height), G As Graphics = Graphics.FromImage(B)
  1312.  
  1313.             With G
  1314.  
  1315.                 .SmoothingMode = SmoothingMode.AntiAlias
  1316.  
  1317.                 .TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
  1318.  
  1319.                 DrawRoundedPath(G, BorderColor, 3, New Rectangle(1, 1, 16, 16), 3)
  1320.  
  1321.                 If Checked Then
  1322.  
  1323.                     FillRoundedPath(G, CheckColor, New Rectangle(5, 5, 8.5, 8.5), 1)
  1324.  
  1325.                 End If
  1326.  
  1327.                 G.DrawString(Text, Font, Brushes.Gray, New Rectangle(22, -1.2, Width, Height - 2))
  1328.  
  1329.             End With
  1330.  
  1331.             e.Graphics.DrawImage(B.Clone, 0, 0)
  1332.  
  1333.             G.Dispose() : B.Dispose()
  1334.  
  1335.         End Using
  1336.  
  1337.     End Sub
  1338.  
  1339. #End Region
  1340.  
  1341. End Class
  1342.  
  1343. #End Region
  1344.  
  1345. #Region " Switch "
  1346.  
  1347. <DefaultEvent("CheckedChanged")> _
  1348. Public Class EtherealSwitch : Inherits Control
  1349.  
  1350. #Region " Variables "
  1351.  
  1352.     Private _Switch As Boolean = False
  1353.     Private State As MouseMode
  1354.     Private _SwitchColor As Color = GetHTMLColor("3f2153")
  1355.  
  1356. #End Region
  1357.  
  1358.     Event CheckedChanged(ByVal sender As Object)
  1359.  
  1360. #Region " Properties "
  1361.  
  1362.     Public Property Switched() As Boolean
  1363.         Get
  1364.             Return _Switch
  1365.         End Get
  1366.         Set(ByVal value As Boolean)
  1367.             _Switch = value
  1368.             Invalidate()
  1369.         End Set
  1370.     End Property
  1371.  
  1372.     Public Property SwitchColor As Color
  1373.         Get
  1374.             Return _SwitchColor
  1375.         End Get
  1376.         Set(value As Color)
  1377.             _SwitchColor = value
  1378.             Invalidate()
  1379.         End Set
  1380.     End Property
  1381.  
  1382. #End Region
  1383.  
  1384. #Region " Initialization "
  1385.  
  1386.     Sub New()
  1387.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or _
  1388.                    ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer _
  1389.                    Or ControlStyles.SupportsTransparentBackColor, True)
  1390.         DoubleBuffered = True
  1391.         Cursor = Cursors.Hand
  1392.         Size = New Size(46, 25)
  1393.     End Sub
  1394.  
  1395. #End Region
  1396.  
  1397. #Region " Draw Control "
  1398.  
  1399.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  1400.  
  1401.         Using B As New Bitmap(Width, Height), G As Graphics = Graphics.FromImage(B)
  1402.  
  1403.             With G
  1404.                 .SmoothingMode = SmoothingMode.AntiAlias
  1405.  
  1406.                 If Switched Then
  1407.  
  1408.                     FillRoundedPath(G, SwitchColor, New Rectangle(1, 1, 42, 22), 22)
  1409.                     DrawRoundedPath(G, GetHTMLColor("ededed"), 1.5, New Rectangle(1, 1, 42, 22), 20)
  1410.  
  1411.                     G.FillEllipse(SolidBrushHTMlColor("fcfcfc"), New Rectangle(22, 2.6, 19, 18))
  1412.                     G.DrawEllipse(PenHTMlColor("e9e9e9", 1.5), New Rectangle(22, 2.6, 19, 18))
  1413.  
  1414.                 Else
  1415.                     FillRoundedPath(G, GetHTMLColor("f8f8f8"), New Rectangle(1, 1, 42, 22), 22)
  1416.                     DrawRoundedPath(G, GetHTMLColor("ededed"), 1.5, New Rectangle(1, 1, 42, 22), 20)
  1417.  
  1418.                     G.FillEllipse(SolidBrushHTMlColor("fcfcfc"), New Rectangle(3, 2.6, 19, 18))
  1419.                     G.DrawEllipse(PenHTMlColor("e9e9e9", 1.5), New Rectangle(3, 2.6, 19, 18))
  1420.  
  1421.  
  1422.                 End If
  1423.  
  1424.             End With
  1425.  
  1426.             e.Graphics.DrawImage(B.Clone(), 0, 0)
  1427.             G.Dispose() : B.Dispose()
  1428.  
  1429.         End Using
  1430.     End Sub
  1431.  
  1432. #End Region
  1433.  
  1434. #Region " Events "
  1435.  
  1436.     Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  1437.         MyBase.OnMouseDown(e)
  1438.         State = MouseMode.Pushed : Invalidate()
  1439.     End Sub
  1440.  
  1441.     Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  1442.         MyBase.OnMouseUp(e)
  1443.         State = MouseMode.Hovered : Invalidate()
  1444.     End Sub
  1445.  
  1446.     Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
  1447.         MyBase.OnMouseEnter(e)
  1448.         State = MouseMode.Hovered : Invalidate()
  1449.     End Sub
  1450.  
  1451.     Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
  1452.         MyBase.OnMouseLeave(e)
  1453.         State = MouseMode.NormalMode : Invalidate()
  1454.     End Sub
  1455.  
  1456.     Protected Overrides Sub OnClick(ByVal e As EventArgs)
  1457.         _Switch = Not _Switch
  1458.         RaiseEvent CheckedChanged(Me)
  1459.         MyBase.OnClick(e)
  1460.     End Sub
  1461.  
  1462.     Protected Overrides Sub OnResize(ByVal e As EventArgs)
  1463.         MyBase.OnResize(e)
  1464.         Size = New Size(46, 25)
  1465.     End Sub
  1466.  
  1467. #End Region
  1468.  
  1469. End Class
  1470.  
  1471. #End Region
  1472.  
  1473. #Region " ProgressBar "
  1474.  
  1475. Public Class EtherealProgressBar : Inherits Control
  1476.  
  1477. #Region " Variables "
  1478.  
  1479.     Private _Maximum As Integer = 100
  1480.     Private _Value As Integer = 0
  1481.     Private _RoundRadius As Integer = 8
  1482.     Private _ProgressColor As Color = GetHTMLColor("4e3a62")
  1483.     Private _BaseColor As Color = GetHTMLColor("f7f7f7")
  1484.     Private _BorderColor As Color = GetHTMLColor("ececec")
  1485.  
  1486. #End Region
  1487.  
  1488. #Region " Initialization "
  1489.  
  1490.     Sub New()
  1491.         MyBase.New()
  1492.         DoubleBuffered = True
  1493.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or _
  1494.                  ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.SupportsTransparentBackColor, True)
  1495.         BackColor = Color.Transparent
  1496.         Size = New Size(75, 23)
  1497.     End Sub
  1498.  
  1499. #End Region
  1500.  
  1501. #Region " Properties "
  1502.  
  1503.     Public Property Value() As Integer
  1504.         Get
  1505.             If _Value < 0 Then
  1506.                 Return 0
  1507.             Else
  1508.                 Return _Value
  1509.             End If
  1510.         End Get
  1511.         Set(ByVal Value As Integer)
  1512.             If Value > Maximum Then
  1513.                 Value = Maximum
  1514.             End If
  1515.             _Value = Value
  1516.             Invalidate()
  1517.         End Set
  1518.     End Property
  1519.  
  1520.     Public Property Maximum() As Integer
  1521.         Get
  1522.             Return _Maximum
  1523.         End Get
  1524.         Set(ByVal Value As Integer)
  1525.             Select Case Value
  1526.                 Case Is < _Value
  1527.                     _Value = Value
  1528.             End Select
  1529.             _Maximum = Value
  1530.             Invalidate()
  1531.         End Set
  1532.     End Property
  1533.  
  1534.     Public Property RoundRadius As Integer
  1535.         Get
  1536.             Return _RoundRadius
  1537.         End Get
  1538.         Set(value As Integer)
  1539.             _RoundRadius = value
  1540.             Invalidate()
  1541.         End Set
  1542.     End Property
  1543.  
  1544.     Public Property ProgressColor As Color
  1545.         Get
  1546.             Return _ProgressColor
  1547.         End Get
  1548.         Set(value As Color)
  1549.             _ProgressColor = value
  1550.             Invalidate()
  1551.         End Set
  1552.     End Property
  1553.     Public Property BaseColor As Color
  1554.         Get
  1555.             Return _BaseColor
  1556.         End Get
  1557.         Set(value As Color)
  1558.             _BaseColor = value
  1559.             Invalidate()
  1560.         End Set
  1561.     End Property
  1562.     Public Property BorderColor As Color
  1563.         Get
  1564.             Return _BorderColor
  1565.         End Get
  1566.         Set(value As Color)
  1567.             _BorderColor = value
  1568.             Invalidate()
  1569.         End Set
  1570.     End Property
  1571.  
  1572. #End Region
  1573.  
  1574. #Region " Draw Control "
  1575.  
  1576.     Protected Overrides Sub OnPaint(e As System.Windows.Forms.PaintEventArgs)
  1577.  
  1578.         Using B As New Bitmap(Width, Height), G As Graphics = Graphics.FromImage(B)
  1579.  
  1580.             G.SmoothingMode = SmoothingMode.HighQuality
  1581.  
  1582.             Dim CurrentValue As Integer = CInt(Value / Maximum * Width)
  1583.  
  1584.             Dim Rect As New Rectangle(0, 0, Width - 1, Height - 1)
  1585.  
  1586.             FillRoundedPath(G, BaseColor, Rect, RoundRadius)
  1587.  
  1588.             DrawRoundedPath(G, BorderColor, 1, Rect, RoundRadius)
  1589.  
  1590.             If Not CurrentValue = 0 Then
  1591.  
  1592.                 FillRoundedPath(G, ProgressColor, New Rectangle(Rect.X, Rect.Y, CurrentValue, Rect.Height), RoundRadius)
  1593.  
  1594.             End If
  1595.             e.Graphics.DrawImage(B, 0, 0)
  1596.             G.Dispose()
  1597.             B.Dispose()
  1598.         End Using
  1599.     End Sub
  1600.  
  1601. #End Region
  1602.  
  1603. End Class
  1604.  
  1605. #End Region
  1606.  
  1607. #Region " Lable "
  1608.  
  1609. Public Class EtherealLabel : Inherits Control
  1610.  
  1611. #Region " Variables "
  1612.  
  1613.     Private _ColorStyle As Style = Style.DarkPink
  1614.  
  1615. #End Region
  1616.  
  1617. #Region " Properties "
  1618.  
  1619.     Public Property ColorStyle As Style
  1620.         Get
  1621.             Return _ColorStyle
  1622.         End Get
  1623.         Set(value As Style)
  1624.             _ColorStyle = value
  1625.             Invalidate()
  1626.         End Set
  1627.     End Property
  1628.  
  1629. #End Region
  1630.  
  1631. #Region " Enumerators "
  1632.  
  1633.     Public Enum Style As Byte
  1634.         SemiBlack
  1635.         DarkPink
  1636.         LightPink
  1637.     End Enum
  1638.  
  1639. #End Region
  1640.  
  1641. #Region " Events "
  1642.  
  1643.     Protected Overrides Sub OnTextChanged(ByVal e As EventArgs)
  1644.         MyBase.OnTextChanged(e)
  1645.         Invalidate()
  1646.     End Sub
  1647.  
  1648. #End Region
  1649.  
  1650. #Region " Initialization "
  1651.  
  1652.     Sub New()
  1653.         SetStyle(ControlStyles.SupportsTransparentBackColor Or ControlStyles.UserPaint Or ControlStyles.OptimizedDoubleBuffer, True)
  1654.         DoubleBuffered = True
  1655.         Font = New Font("Montserrat", 10, FontStyle.Bold)
  1656.     End Sub
  1657.  
  1658. #End Region
  1659.  
  1660. #Region " Draw Control "
  1661.  
  1662.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  1663.         Dim G As Graphics = e.Graphics
  1664.         With G
  1665.             .TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
  1666.             Select Case ColorStyle
  1667.                 Case Style.SemiBlack
  1668.                     .DrawString(Text, Font, SolidBrushHTMlColor("222222"), ClientRectangle)
  1669.                 Case Style.DarkPink
  1670.                     .DrawString(Text, Font, SolidBrushHTMlColor("3b2551"), ClientRectangle)
  1671.                 Case Style.LightPink
  1672.                     .DrawString(Text, Font, SolidBrushHTMlColor("9d92a8"), ClientRectangle)
  1673.             End Select
  1674.         End With
  1675.     End Sub
  1676.  
  1677. #End Region
  1678.  
  1679. End Class
  1680.  
  1681. #End Region
  1682.  
  1683. #Region " Close "
  1684.  
  1685. Public Class EtherealClose : Inherits Control
  1686.  
  1687. #Region " Variable "
  1688.  
  1689.     Private State As MouseMode
  1690.     Private _NormalColor As Color = GetHTMLColor("3f2153")
  1691.     Private _HoverColor As Color = GetHTMLColor("f0f0f0")
  1692.     Private _PushedColor As Color = GetHTMLColor("966bc1")
  1693.     Private _TextColor As Color = Color.White
  1694.  
  1695. #End Region
  1696.  
  1697. #Region " Initialization "
  1698.  
  1699.     Sub New()
  1700.         SetStyle(ControlStyles.DoubleBuffer Or ControlStyles.AllPaintingInWmPaint Or _
  1701.         ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or _
  1702.         ControlStyles.SupportsTransparentBackColor, True)
  1703.         DoubleBuffered = True
  1704.         BackColor = Color.Transparent
  1705.         Font = New Font("Marlett", 8)
  1706.         Size = New Size(20, 20)
  1707.     End Sub
  1708.  
  1709. #End Region
  1710.  
  1711. #Region " Properties "
  1712.  
  1713.     Public Property NormalColor As Color
  1714.         Get
  1715.             Return _NormalColor
  1716.         End Get
  1717.         Set(value As Color)
  1718.             _NormalColor = value
  1719.             Invalidate()
  1720.         End Set
  1721.     End Property
  1722.  
  1723.     Public Property HoverColor As Color
  1724.         Get
  1725.             Return _HoverColor
  1726.         End Get
  1727.         Set(value As Color)
  1728.             _HoverColor = value
  1729.             Invalidate()
  1730.         End Set
  1731.     End Property
  1732.  
  1733.     Public Property PushedColor As Color
  1734.         Get
  1735.             Return _PushedColor
  1736.         End Get
  1737.         Set(value As Color)
  1738.             _PushedColor = value
  1739.             Invalidate()
  1740.         End Set
  1741.     End Property
  1742.  
  1743.     Public Property TextColor As Color
  1744.         Get
  1745.             Return _TextColor
  1746.         End Get
  1747.         Set(value As Color)
  1748.             _TextColor = value
  1749.             Invalidate()
  1750.         End Set
  1751.     End Property
  1752.  
  1753. #End Region
  1754.  
  1755. #Region " Draw Control "
  1756.  
  1757.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  1758.  
  1759.         Using B As New Bitmap(Width, Height), G As Graphics = Graphics.FromImage(B)
  1760.  
  1761.             With G
  1762.  
  1763.                 .SmoothingMode = SmoothingMode.HighQuality
  1764.  
  1765.                 .TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
  1766.  
  1767.                 .PixelOffsetMode = PixelOffsetMode.HighQuality
  1768.  
  1769.                 Select Case State
  1770.                     Case MouseMode.NormalMode
  1771.                         .FillEllipse(New SolidBrush(NormalColor), 1, 1, 19, 19)
  1772.                     Case MouseMode.Hovered
  1773.                         Cursor = Cursors.Hand
  1774.                         .FillEllipse(New SolidBrush(NormalColor), 1, 1, 19, 19)
  1775.                         .DrawEllipse(New Pen(HoverColor, 2), 1, 1, 18, 18)
  1776.                     Case MouseMode.Pushed
  1777.                         .FillEllipse(New SolidBrush(PushedColor), 1, 1, 19, 19)
  1778.                 End Select
  1779.  
  1780.                 .DrawString("r", Font, New SolidBrush(TextColor), New Rectangle(4, 6, 18, 18))
  1781.  
  1782.             End With
  1783.  
  1784.             e.Graphics.DrawImage(B.Clone, 0, 0)
  1785.             G.Dispose() : B.Dispose()
  1786.  
  1787.         End Using
  1788.  
  1789.     End Sub
  1790.  
  1791. #End Region
  1792.  
  1793. #Region " Events "
  1794.  
  1795.     Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  1796.         MyBase.OnMouseUp(e)
  1797.         State = MouseMode.Hovered : Invalidate()
  1798.     End Sub
  1799.  
  1800.     Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  1801.         MyBase.OnMouseUp(e)
  1802.         State = MouseMode.Pushed : Invalidate()
  1803.     End Sub
  1804.  
  1805.     Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
  1806.         MyBase.OnMouseEnter(e)
  1807.         State = MouseMode.Hovered : Invalidate()
  1808.     End Sub
  1809.  
  1810.     Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
  1811.         MyBase.OnMouseEnter(e)
  1812.         State = MouseMode.NormalMode : Invalidate()
  1813.     End Sub
  1814.  
  1815.     Protected Overrides Sub OnResize(e As EventArgs)
  1816.         MyBase.OnResize(e)
  1817.         Size = New Size(20, 20)
  1818.     End Sub
  1819.  
  1820.     Protected Overrides Sub OnClick(e As EventArgs)
  1821.         MyBase.OnClick(e)
  1822.         Environment.Exit(0)
  1823.         Application.Exit()
  1824.     End Sub
  1825.  
  1826. #End Region
  1827.  
  1828. End Class
  1829.  
  1830. #End Region
  1831.  
  1832. #Region " Minimize "
  1833.  
  1834. Public Class EtherealMinimize : Inherits Control
  1835.  
  1836. #Region " Variables "
  1837.  
  1838.     Private State As MouseMode
  1839.     Private _NormalColor As Color = GetHTMLColor("3f2153")
  1840.     Private _HoverColor As Color = GetHTMLColor("f0f0f0")
  1841.     Private _PushedColor As Color = GetHTMLColor("966bc1")
  1842.     Private _TextColor As Color = Color.White
  1843.  
  1844. #End Region
  1845.  
  1846. #Region " Initialization "
  1847.  
  1848.     Sub New()
  1849.         SetStyle(ControlStyles.DoubleBuffer Or ControlStyles.AllPaintingInWmPaint Or _
  1850.         ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or _
  1851.         ControlStyles.Selectable Or ControlStyles.SupportsTransparentBackColor, True)
  1852.         DoubleBuffered = True
  1853.         BackColor = Color.Transparent
  1854.         Font = New Font("Marlett", 8)
  1855.         Size = New Size(21, 21)
  1856.     End Sub
  1857.  
  1858. #End Region
  1859.  
  1860. #Region " Properties "
  1861.  
  1862.     Public Property NormalColor As Color
  1863.         Get
  1864.             Return _NormalColor
  1865.         End Get
  1866.         Set(value As Color)
  1867.             _NormalColor = value
  1868.             Invalidate()
  1869.         End Set
  1870.     End Property
  1871.  
  1872.     Public Property HoverColor As Color
  1873.         Get
  1874.             Return _HoverColor
  1875.         End Get
  1876.         Set(value As Color)
  1877.             _HoverColor = value
  1878.             Invalidate()
  1879.         End Set
  1880.     End Property
  1881.  
  1882.     Public Property PushedColor As Color
  1883.         Get
  1884.             Return _PushedColor
  1885.         End Get
  1886.         Set(value As Color)
  1887.             _PushedColor = value
  1888.             Invalidate()
  1889.         End Set
  1890.     End Property
  1891.  
  1892.     Public Property TextColor As Color
  1893.         Get
  1894.             Return _TextColor
  1895.         End Get
  1896.         Set(value As Color)
  1897.             _TextColor = value
  1898.             Invalidate()
  1899.         End Set
  1900.     End Property
  1901.  
  1902. #End Region
  1903.  
  1904. #Region " Draw Control "
  1905.  
  1906.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  1907.  
  1908.         Using B As New Bitmap(Width, Height), G As Graphics = Graphics.FromImage(B)
  1909.  
  1910.             With G
  1911.                
  1912.                 .SmoothingMode = SmoothingMode.HighQuality
  1913.  
  1914.                 .TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
  1915.  
  1916.                 Select Case State
  1917.                     Case MouseMode.NormalMode
  1918.                          .FillEllipse(New SolidBrush(NormalColor), 1, 1, 19, 19)
  1919.                     Case MouseMode.Hovered
  1920.                         Cursor = Cursors.Hand
  1921.                         .FillEllipse(New SolidBrush(NormalColor), 1, 1, 19, 19)
  1922.                         .DrawEllipse(New Pen(HoverColor, 2), 1, 1, 18, 18)
  1923.                     Case MouseMode.Pushed
  1924.                         .FillEllipse(New SolidBrush(PushedColor), 1, 1, 19, 19)
  1925.                 End Select
  1926.  
  1927.  
  1928.                 .DrawString("0", Font, New SolidBrush(TextColor), New Rectangle(4.6, 2.6, 18, 18))
  1929.  
  1930.             End With
  1931.  
  1932.             e.Graphics.DrawImage(B, 0, 0)
  1933.             G.Dispose() : B.Dispose()
  1934.  
  1935.         End Using
  1936.  
  1937.     End Sub
  1938.  
  1939. #End Region
  1940.  
  1941. #Region " Events "
  1942.  
  1943.     Protected Overrides Sub OnResize(e As EventArgs)
  1944.         MyBase.OnResize(e)
  1945.         Size = New Size(21, 21)
  1946.     End Sub
  1947.  
  1948.     Protected Overrides Sub OnClick(e As EventArgs)
  1949.         MyBase.OnClick(e)
  1950.         If FindForm.WindowState = FormWindowState.Normal Then
  1951.             FindForm.WindowState = FormWindowState.Minimized
  1952.         End If
  1953.     End Sub
  1954.  
  1955.     Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  1956.         MyBase.OnMouseUp(e)
  1957.         State = MouseMode.Hovered : Invalidate()
  1958.     End Sub
  1959.  
  1960.     Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  1961.         MyBase.OnMouseUp(e)
  1962.         State = MouseMode.Pushed : Invalidate()
  1963.     End Sub
  1964.  
  1965.     Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
  1966.         MyBase.OnMouseEnter(e)
  1967.         State = MouseMode.Hovered : Invalidate()
  1968.     End Sub
  1969.  
  1970.     Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
  1971.         MyBase.OnMouseEnter(e)
  1972.         State = MouseMode.NormalMode : Invalidate()
  1973.     End Sub
  1974.  
  1975. #End Region
  1976.  
  1977. End Class
  1978.  
  1979. #End Region
  1980.  
  1981. #Region " Maximize "
  1982.  
  1983. Public Class EtherealMaximize : Inherits Control
  1984.  
  1985. #Region " Variables "
  1986.  
  1987.     Private State As MouseMode
  1988.     Private _NormalColor As Color = GetHTMLColor("3f2153")
  1989.     Private _HoverColor As Color = GetHTMLColor("f0f0f0")
  1990.     Private _PushedColor As Color = GetHTMLColor("966bc1")
  1991.     Private _TextColor As Color = Color.White
  1992.  
  1993. #End Region
  1994.  
  1995. #Region " Initialization "
  1996.  
  1997.     Sub New()
  1998.         SetStyle(ControlStyles.DoubleBuffer Or ControlStyles.AllPaintingInWmPaint Or _
  1999.         ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or _
  2000.         ControlStyles.Selectable Or ControlStyles.SupportsTransparentBackColor, True)
  2001.         DoubleBuffered = True
  2002.         BackColor = Color.Transparent
  2003.         Font = New Font("Marlett", 9)
  2004.         Size = New Size(22, 22)
  2005.     End Sub
  2006.  
  2007. #End Region
  2008.  
  2009. #Region " Properties "
  2010.  
  2011.     Public Property NormalColor As Color
  2012.         Get
  2013.             Return _NormalColor
  2014.         End Get
  2015.         Set(value As Color)
  2016.             _NormalColor = value
  2017.             Invalidate()
  2018.         End Set
  2019.     End Property
  2020.  
  2021.     Public Property HoverColor As Color
  2022.         Get
  2023.             Return _HoverColor
  2024.         End Get
  2025.         Set(value As Color)
  2026.             _HoverColor = value
  2027.             Invalidate()
  2028.         End Set
  2029.     End Property
  2030.  
  2031.     Public Property PushedColor As Color
  2032.         Get
  2033.             Return _PushedColor
  2034.         End Get
  2035.         Set(value As Color)
  2036.             _PushedColor = value
  2037.             Invalidate()
  2038.         End Set
  2039.     End Property
  2040.  
  2041.     Public Property TextColor As Color
  2042.         Get
  2043.             Return _TextColor
  2044.         End Get
  2045.         Set(value As Color)
  2046.             _TextColor = value
  2047.             Invalidate()
  2048.         End Set
  2049.     End Property
  2050.  
  2051. #End Region
  2052.  
  2053. #Region " Draw Control "
  2054.  
  2055.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  2056.  
  2057.         Using B As New Bitmap(Width, Height), G As Graphics = Graphics.FromImage(B)
  2058.  
  2059.             With G
  2060.              
  2061.                 .SmoothingMode = SmoothingMode.HighQuality
  2062.  
  2063.                 .TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
  2064.  
  2065.                 Select Case State
  2066.                     Case MouseMode.NormalMode
  2067.                          .FillEllipse(New SolidBrush(NormalColor), 1, 1, 19, 19)
  2068.                     Case MouseMode.Hovered
  2069.                         Cursor = Cursors.Hand
  2070.                         .FillEllipse(New SolidBrush(NormalColor), 1, 1, 19, 19)
  2071.                         .DrawEllipse(New Pen(HoverColor, 2), 1, 1, 18, 18)
  2072.                     Case MouseMode.Pushed
  2073.                         .FillEllipse(New SolidBrush(PushedColor), 1, 1, 19, 19)
  2074.                 End Select
  2075.  
  2076.                 .DrawString("v", Font, New SolidBrush(TextColor), New Rectangle(3.4, 5, 18, 18))
  2077.  
  2078.  
  2079.             End With
  2080.  
  2081.             e.Graphics.DrawImage(B.Clone, 0, 0)
  2082.             G.Dispose() : B.Dispose()
  2083.  
  2084.         End Using
  2085.  
  2086.     End Sub
  2087.  
  2088. #End Region
  2089.  
  2090. #Region " Events "
  2091.  
  2092.     Protected Overrides Sub OnResize(e As EventArgs)
  2093.         MyBase.OnResize(e)
  2094.         Size = New Size(22, 22)
  2095.     End Sub
  2096.  
  2097.     Protected Overrides Sub OnClick(e As EventArgs)
  2098.         MyBase.OnClick(e)
  2099.         If FindForm.WindowState = FormWindowState.Normal Then
  2100.             FindForm.WindowState = FormWindowState.Maximized
  2101.         Else
  2102.             FindForm.WindowState = FormWindowState.Normal
  2103.         End If
  2104.     End Sub
  2105.  
  2106.     Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  2107.         MyBase.OnMouseUp(e)
  2108.         State = MouseMode.Hovered : Invalidate()
  2109.     End Sub
  2110.  
  2111.     Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  2112.         MyBase.OnMouseUp(e)
  2113.         State = MouseMode.Pushed : Invalidate()
  2114.     End Sub
  2115.  
  2116.     Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
  2117.         MyBase.OnMouseEnter(e)
  2118.         State = MouseMode.Hovered : Invalidate()
  2119.     End Sub
  2120.  
  2121.     Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
  2122.         MyBase.OnMouseEnter(e)
  2123.         State = MouseMode.NormalMode : Invalidate()
  2124.     End Sub
  2125.  
  2126. #End Region
  2127.  
  2128. End Class
  2129.  
  2130. #End Region
Add Comment
Please, Sign In to add comment