THE_LORD

GreenUI Theme

Dec 17th, 2016
389
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 49.87 KB | None | 0 0
  1.  
  2. '' <summary>
  3. '' GreenUI Theme
  4. '' Author : THE LORD
  5. '' Release Date : Saturday, December 17, 2016
  6. '' Last Update : Monday, January 9, 2017
  7. '' Update Purpose : Bugs Fixed, ComboBox & TabControl Added.
  8. '' </summary>
  9.  
  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.     Public Function ShadowBrush(ByVal R As Rectangle, ByVal C As Color, ByVal Intesity As Integer, ByVal angle As Integer) As LinearGradientBrush
  41.         Return New LinearGradientBrush(R, Color.FromArgb(Intesity, C), Color.Transparent, angle)
  42.     End Function
  43.  
  44.     Public Sub FillRoundedPath(ByVal G As Graphics, ByVal C As Color, ByVal Rect As Rectangle, ByVal Curve As Integer, _
  45.                                  Optional ByVal TopLeft As Boolean = True, Optional ByVal TopRight As Boolean = True, _
  46.                                  Optional ByVal BottomLeft As Boolean = True, Optional ByVal BottomRight As Boolean = True)
  47.         With G
  48.             .FillPath(New SolidBrush(C), RoundRec(Rect, Curve, TopLeft, TopRight, BottomLeft, BottomRight))
  49.         End With
  50.     End Sub
  51.  
  52.     Public Sub FillRoundedPath(ByVal G As Graphics, ByVal B As Brush, ByVal Rect As Rectangle, ByVal Curve As Integer, _
  53.                                  Optional ByVal TopLeft As Boolean = True, Optional ByVal TopRight As Boolean = True, _
  54.                                  Optional ByVal BottomLeft As Boolean = True, Optional ByVal BottomRight As Boolean = True)
  55.         With G
  56.             .FillPath(B, RoundRec(Rect, Curve, TopLeft, TopRight, BottomLeft, BottomRight))
  57.         End With
  58.     End Sub
  59.  
  60.     Public Sub DrawRoundedPath(ByVal G As Graphics, ByVal C As Color, ByVal Size As Single, ByVal Rect As Rectangle, ByVal Curve As Integer, _
  61.                                  Optional ByVal TopLeft As Boolean = True, Optional ByVal TopRight As Boolean = True, _
  62.                                  Optional ByVal BottomLeft As Boolean = True, Optional ByVal BottomRight As Boolean = True)
  63.         With G
  64.             .DrawPath(New Pen(C, Size), RoundRec(Rect, Curve, TopLeft, TopRight, BottomLeft, BottomRight))
  65.         End With
  66.     End Sub
  67.  
  68.     Public Function Triangle(ByVal Clr As Color, ByVal P1 As Point, ByVal P2 As Point, ByVal P3 As Point) As Point()
  69.         Return New Point() {P1, P2, P3}
  70.     End Function
  71.  
  72.     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
  73.         Return New Pen(Color.FromArgb(R, G, B), Size)
  74.     End Function
  75.  
  76.     Public Function PenHTMlColor(ByVal C_WithoutHash As String, ByVal Size As Single) As Pen
  77.         Return New Pen(GetHTMLColor(C_WithoutHash), Size)
  78.     End Function
  79.  
  80.     Public Function SolidBrushRGBColor(ByVal R As Integer, ByVal G As Integer, ByVal B As Integer, Optional ByVal A As Integer = 0) As SolidBrush
  81.         Return New SolidBrush(Color.FromArgb(A, R, G, B))
  82.     End Function
  83.  
  84.     Public Function SolidBrushHTMlColor(ByVal C_WithoutHash As String) As SolidBrush
  85.         Return New SolidBrush(GetHTMLColor(C_WithoutHash))
  86.     End Function
  87.  
  88.     Public Function GetHTMLColor(ByVal C_WithoutHash As String) As Color
  89.         Return ColorTranslator.FromHtml("#" & C_WithoutHash)
  90.     End Function
  91.  
  92.     Public Function ColorToHTML(ByVal C As Color) As String
  93.         Return ColorTranslator.ToHtml(C)
  94.     End Function
  95.  
  96.     Public Sub CentreString(ByVal G As Graphics, ByVal Text As String, ByVal font As Font, ByVal brush As Brush, ByVal Rect As Rectangle)
  97.         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})
  98.     End Sub
  99.  
  100.     Public Sub LeftString(ByVal G As Graphics, ByVal Text As String, ByVal font As Font, ByVal brush As Brush, ByVal Rect As Rectangle)
  101.         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})
  102.     End Sub
  103.  
  104.     Public Sub RightString(ByVal G As Graphics, ByVal Text As String, ByVal font As Font, ByVal brush As Brush, ByVal Rect As Rectangle)
  105.         G.DrawString(Text, font, brush, New Rectangle(4, Rect.Y + (Rect.Height / 2) - (G.MeasureString(Text, font).Height / 2), Rect.Width - Rect.Height + 10, Rect.Height), New StringFormat With {.Alignment = StringAlignment.Far})
  106.     End Sub
  107.  
  108.  
  109. #Region " Round Border "
  110.  
  111.     ''' <summary>
  112.     ''' Credits : AeonHack
  113.     ''' </summary>
  114.  
  115.     Public Function RoundRec(ByVal r As Rectangle, ByVal Curve As Integer, _
  116.                                  Optional ByVal TopLeft As Boolean = True, Optional ByVal TopRight As Boolean = True, _
  117.                                  Optional ByVal BottomLeft As Boolean = True, Optional ByVal BottomRight As Boolean = True) As GraphicsPath
  118.         Dim CreateRoundPath As New GraphicsPath(FillMode.Winding)
  119.         If TopLeft Then
  120.             CreateRoundPath.AddArc(r.X, r.Y, Curve, Curve, 180.0F, 90.0F)
  121.         Else
  122.             CreateRoundPath.AddLine(r.X, r.Y, r.X, r.Y)
  123.         End If
  124.         If TopRight Then
  125.             CreateRoundPath.AddArc(r.Right - Curve, r.Y, Curve, Curve, 270.0F, 90.0F)
  126.         Else
  127.             CreateRoundPath.AddLine(r.Right - r.Width, r.Y, r.Width, r.Y)
  128.         End If
  129.         If BottomRight Then
  130.             CreateRoundPath.AddArc(r.Right - Curve, r.Bottom - Curve, Curve, Curve, 0.0F, 90.0F)
  131.         Else
  132.             CreateRoundPath.AddLine(r.Right, r.Bottom, r.Right, r.Bottom)
  133.  
  134.         End If
  135.         If BottomLeft Then
  136.             CreateRoundPath.AddArc(r.X, r.Bottom - Curve, Curve, Curve, 90.0F, 90.0F)
  137.         Else
  138.             CreateRoundPath.AddLine(r.X, r.Bottom, r.X, r.Bottom)
  139.         End If
  140.         CreateRoundPath.CloseFigure()
  141.         Return CreateRoundPath
  142.     End Function
  143.  
  144. #End Region
  145.  
  146.  
  147.  
  148. End Module
  149.  
  150. #End Region
  151.  
  152. #Region " Skin "
  153.  
  154. Public Class GreenUISkin : Inherits ContainerControl
  155.  
  156. #Region " Variables "
  157.  
  158.     Private Movable As Boolean = False
  159.     Private MousePoint As New Point(0, 0)
  160.     Private MoveHeight = 50
  161.     Private _TitleTextPostion As TitlePostion = TitlePostion.Left
  162.     Private Property _ShowIcon As Boolean = False
  163. #End Region
  164.  
  165. #Region " Properties"
  166.  
  167.     Public Overridable Shadows Property ShowIcon As Boolean
  168.         Get
  169.             Return _ShowIcon
  170.         End Get
  171.         Set(ByVal value As Boolean)
  172.             _ShowIcon = value
  173.             Invalidate()
  174.         End Set
  175.     End Property
  176.  
  177.     Public Overridable Property TitleTextPostion As TitlePostion
  178.         Get
  179.             Return _TitleTextPostion
  180.         End Get
  181.         Set(value As TitlePostion)
  182.             _TitleTextPostion = value
  183.         End Set
  184.     End Property
  185.  
  186.     Enum TitlePostion
  187.         Left
  188.         Center
  189.     End Enum
  190.  
  191. #End Region
  192.  
  193. #Region " Initialization "
  194.  
  195.     Sub New()
  196.  
  197.         SetStyle(ControlStyles.UserPaint Or ControlStyles.AllPaintingInWmPaint Or ControlStyles.DoubleBuffer Or ControlStyles.ResizeRedraw Or ControlStyles.SupportsTransparentBackColor Or ControlStyles.Opaque Or ControlStyles.OptimizedDoubleBuffer, True)
  198.         DoubleBuffered = True
  199.         UpdateStyles()
  200.         Font = New Font("Proxima Nova", 14, FontStyle.Bold)
  201.         BackColor = Color.Gainsboro
  202.  
  203.     End Sub
  204.  
  205. #End Region
  206.  
  207. #Region " Draw Control "
  208.  
  209.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  210.         Using B As New Bitmap(Width, Height), G = Graphics.FromImage(B)
  211.  
  212.             With G
  213.                 .Clear(Color.Fuchsia)
  214.  
  215.                 .TextRenderingHint = Drawing.Text.TextRenderingHint.ClearTypeGridFit
  216.                 FillRoundedPath(G, Color.Gainsboro, New Rectangle(1, 1, Width - 2.5, Height - 2.5), 5)
  217.                 FillRoundedPath(G, GetHTMLColor("097A74"), New Rectangle(1, 1, Width - 2, 50), 5, True, True, False, False)
  218.                 .DrawLine(PenHTMlColor("066762", 1), New Point(1, 51), New Point(Width - 2, 51))
  219.  
  220.                 If ShowIcon Then
  221.                     .DrawIcon(FindForm.Icon, New Rectangle(5, 13, 20, 20))
  222.                     Select Case TitleTextPostion
  223.                         Case TitlePostion.Left
  224.                             .DrawString(Text, Font, Brushes.White, 27, 14)
  225.                         Case TitlePostion.Center
  226.                             CentreString(G, Text, Font, Brushes.White, New Rectangle(0, 0, Width, 50))
  227.                     End Select
  228.                 Else
  229.                     Select Case TitleTextPostion
  230.                         Case TitlePostion.Left
  231.                             .DrawString(Text, Font, Brushes.White, 5, 14)
  232.                         Case TitlePostion.Center
  233.                             CentreString(G, Text, Font, Brushes.White, New Rectangle(0, 0, Width, 50))
  234.  
  235.                     End Select
  236.                 End If
  237.             End With
  238.             e.Graphics.DrawImage(B.Clone, 0, 0)
  239.             G.Dispose() : B.Dispose()
  240.         End Using
  241.  
  242.     End Sub
  243.  
  244. #End Region
  245.  
  246. #Region " Mouse & Other Events "
  247.  
  248.     Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  249.         MyBase.OnMouseDown(e)
  250.         If e.Button = Windows.Forms.MouseButtons.Left And New Rectangle(0, 0, Width, MoveHeight).Contains(e.Location) Then
  251.             Movable = True
  252.             MousePoint = e.Location
  253.         End If
  254.     End Sub
  255.  
  256.     Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  257.         MyBase.OnMouseUp(e) : Movable = False
  258.     End Sub
  259.  
  260.     Protected Overrides Sub OnMouseMove(ByVal e As MouseEventArgs)
  261.         MyBase.OnMouseMove(e)
  262.         If Movable Then Parent.Location = MousePosition - MousePoint
  263.     End Sub
  264.  
  265.     Protected Overrides Sub OnCreateControl()
  266.         MyBase.OnCreateControl()
  267.         ParentForm.FormBorderStyle = FormBorderStyle.None
  268.         ParentForm.TransparencyKey = Color.Fuchsia
  269.         Dock = DockStyle.Fill
  270.     End Sub
  271.  
  272. #End Region
  273.  
  274. End Class
  275.  
  276. #End Region
  277.  
  278. #Region " Switch "
  279.  
  280. <DefaultEvent("CheckedChanged")> _
  281. Public Class GreenUISwitch : Inherits Control
  282.  
  283. #Region " Variables "
  284.  
  285.     Private _Switch As Boolean = False
  286.     Private State As MouseMode
  287.     Private _ForeColor As Color = Color.Gray
  288.  
  289. #End Region
  290.  
  291. #Region " Properties "
  292.  
  293.     Public Property Switched() As Boolean
  294.         Get
  295.             Return _Switch
  296.         End Get
  297.         Set(ByVal value As Boolean)
  298.             _Switch = value
  299.             Invalidate()
  300.         End Set
  301.     End Property
  302.  
  303. #End Region
  304.  
  305. #Region " Initialization "
  306.  
  307.     Sub New()
  308.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or _
  309.                     ControlStyles.OptimizedDoubleBuffer Or ControlStyles.SupportsTransparentBackColor, True)
  310.         DoubleBuffered = True
  311.         BackColor = Color.Transparent
  312.         Cursor = Cursors.Hand
  313.         Size = New Size(70, 28)
  314.     End Sub
  315.  
  316. #End Region
  317.  
  318. #Region " Draw Control "
  319.  
  320.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  321.  
  322.         Using B As New Bitmap(Width, Height), G As Graphics = Graphics.FromImage(B)
  323.  
  324.             With G
  325.                 .SmoothingMode = SmoothingMode.HighQuality
  326.                 .TextRenderingHint = Drawing.Text.TextRenderingHint.ClearTypeGridFit
  327.                 If Switched Then
  328.  
  329.                     FillRoundedPath(G, GetHTMLColor("097A74"), New Rectangle(0, 0, 70, 27), 8)
  330.  
  331.                     FillRoundedPath(G, Color.WhiteSmoke, New Rectangle(Width - 28.5, 1.5, 25, 23), 8)
  332.                     .DrawLine(Pens.Gray, Width - 14, 8, Width - 14, 18)
  333.                     .DrawLine(Pens.Gray, Width - 16, 8, Width - 16, 18)
  334.                     .DrawLine(Pens.Gray, Width - 18, 8, Width - 18, 18)
  335.                     DrawRoundedPath(G, GetHTMLColor("056b65"), 1, New Rectangle(0, 0, 69, 27), 8)
  336.                     .DrawString("ON", New Font("Proxima Nova", 10, FontStyle.Bold), Brushes.WhiteSmoke, New Point(Width - 62, 6))
  337.                 Else
  338.  
  339.                     FillRoundedPath(G, Color.Silver, New Rectangle(0, 0, 70, 27), 8)
  340.  
  341.                     FillRoundedPath(G, Color.WhiteSmoke, New Rectangle(3, 1.5, 25, 23), 8)
  342.                     .DrawLine(Pens.Gray, 13, 8, 13, 18)
  343.                     .DrawLine(Pens.Gray, 15, 8, 15, 18)
  344.                     .DrawLine(Pens.Gray, 17, 8, 17, 18)
  345.                     DrawRoundedPath(G, GetHTMLColor("bbbaba"), 1, New Rectangle(0, 0, 69, 27), 8)
  346.                     .DrawString("OFF", New Font("Proxima Nova", 10, FontStyle.Bold), Brushes.WhiteSmoke, New Point(31, 6))
  347.  
  348.                 End If
  349.  
  350.             End With
  351.  
  352.             e.Graphics.DrawImage(B.Clone(), 0, 0)
  353.             G.Dispose() : B.Dispose()
  354.  
  355.         End Using
  356.  
  357.     End Sub
  358.  
  359. #End Region
  360.  
  361. #Region " Mouse & Other Events "
  362.  
  363.     Event CheckedChanged(ByVal sender As Object)
  364.  
  365.     Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  366.         MyBase.OnMouseDown(e)
  367.         State = MouseMode.Pushed : Invalidate()
  368.     End Sub
  369.  
  370.     Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  371.         MyBase.OnMouseUp(e)
  372.         State = MouseMode.Hovered : Invalidate()
  373.     End Sub
  374.  
  375.     Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
  376.         MyBase.OnMouseEnter(e)
  377.         State = MouseMode.Hovered : Invalidate()
  378.     End Sub
  379.  
  380.     Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
  381.         MyBase.OnMouseLeave(e)
  382.         State = MouseMode.NormalMode : Invalidate()
  383.     End Sub
  384.  
  385.     Protected Overrides Sub OnClick(ByVal e As EventArgs)
  386.         _Switch = Not _Switch
  387.         RaiseEvent CheckedChanged(Me)
  388.         MyBase.OnClick(e)
  389.     End Sub
  390.  
  391.     Protected Overrides Sub OnResize(ByVal e As EventArgs)
  392.         MyBase.OnResize(e)
  393.         Size = New Size(70, 28)
  394.     End Sub
  395.  
  396. #End Region
  397.  
  398. End Class
  399.  
  400. #End Region
  401.  
  402. #Region " TrackBar "
  403.  
  404. <DefaultEvent("Scroll")> Public Class GreenUITrackBar : Inherits Control
  405.  
  406. #Region " Variables "
  407.  
  408.     Private Variable As Boolean
  409.     Private Track As Rectangle
  410.     Private _Maximum As Integer = 100
  411.     Private _Minimum As Integer
  412.     Private _Value As Integer
  413.     Private CurrentValue As Integer = CInt(Value / Maximum * Width)
  414.     Private P1, P2, P3, P4, P5, P6 As Point
  415.  
  416. #End Region
  417.  
  418. #Region " Properties "
  419.  
  420.     Property Maximum As Integer
  421.         Get
  422.             Return _Maximum
  423.         End Get
  424.         Set(ByVal value As Integer)
  425.             _Maximum = value
  426.             RenewCurrentValue()
  427.             MoveTrack()
  428.             Invalidate()
  429.         End Set
  430.  
  431.     End Property
  432.  
  433.     Property Minimum As Integer
  434.         Get
  435.             Return _Minimum
  436.         End Get
  437.         Set(ByVal value As Integer)
  438.             If Not value < 0 Then
  439.                 _Minimum = value
  440.                 RenewCurrentValue()
  441.                 MoveTrack()
  442.                 Invalidate()
  443.             End If
  444.         End Set
  445.     End Property
  446.  
  447.     Property Value As Integer
  448.         Get
  449.             Return _Value
  450.         End Get
  451.         Set(ByVal value As Integer)
  452.             If value <> _Value Then
  453.                 _Value = value
  454.                 RenewCurrentValue()
  455.                 MoveTrack()
  456.                 RaiseEvent Scroll(Me)
  457.                 Invalidate()
  458.             End If
  459.         End Set
  460.  
  461.     End Property
  462.  
  463. #End Region
  464.  
  465. #Region " Initialization "
  466.  
  467.     Sub New()
  468.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or _
  469.         ControlStyles.ResizeRedraw Or ControlStyles.SupportsTransparentBackColor Or ControlStyles.UserPaint, True)
  470.  
  471.         BackColor = Color.Transparent
  472.         DoubleBuffered = True
  473.  
  474.     End Sub
  475.  
  476. #End Region
  477.  
  478. #Region " Mouse & Other Events "
  479.  
  480.  
  481.     Event Scroll(ByVal sender As Object)
  482.  
  483.     Protected Overrides Sub OnKeyDown(ByVal e As KeyEventArgs)
  484.         If e.KeyCode = Keys.Subtract OrElse e.KeyCode = Keys.Down OrElse e.KeyCode = Keys.Left Then
  485.             If Value = 0 Then Exit Sub
  486.             Value -= 1
  487.         ElseIf e.KeyCode = Keys.Add OrElse e.KeyCode = Keys.Up OrElse e.KeyCode = Keys.Right Then
  488.             If Value = Maximum Then Exit Sub
  489.             Value += 1
  490.         End If
  491.         MyBase.OnKeyDown(e)
  492.     End Sub
  493.  
  494.     Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  495.         If e.Button = MouseButtons.Left AndAlso Height > 0 Then
  496.             RenewCurrentValue()
  497.             If Width > 0 AndAlso Height > 0 Then Track = New Rectangle(CurrentValue + 0.8, 0, 25, 24)
  498.  
  499.             Variable = New Rectangle(CurrentValue, 0, 24, Height).Contains(e.Location)
  500.         End If
  501.         MyBase.OnMouseDown(e)
  502.     End Sub
  503.  
  504.     Protected Overrides Sub OnMouseMove(ByVal e As MouseEventArgs)
  505.         If Variable AndAlso e.X > -1 AndAlso e.X < Width + 1 Then Value = Minimum + CInt((Maximum - Minimum) * (e.X / Width))
  506.         MyBase.OnMouseMove(e)
  507.     End Sub
  508.  
  509.     Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  510.         Variable = False : MyBase.OnMouseUp(e)
  511.     End Sub
  512.  
  513.     Protected Overrides Sub OnResize(ByVal e As EventArgs)
  514.         If Width > 0 AndAlso Height > 0 Then
  515.             RenewCurrentValue()
  516.             MoveTrack()
  517.             Height = 25
  518.         End If
  519.  
  520.         Invalidate()
  521.         MyBase.OnResize(e)
  522.     End Sub
  523.  
  524.     Sub RenewCurrentValue()
  525.         CurrentValue = CInt((Value - Minimum) / (_Maximum - Minimum) * (Width - 25))
  526.     End Sub
  527.  
  528.     Public Sub MoveTrack()
  529.         If Height > 0 AndAlso Width > 0 Then Track = New Rectangle(CurrentValue - 0.4, 0, 25, 23)
  530.         P1 = New Point(CurrentValue + 9, Track.Y + 5)
  531.         P2 = New Point(CurrentValue + 9, Track.Height - 5)
  532.         P3 = New Point(CurrentValue + 12, Track.Y + 5)
  533.         P4 = New Point(CurrentValue + 12, Track.Height - 5)
  534.         P5 = New Point(CurrentValue + 15, Track.Y + 5)
  535.         P6 = New Point(CurrentValue + 15, Track.Height - 5)
  536.     End Sub
  537.  
  538. #End Region
  539.  
  540. #Region " Draw Control "
  541.  
  542.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  543.  
  544.         Using B As New Bitmap(Width, Height), G As Graphics = Graphics.FromImage(B)
  545.  
  546.             With G
  547.                 Cursor = Cursors.Hand
  548.                 .SmoothingMode = SmoothingMode.AntiAlias
  549.                 .PixelOffsetMode = PixelOffsetMode.HighQuality
  550.                 .InterpolationMode = InterpolationMode.HighQualityBicubic
  551.  
  552.                 FillRoundedPath(G, Color.Silver, New Rectangle(0, 5.5, Width, 12), 8)
  553.  
  554.                 DrawRoundedPath(G, Color.FromArgb(200, Color.DarkGray), 1, New Rectangle(0, 5.5, Width, 12), 8)
  555.  
  556.                 If Not CurrentValue = 0 Then
  557.                     FillRoundedPath(G, GetHTMLColor("097A74"), New Rectangle(0, 5.5, CurrentValue + 2, 12), 6)
  558.                 End If
  559.                 .PixelOffsetMode = PixelOffsetMode.None
  560.  
  561.  
  562.                 FillRoundedPath(G, GetHTMLColor("c2c2c2"), Track, 6)
  563.                 FillRoundedPath(G, Brushes.WhiteSmoke, Track, 6)
  564.                 DrawRoundedPath(G, Color.FromArgb(60, Color.DarkGray), 1, Track, 6)
  565.                 .DrawLine(Pens.Gray, P1, P2)
  566.                 .DrawLine(Pens.Gray, P3, P4)
  567.                 .DrawLine(Pens.Gray, P5, P6)
  568.  
  569.             End With
  570.  
  571.             e.Graphics.DrawImage(B.Clone, 0, 0)
  572.             G.Dispose() : B.Dispose()
  573.  
  574.         End Using
  575.     End Sub
  576.  
  577. #End Region
  578.  
  579. End Class
  580.  
  581. #End Region
  582.  
  583. #Region " Button "
  584.  
  585. Public Class GreenUIButton : Inherits Control
  586.  
  587. #Region " Variables "
  588.  
  589.     Private State As MouseMode
  590.  
  591. #End Region
  592.  
  593. #Region " Base "
  594.  
  595.     Sub New()
  596.         SetStyle(ControlStyles.DoubleBuffer Or ControlStyles.AllPaintingInWmPaint Or _
  597.         ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or _
  598.         ControlStyles.Selectable Or ControlStyles.SupportsTransparentBackColor, True)
  599.         DoubleBuffered = True
  600.         UpdateStyles()
  601.         Font = New Font("Proxima Nova", 10, FontStyle.Bold)
  602.     End Sub
  603.  
  604. #End Region
  605.  
  606. #Region " Procedures "
  607.  
  608.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  609.         Dim G As Graphics = e.Graphics
  610.         Dim Rect As Rectangle = New Rectangle(0, 0, Width - 1, Height - 1)
  611.         With G
  612.             .TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
  613.             .SmoothingMode = SmoothingMode.HighQuality
  614.  
  615.             Select Case State
  616.  
  617.                 Case MouseMode.NormalMode
  618.                     FillRoundedPath(G, GetHTMLColor("097A74"), Rect, 12)
  619.                     DrawRoundedPath(G, GetHTMLColor("e0e0e0"), 1, Rect, 12)
  620.                     CentreString(G, Text, Font, Brushes.White, Rect)
  621.  
  622.                 Case MouseMode.Hovered
  623.                     Cursor = Cursors.Hand
  624.                     FillRoundedPath(G, SolidBrushHTMlColor("06514C"), Rect, 12)
  625.                     DrawRoundedPath(G, GetHTMLColor("9d92a8"), 1, Rect, 12)
  626.                     CentreString(G, Text, Font, SolidBrushHTMlColor("ffffff"), Rect)
  627.  
  628.                 Case MouseMode.Pushed
  629.                     FillRoundedPath(G, GetHTMLColor("21272c"), Rect, 12)
  630.                     DrawRoundedPath(G, GetHTMLColor("444444"), 1, Rect, 12)
  631.                     CentreString(G, Text, Font, SolidBrushHTMlColor("444444"), Rect)
  632.  
  633.             End Select
  634.  
  635.         End With
  636.  
  637.     End Sub
  638.  
  639.     Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  640.         MyBase.OnMouseUp(e)
  641.         State = MouseMode.Hovered : Invalidate()
  642.     End Sub
  643.  
  644.     Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  645.         MyBase.OnMouseUp(e)
  646.         State = MouseMode.Pushed : Invalidate()
  647.     End Sub
  648.  
  649.     Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
  650.         MyBase.OnMouseEnter(e)
  651.         State = MouseMode.Hovered : Invalidate()
  652.     End Sub
  653.  
  654.     Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
  655.         MyBase.OnMouseEnter(e)
  656.         State = MouseMode.NormalMode : Invalidate()
  657.     End Sub
  658.  
  659. #End Region
  660.  
  661. End Class
  662.  
  663. #End Region
  664.  
  665. #Region " CheckBox "
  666.  
  667. <DefaultEvent("CheckedChanged")> _
  668. Public Class GreenUICheckBox : Inherits Control
  669.  
  670. #Region " Variables "
  671.  
  672.     Private _Checked As Boolean = False
  673.     Private State As MouseMode = MouseMode.NormalMode
  674.  
  675. #End Region
  676.  
  677. #Region " Properties "
  678.  
  679.     Protected Overrides Sub OnTextChanged(ByVal e As EventArgs)
  680.         MyBase.OnTextChanged(e)
  681.         Invalidate()
  682.     End Sub
  683.  
  684.     Property Checked() As Boolean
  685.         Get
  686.             Return _Checked
  687.         End Get
  688.         Set(ByVal value As Boolean)
  689.             _Checked = value
  690.             Invalidate()
  691.         End Set
  692.     End Property
  693.  
  694.     Protected Overrides Sub OnClick(ByVal e As EventArgs)
  695.         _Checked = Not _Checked
  696.         RaiseEvent CheckedChanged(Me)
  697.         MyBase.OnClick(e)
  698.     End Sub
  699.  
  700.     Protected Overrides Sub OnResize(ByVal e As EventArgs)
  701.         MyBase.OnResize(e)
  702.         Height = 20
  703.     End Sub
  704.  
  705.     Protected Overrides Sub OnCreateControl()
  706.         MyBase.OnCreateControl()
  707.         BackColor = Color.Transparent
  708.     End Sub
  709.  
  710. #End Region
  711.  
  712. #Region " Initialization "
  713.  
  714.     Sub New()
  715.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or _
  716.                    ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer _
  717.                    Or ControlStyles.SupportsTransparentBackColor Or ControlStyles.UseTextForAccessibility, True)
  718.         DoubleBuffered = True
  719.         BackColor = Color.Transparent
  720.         Cursor = Cursors.Hand
  721.         Size = New Size(200, 20)
  722.         Font = New font("Proxima Nova", 11, FontStyle.Regular)
  723.  
  724.     End Sub
  725.  
  726. #End Region
  727.  
  728. #Region " Draw Control "
  729.  
  730.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  731.         Using B As New Bitmap(Width, Height), G As Graphics = Graphics.FromImage(B)
  732.             With G
  733.  
  734.                 .TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
  735.                 .PixelOffsetMode = PixelOffsetMode.Half
  736.  
  737.                 If Checked Then
  738.                     FillRoundedPath(G, SolidBrushHTMlColor("097A74"), New Rectangle(4, 4, 12, 12), 2)
  739.                     DrawRoundedPath(G, GetHTMLColor("097A74"), 2, New Rectangle(1, 1, 18, 18), 2)
  740.                     .DrawString(Text, Font, SolidBrushHTMlColor("097A74"), New Rectangle(22, +1.6, Width, Height - 2), New StringFormat With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Center})
  741.                 Else
  742.                     FillRoundedPath(G, Color.Silver, New Rectangle(4, 4, 12, 12), 2)
  743.                     DrawRoundedPath(G, Color.Silver, 2, New Rectangle(1, 1, 18, 18), 2)
  744.                     .DrawString(Text, Font, New SolidBrush(Color.DimGray), New Rectangle(22, +1.6, Width, Height - 2), New StringFormat With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Center})
  745.                 End If
  746.  
  747.             End With
  748.  
  749.             e.Graphics.DrawImage(B.Clone(), 0, 0)
  750.             G.Dispose() : B.Dispose()
  751.         End Using
  752.     End Sub
  753.  
  754. #End Region
  755.  
  756. #Region " Mouse Events "
  757.  
  758.     Event CheckedChanged(ByVal sender As Object)
  759.  
  760.     Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  761.         MyBase.OnMouseDown(e)
  762.         State = MouseMode.Pushed : Invalidate()
  763.     End Sub
  764.     Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  765.         MyBase.OnMouseUp(e)
  766.         State = MouseMode.Hovered : Invalidate()
  767.     End Sub
  768.     Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
  769.         MyBase.OnMouseEnter(e)
  770.         State = MouseMode.Hovered : Invalidate()
  771.     End Sub
  772.     Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
  773.         MyBase.OnMouseLeave(e)
  774.         State = MouseMode.NormalMode : Invalidate()
  775.     End Sub
  776.  
  777. #End Region
  778.  
  779. End Class
  780.  
  781. #End Region
  782.  
  783. #Region " RadioButton "
  784.  
  785. <DefaultEvent("CheckedChanged")> Public Class GreenUIRadioButton : Inherits Control
  786.  
  787. #Region " Variables "
  788.  
  789.     Private _Checked As Boolean
  790.     Private _Group As Integer = 1
  791.     Event CheckedChanged(ByVal sender As Object)
  792.  
  793. #End Region
  794.  
  795. #Region " Properties "
  796.  
  797.     Property Checked As Boolean
  798.         Get
  799.             Return _Checked
  800.         End Get
  801.         Set(ByVal value As Boolean)
  802.             _Checked = value
  803.             RaiseEvent CheckedChanged(Me)
  804.             Invalidate()
  805.         End Set
  806.     End Property
  807.  
  808.     Property Group As Integer
  809.         Get
  810.             Return _Group
  811.         End Get
  812.         Set(ByVal value As Integer)
  813.             _Group = value
  814.         End Set
  815.     End Property
  816.  
  817. #End Region
  818.  
  819. #Region " Initialization "
  820.  
  821.     Sub New()
  822.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or _
  823.      ControlStyles.SupportsTransparentBackColor Or ControlStyles.UserPaint, True)
  824.         DoubleBuffered = True
  825.         Size = MinimumSize
  826.         Cursor = Cursors.Hand
  827.         Font = New font("Proxima Nova", 11, FontStyle.Regular)
  828.     End Sub
  829.  
  830. #End Region
  831.  
  832. #Region " Draw Control "
  833.  
  834.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  835.  
  836.         Using B As New Bitmap(Width, Height), G As Graphics = Graphics.FromImage(B)
  837.  
  838.             With G
  839.  
  840.                 .SmoothingMode = SmoothingMode.AntiAlias
  841.                 .TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
  842.  
  843.                 If Checked Then
  844.                     .DrawEllipse(PenHTMlColor("097A74", 1.9), 1, 1, 18, 18)
  845.                     .FillEllipse(SolidBrushHTMlColor("097A74"), New Rectangle(4, 4, 12, 12))
  846.                     .DrawString(Text, Font, SolidBrushHTMlColor("097A74"), New Rectangle(23, -1, Width, Height))
  847.                 Else
  848.                     .DrawEllipse(PenHTMlColor("9c9c9c", 1.9), 1, 1, 18, 18)
  849.                     .FillEllipse(SolidBrushHTMlColor("9c9c9c"), New Rectangle(4, 4, 12, 12))
  850.  
  851.                     .DrawString(Text, Font, Brushes.Gray, New Rectangle(23, -1, Width, Height))
  852.                 End If
  853.  
  854.  
  855.             End With
  856.  
  857.             e.Graphics.DrawImage(B.Clone(), 0, 0)
  858.             G.Dispose() : B.Dispose()
  859.         End Using
  860.  
  861.     End Sub
  862.  
  863. #End Region
  864.  
  865. #Region " Events "
  866.  
  867.     Private Sub UpdateState()
  868.         If Not IsHandleCreated OrElse Not Checked Then Return
  869.         For Each C As Control In Parent.Controls
  870.             If C IsNot Me AndAlso TypeOf C Is GreenUIRadioButton AndAlso DirectCast(C, GreenUIRadioButton).Group = _Group Then
  871.                 DirectCast(C, GreenUIRadioButton).Checked = False
  872.             End If
  873.         Next
  874.     End Sub
  875.  
  876.     Protected Overrides Sub OnClick(ByVal e As EventArgs)
  877.         _Checked = Not Checked
  878.         UpdateState()
  879.         MyBase.OnClick(e)
  880.         Invalidate()
  881.     End Sub
  882.  
  883.     Protected Overrides Sub OnCreateControl()
  884.         UpdateState()
  885.         MyBase.OnCreateControl()
  886.     End Sub
  887.  
  888.     Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
  889.         Invalidate() : MyBase.OnTextChanged(e)
  890.     End Sub
  891.  
  892.     Protected Overrides Sub OnResize(ByVal e As System.EventArgs)
  893.         Invalidate()
  894.         MyBase.OnResize(e)
  895.         Height = 21
  896.     End Sub
  897.  
  898. #End Region
  899.  
  900. End Class
  901.  
  902. #End Region
  903.  
  904. #Region " ProgressBar "
  905.  
  906. Public Class GreenUIProgressBar : Inherits Control
  907.  
  908. #Region " Variables "
  909.  
  910.     Private _Maximum As Integer = 100
  911.     Private _Value As Integer = 0
  912.  
  913. #End Region
  914.  
  915. #Region " Initilization"
  916.  
  917.     Sub New()
  918.  
  919.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or ControlStyles.ResizeRedraw Or _
  920.                        ControlStyles.OptimizedDoubleBuffer Or ControlStyles.SupportsTransparentBackColor, True)
  921.         DoubleBuffered = True
  922.         Size = New Size(75, 23)
  923.  
  924.     End Sub
  925.  
  926. #End Region
  927.  
  928. #Region " Properties "
  929.  
  930.     Public Property Value() As Integer
  931.         Get
  932.             If _Value < 0 Then
  933.                 Return 0
  934.             Else
  935.                 Return _Value
  936.             End If
  937.         End Get
  938.         Set(ByVal Value As Integer)
  939.             If Value > Maximum Then
  940.                 Value = Maximum
  941.             End If
  942.             _Value = Value
  943.             Invalidate()
  944.         End Set
  945.     End Property
  946.  
  947.     Public Property Maximum() As Integer
  948.         Get
  949.             Return _Maximum
  950.         End Get
  951.         Set(ByVal Value As Integer)
  952.             Select Case Value
  953.                 Case Is < _Value
  954.                     _Value = Value
  955.             End Select
  956.             _Maximum = Value
  957.             Invalidate()
  958.         End Set
  959.     End Property
  960.  
  961. #End Region
  962.  
  963. #Region " Draw Control "
  964.  
  965.     Protected Overrides Sub OnPaint(e As System.Windows.Forms.PaintEventArgs)
  966.  
  967.         Using B As New Bitmap(Width, Height), G As Graphics = Graphics.FromImage(B)
  968.  
  969.             With G
  970.  
  971.                 .SmoothingMode = SmoothingMode.AntiAlias
  972.                 .PixelOffsetMode = PixelOffsetMode.Half
  973.  
  974.                 Dim CurrentValue As Integer = CInt(Value / Maximum * Width)
  975.  
  976.                 Dim Rect As New Rectangle(0, 0, Width - 1, Height - 1)
  977.  
  978.                 FillRoundedPath(G, Color.Silver, Rect, 8)
  979.                 DrawRoundedPath(G, Color.FromArgb(200, Color.DarkGray), 1, Rect, 8)
  980.                 If Not CurrentValue = 0 Then
  981.                     FillRoundedPath(G, GetHTMLColor("097A74"), New Rectangle(Rect.X, Rect.Y, CurrentValue, Rect.Height), 8)
  982.                 End If
  983.  
  984.             End With
  985.  
  986.             e.Graphics.DrawImage(B.Clone, 0, 0)
  987.             G.Dispose() : B.Dispose()
  988.  
  989.         End Using
  990.     End Sub
  991.  
  992. #End Region
  993.  
  994. End Class
  995.  
  996. #End Region
  997.  
  998. #Region " TextBox "
  999.  
  1000. <DefaultEvent("TextChanged")> Public Class GreenUITextbox : Inherits Control
  1001.  
  1002. #Region " Variables "
  1003.  
  1004.     Private WithEvents T As New TextBox
  1005.     Private _TextAlign As HorizontalAlignment = HorizontalAlignment.Left
  1006.     Private _MaxLength As Integer = 32767
  1007.     Private _ReadOnly As Boolean = False
  1008.     Private _UseSystemPasswordChar As Boolean = False
  1009.     Private _WatermarkText As String = String.Empty
  1010.     Private _SideImage As Image
  1011.     Private TBC As Color = Color.Silver
  1012.     Private TFC As Color = Color.Gray
  1013.  
  1014. #End Region
  1015.  
  1016. #Region " Properties "
  1017.  
  1018.     <Browsable(False), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
  1019.     Property BorderStyle As BorderStyle
  1020.         Get
  1021.             Return BorderStyle.None
  1022.         End Get
  1023.         Set(ByVal value As BorderStyle)
  1024.         End Set
  1025.     End Property
  1026.  
  1027.     Public Overridable Shadows Property TextAlign() As HorizontalAlignment
  1028.         Get
  1029.             Return _TextAlign
  1030.         End Get
  1031.         Set(ByVal value As HorizontalAlignment)
  1032.             _TextAlign = value
  1033.             If T IsNot Nothing Then
  1034.                 T.TextAlign = value
  1035.             End If
  1036.         End Set
  1037.     End Property
  1038.  
  1039.     Public Overridable Shadows Property MaxLength() As Integer
  1040.         Get
  1041.             Return _MaxLength
  1042.         End Get
  1043.         Set(ByVal value As Integer)
  1044.             _MaxLength = value
  1045.             If T IsNot Nothing Then
  1046.                 T.MaxLength = value
  1047.             End If
  1048.         End Set
  1049.     End Property
  1050.  
  1051.     Public Overridable Shadows Property [ReadOnly]() As Boolean
  1052.         Get
  1053.             Return _ReadOnly
  1054.         End Get
  1055.         Set(ByVal value As Boolean)
  1056.             _ReadOnly = value
  1057.             If T IsNot Nothing Then
  1058.                 T.ReadOnly = value
  1059.             End If
  1060.         End Set
  1061.     End Property
  1062.  
  1063.     Public Overridable Shadows Property UseSystemPasswordChar() As Boolean
  1064.         Get
  1065.             Return _UseSystemPasswordChar
  1066.         End Get
  1067.         Set(ByVal value As Boolean)
  1068.             _UseSystemPasswordChar = value
  1069.             If T IsNot Nothing Then
  1070.                 T.UseSystemPasswordChar = value
  1071.             End If
  1072.         End Set
  1073.     End Property
  1074.  
  1075.     <Browsable(False), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
  1076.     Public Overridable Shadows ReadOnly Property Multiline() As Boolean
  1077.         Get
  1078.             Return False
  1079.         End Get
  1080.     End Property
  1081.  
  1082.     <Browsable(False), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
  1083.     Public Overridable Shadows ReadOnly Property BackgroundImage() As Image
  1084.         Get
  1085.             Return Nothing
  1086.         End Get
  1087.     End Property
  1088.  
  1089.     Public Overridable Shadows Property Text As String
  1090.         Get
  1091.             Return MyBase.Text
  1092.         End Get
  1093.         Set(ByVal value As String)
  1094.             MyBase.Text = value
  1095.             If T IsNot Nothing Then
  1096.                 T.Text = value
  1097.             End If
  1098.         End Set
  1099.     End Property
  1100.  
  1101.     <Browsable(False)>
  1102.     Public Overridable Shadows ReadOnly Property Font As Font
  1103.         Get
  1104.             Return New Font("Proxima Nova", 11, FontStyle.Regular)
  1105.         End Get
  1106.     End Property
  1107.  
  1108.     Public Property WatermarkText As String
  1109.         Get
  1110.             Return _WatermarkText
  1111.         End Get
  1112.         Set(value As String)
  1113.             _WatermarkText = value
  1114.         End Set
  1115.     End Property
  1116.  
  1117.     <Browsable(False)>
  1118.     Public Overridable Shadows ReadOnly Property BackColor As Color
  1119.         Get
  1120.             Return Color.White
  1121.         End Get
  1122.     End Property
  1123.  
  1124.     <Browsable(True)>
  1125.     Public Property SideImage As Image
  1126.         Get
  1127.             Return _SideImage
  1128.         End Get
  1129.         Set(value As Image)
  1130.             _SideImage = value
  1131.             Invalidate()
  1132.         End Set
  1133.     End Property
  1134.  
  1135. #End Region
  1136.  
  1137. #Region " Initilization "
  1138.  
  1139.     Sub New()
  1140.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or _
  1141.                   ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer Or _
  1142.                   ControlStyles.SupportsTransparentBackColor, True)
  1143.         DoubleBuffered = True
  1144.         With T
  1145.             .Multiline = False
  1146.             .Cursor = Cursors.IBeam
  1147.             .BackColor = TBC
  1148.             .ForeColor = Color.Gray
  1149.             .Text = WatermarkText
  1150.             .BorderStyle = BorderStyle.None
  1151.             .Location = New Point(7, 7)
  1152.             .Font = Font
  1153.             .Size = New Size(Width - 10, 30)
  1154.             .UseSystemPasswordChar = _UseSystemPasswordChar
  1155.             Text = WatermarkText
  1156.         End With
  1157.         Size = New Size(135, 30)
  1158.  
  1159.     End Sub
  1160.  
  1161. #End Region
  1162.  
  1163. #Region " Events "
  1164.  
  1165.     Private Sub T_Leave(sender As Object, e As EventArgs) Handles T.Leave
  1166.         If Text.Length = 0 Then
  1167.             Text = WatermarkText
  1168.             T.ForeColor = TFC
  1169.         End If
  1170.     End Sub
  1171.  
  1172.     Private Sub T_Enter(sender As Object, e As EventArgs) Handles T.Enter
  1173.         If Text = WatermarkText Then
  1174.             Text = ""
  1175.             T.ForeColor = Color.Gray
  1176.         End If
  1177.     End Sub
  1178.  
  1179.     Private Sub T_TextChanged(ByVal sender As Object, ByVal e As EventArgs) Handles T.TextChanged
  1180.         Text = T.Text
  1181.     End Sub
  1182.  
  1183.     Private Sub T_KeyDown(ByVal sender As Object, ByVal e As KeyEventArgs) Handles T.KeyDown
  1184.         If e.Control AndAlso e.KeyCode = Keys.A Then e.SuppressKeyPress = True
  1185.         If e.Control AndAlso e.KeyCode = Keys.C Then
  1186.             T.Copy()
  1187.             e.SuppressKeyPress = True
  1188.         End If
  1189.     End Sub
  1190.  
  1191.     Protected Overrides Sub OnCreateControl()
  1192.         MyBase.OnCreateControl()
  1193.         If Not Controls.Contains(T) Then Controls.Add(T)
  1194.         If T.Text = "" AndAlso WatermarkText <> "" Then
  1195.             T.Text = WatermarkText
  1196.         End If
  1197.     End Sub
  1198.  
  1199.     Protected Overrides Sub OnResize(e As EventArgs)
  1200.         MyBase.OnResize(e)
  1201.         Height = 30
  1202.     End Sub
  1203.  
  1204. #End Region
  1205.  
  1206. #Region " Draw Control "
  1207.  
  1208.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  1209.  
  1210.         Using B As New Bitmap(Width, Height), G As Graphics = Graphics.FromImage(B)
  1211.  
  1212.             Height = 30
  1213.  
  1214.             With G
  1215.                 .SmoothingMode = SmoothingMode.AntiAlias
  1216.                 .TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
  1217.                 .InterpolationMode = InterpolationMode.HighQualityBicubic
  1218.  
  1219.                 FillRoundedPath(G, TBC, New Rectangle(0, 0, Width - 1, Height - 1), 10)
  1220.                 DrawRoundedPath(G, Color.FromArgb(200, Color.DarkGray), 1, New Rectangle(0, 0, Width - 1, Height - 1), 10)
  1221.  
  1222.                 If Not SideImage Is Nothing Then
  1223.                     T.Location = New Point(33, 4.5)
  1224.                     T.Width = Width - 65
  1225.                     .DrawImage(SideImage, New Rectangle(8, 7, 16, 16))
  1226.                 Else
  1227.                     T.Location = New Point(7, 4.5)
  1228.                     T.Width = Width - 10
  1229.                 End If
  1230.  
  1231.                 If Not ContextMenuStrip Is Nothing Then T.ContextMenuStrip = ContextMenuStrip
  1232.  
  1233.             End With
  1234.  
  1235.             e.Graphics.DrawImage(B.Clone(), 0, 0)
  1236.             G.Dispose() : B.Dispose()
  1237.  
  1238.         End Using
  1239.     End Sub
  1240.  
  1241. #End Region
  1242.  
  1243. End Class
  1244.  
  1245. #End Region
  1246.  
  1247. #Region " Seperator "
  1248.  
  1249. Public Class GreenUISeperator : Inherits Control
  1250.  
  1251. #Region " Variables "
  1252.  
  1253.     Private _SepStyle As Style = Style.Horizental
  1254.  
  1255. #End Region
  1256.  
  1257. #Region " Enumerators "
  1258.  
  1259.     Enum Style
  1260.         Horizental
  1261.         Vertiacal
  1262.     End Enum
  1263.  
  1264. #End Region
  1265.  
  1266. #Region " Initialization "
  1267.  
  1268.     Sub New()
  1269.         SetStyle(ControlStyles.OptimizedDoubleBuffer Or ControlStyles.AllPaintingInWmPaint Or _
  1270.                  ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or _
  1271.                  ControlStyles.SupportsTransparentBackColor, True)
  1272.         DoubleBuffered = True
  1273.         BackColor = Color.Transparent
  1274.         ForeColor = HelperMethods.GetHTMLColor("097A74")
  1275.     End Sub
  1276.  
  1277. #End Region
  1278.  
  1279. #Region " Properties "
  1280.  
  1281.     Public Property SepStyle As Style
  1282.         Get
  1283.             Return _SepStyle
  1284.         End Get
  1285.         Set(value As Style)
  1286.             _SepStyle = value
  1287.             If value = Style.Horizental Then
  1288.                 Height = 4
  1289.             Else
  1290.                 Width = 4
  1291.             End If
  1292.         End Set
  1293.     End Property
  1294.  
  1295. #End Region
  1296.  
  1297. #Region " Draw Control "
  1298.  
  1299.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  1300.         Dim B As New Bitmap(Width, Height), G = e.Graphics
  1301.         With G
  1302.             .SmoothingMode = SmoothingMode.HighQuality
  1303.             Dim BL1, BL2 As New ColorBlend
  1304.             BL1.Positions = New Single() {0.0F, 0.15F, 0.85F, 1.0F}
  1305.             BL1.Colors = New Color() {Color.Transparent, ForeColor, ForeColor, Color.Transparent}
  1306.             Select Case SepStyle
  1307.                 Case Style.Horizental
  1308.                     Using lb1 As New LinearGradientBrush(ClientRectangle, Color.Empty, Color.Empty, 0.0F)
  1309.                         lb1.InterpolationColors = BL1
  1310.                         .DrawLine(New Pen(lb1), 0, 1, Width, 1)
  1311.                     End Using
  1312.                 Case Style.Vertiacal
  1313.                     Using lb1 As New LinearGradientBrush(ClientRectangle, Color.Empty, Color.Empty, 0.0F)
  1314.                         lb1.InterpolationColors = BL1
  1315.                         .DrawLine(New Pen(lb1), 1, 0, 1, Height)
  1316.                     End Using
  1317.             End Select
  1318.         End With
  1319.     End Sub
  1320.  
  1321. #End Region
  1322.  
  1323. End Class
  1324.  
  1325. #End Region
  1326.  
  1327. #Region " Close Button "
  1328.  
  1329. Public Class GreenUIClose : Inherits Control
  1330.  
  1331. #Region " Variables "
  1332.  
  1333.     Private img As String = "iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAAVDSURBVHjarJdPaxtHGMZ/78yuZlerXAyhBh/r1r0EArnmYOpG1EkoKeTUQD9AIZ+h0E8QWhoaSqFQ0kN7aqGkuAh88FVQMBQEuZoYDL5Uf3YlzUwPs7IlW5JXbhaGHLwZ/fZ53nnfZ0Tf/4gFTwN4CXwJ/M3bezaBb4DPgZPxH3/N/FEhMGc1RKlXEulPRKuWiNxe8N5KS0Q2Rat9ifTHolQL4eZFWjVPGVHqFaZ2l6wOSbKGVi1B7vwfWQTZRKt9kmQj7GtuiVKt6OG9m8uAZmCk0UAa2QRq77pQgmwFGLMhjbAvWR3MZSg1pWlDlH6FMXepZ0hahziGJCmh0jW0LqGq+xRgdIsk2ZCsASaFOEbSFBoNMMktUboVPWzeBBD94N6sMvV6eDnS55/oHBQFvtuHPD/F2qaH9tXKUMKYDckyMAb0lCnW4vMCuj0oikPv3I5W77/bED1lUz2FWM9+qBLQGtEKvE9x7rF43wLeLISREiZNNoLCBiJ1YV8V9tQKnHtHnLulRKuX1EqYi8rMVJsCY5DGpND1ngh3FsKoEibUyqwy04/WSGIgqx9hzFNFzXxFlp0GmGh5TSgNZrqmoj2R2ZoSkS1UtB9gMjAJaH3VvkdSM9ujX357rajFbTGmidanlY7MEqVKZfZJzfrcmpn/HOH8zvDFj6/DKbMW7LgNvolwWunwaAWJQW7UIU3WiPSeKPkMrfepm/WFNXN5HeHczvD5D50JXUQxxItCRNoY00SpPWDtaqVK+xA8ssZo9JI4ItRMUk0Z63aG357DBCBrIc/xAXpFqNI+BD8aIXEMtVplGIq8c2lLX/YD8hzf68OwaOPdivbVypqqVbaJYd7xvT5zZ1mAcjDIQ/Mrhm2cb4KcVurISoOOwr/L3z3G+h2KouO7A8gLFg5Xj5+C6kFRtHGuCZy+pdhxjHXbFHmn7Pjh95ZNe48PYyLP8b0SahX7Fq9jnNs+s6nIwbnwe5eBZv+n9xP7ilBT+Yr2zVvWP52xybrwOwhV8lAJZYN9vR7kRRvnvriWUWEwv/Dd/u1gky1hFhzcRR/lAVx5+vr9LYbDZ3i3ukB4vB2vMR61cO7OmTAyVyCWnlHvBazbYjja96PxOpd2q5Jb1aQ/lWPmYp6qYNns1Fb7xPG6xBGIrG7ZpHlm2ZUpYallIc+oFvV0XRpTEeI6da0VpAa5kYXZN4Gab9miDKxbpGmIEEl6dYSo0jyTJOTptIwuczK6WhDIW2d5Jqk0KKvbl5iQp0ql4kcPZqCUBHvKJZtEqiX1EDslTZBIMfvOpXUswhMRTq94LyytkNI+qYfoEn96DjX16eHeJEmyQZYh1ZQJHdjan1caM0qF2Bo+OihVQkn06H643modYBorwFi3zbDo+NEYiSMw5k7l6FI2zcmtww8Gp1jb1OqD964Dc4R1H/o879DtwSB0YJR6I1q3EHkMpFffIAXROijmfYq16xFaP5d0ZZgdX+Qdej38IAxK7BgBvNCWZIWQV9aUF38guCdKEvOERvbPSjClMgHGhuFnLX4wCPLnK0YXkQOJot3hT792FXF8InG8jdaHV/SSEqbo0O3jB0VQxk+Gn4QpPshLqMop4QDrdouvv++GUzYc4YvhCWO7AxwuVsaWMNPKXIwJ5fV4kEO3W0WpA8bj3eLZd93zTD0soNfDF/kJ1u4gHF7OwHbbF0WombyEWTRnz+7sOfS6+MUh7wA7C1Pey8qj928Xn+cXlTrC2m2fF6/PlLG2WlceL1XqgPF41/cH3fmjw82B8v7Pa8Msg/L+9zOYObeO/wYAIlO8U9aIgCsAAAAASUVORK5CYII="
  1334.  
  1335. #End Region
  1336.  
  1337. #Region " Initialization "
  1338.  
  1339.     Sub New()
  1340.         SetStyle(ControlStyles.OptimizedDoubleBuffer Or ControlStyles.AllPaintingInWmPaint Or _
  1341.          ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or
  1342.          ControlStyles.SupportsTransparentBackColor, True)
  1343.         DoubleBuffered = True
  1344.         UpdateStyles()
  1345.         BackColor = Color.Transparent
  1346.         Size = New Size(22, 22)
  1347.     End Sub
  1348.  
  1349. #End Region
  1350.  
  1351. #Region " Draw Control "
  1352.  
  1353.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  1354.         MyBase.OnPaint(e)
  1355.         Using B As New Bitmap(Width, Height), G As Graphics = Graphics.FromImage(B)
  1356.             Dim Rect As New Rectangle(0, 0, 22, 22)
  1357.             With G
  1358.                 DrawImageFromBase64(G, img, Rect)
  1359.             End With
  1360.             e.Graphics.DrawImage(B.Clone, 0, 0)
  1361.             G.Dispose() : B.Dispose()
  1362.         End Using
  1363.     End Sub
  1364.  
  1365. #End Region
  1366.  
  1367. #Region " Events "
  1368.  
  1369.     Protected Overrides Sub OnResize(e As EventArgs)
  1370.         MyBase.OnResize(e)
  1371.         Size = New Size(22, 22)
  1372.     End Sub
  1373.  
  1374.     Protected Overrides Sub OnClick(e As EventArgs)
  1375.         MyBase.OnClick(e)
  1376.         Environment.Exit(0)
  1377.         Application.Exit()
  1378.     End Sub
  1379.  
  1380. #End Region
  1381.  
  1382. End Class
  1383.  
  1384. #End Region
  1385.  
  1386. #Region " ComboBox "
  1387.  
  1388. Public Class GreenUIComboBox : Inherits ComboBox
  1389.  
  1390. #Region " Variables "
  1391.  
  1392.     Private _StartIndex As Integer = 0
  1393.  
  1394. #End Region
  1395.  
  1396. #Region " Constructors "
  1397.  
  1398.     Sub New()
  1399.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  1400.         Font = New Font("Proxima Nova", 12, FontStyle.Regular)
  1401.         DrawMode = Windows.Forms.DrawMode.OwnerDrawFixed
  1402.         DoubleBuffered = True
  1403.         StartIndex = 0
  1404.         DropDownHeight = 100
  1405.         BackColor = Color.Transparent
  1406.         DropDownStyle = ComboBoxStyle.DropDownList
  1407.         UpdateStyles()
  1408.  
  1409.     End Sub
  1410.  
  1411. #End Region
  1412.  
  1413. #Region " Properties "
  1414.  
  1415.     Private Property StartIndex As Integer
  1416.         Get
  1417.             Return _StartIndex
  1418.         End Get
  1419.         Set(ByVal value As Integer)
  1420.             _StartIndex = value
  1421.             Try
  1422.                 MyBase.SelectedIndex = value
  1423.             Catch
  1424.             End Try
  1425.             Invalidate()
  1426.         End Set
  1427.     End Property
  1428.  
  1429. #End Region
  1430.  
  1431. #Region " Draw Control "
  1432.  
  1433.     Protected Overrides Sub OnDrawItem(e As DrawItemEventArgs)
  1434.         Try
  1435.             Dim G As Graphics = e.Graphics
  1436.             With G
  1437.                 .TextRenderingHint = Drawing.Text.TextRenderingHint.ClearTypeGridFit
  1438.                 .FillRectangle(Brushes.Silver, e.Bounds)
  1439.                 Cursor = Cursors.Hand
  1440.                 If (e.State And DrawItemState.Selected) = DrawItemState.Selected Then
  1441.                     CentreString(G, Items(e.Index), Font, SolidBrushHTMlColor("097A74"), New Rectangle(e.Bounds.X + 1, e.Bounds.Y + 3, e.Bounds.Width - 2, e.Bounds.Height - 2))
  1442.                 Else
  1443.                     CentreString(G, Items(e.Index), Font, Brushes.Gray, New Rectangle(e.Bounds.X + 1, e.Bounds.Y + 3, e.Bounds.Width - 2, e.Bounds.Height - 2))
  1444.                 End If
  1445.             End With
  1446.         Catch
  1447.         End Try
  1448.         Invalidate()
  1449.     End Sub
  1450.  
  1451.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  1452.         Dim Rect As New Rectangle(0, 0, Width - 1, Height - 1)
  1453.         With e.Graphics
  1454.             .SmoothingMode = SmoothingMode.AntiAlias
  1455.             .TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
  1456.             FillRoundedPath(e.Graphics, Color.Silver, Rect, 8)
  1457.             FillRoundedPath(e.Graphics, Color.Gainsboro, New Rectangle(Width - 28, 0, Width - 1, Height - 1), 10, False, True, False, True)
  1458.             DrawRoundedPath(e.Graphics, Color.FromArgb(200, Color.DarkGray), 1, Rect, 8)
  1459.  
  1460.  
  1461.             .DrawLine(New Pen(Color.DarkGray, 1), New Point(Width - 21, (Height / 2) - 4.5), New Point(Width - 7, (Height / 2) - 4.5))
  1462.             .DrawLine(New Pen(Color.DarkGray, 1), New Point(Width - 21, (Height / 2) - 0.5), New Point(Width - 7, (Height / 2) - 0.5))
  1463.             .DrawLine(New Pen(Color.DarkGray, 1), New Point(Width - 21, (Height / 2) + 3.5), New Point(Width - 7, (Height / 2) + 3.5))
  1464.             .DrawLine(New Pen(Color.DarkGray, 1), New Point(Width - 28, 1), New Point(Width - 28, Height - 1))
  1465.             .DrawString(Text, Font, Brushes.Gray, New Rectangle(5, 1, Width - 1, Height - 1), New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Near})
  1466.         End With
  1467.     End Sub
  1468.  
  1469. #End Region
  1470.  
  1471. #Region " Events "
  1472.  
  1473.     Protected Overrides Sub OnResize(e As EventArgs)
  1474.         MyBase.OnResize(e)
  1475.         Invalidate()
  1476.     End Sub
  1477.  
  1478. #End Region
  1479.  
  1480. End Class
  1481.  
  1482. #End Region
  1483.  
  1484. #Region " TabControl "
  1485.  
  1486. Public Class GreenUITabControl : Inherits TabControl
  1487.  
  1488. #Region " Constructors "
  1489.  
  1490.     Sub New()
  1491.         SetStyle(ControlStyles.UserPaint Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.AllPaintingInWmPaint Or ControlStyles.SupportsTransparentBackColor, True)
  1492.         DoubleBuffered = True
  1493.         SizeMode = TabSizeMode.Fixed
  1494.         Dock = DockStyle.None
  1495.         ItemSize = New Size(80, 45)
  1496.         Font = New Font("Proxima Nova Rg", 10, FontStyle.Bold)
  1497.         Alignment = TabAlignment.Top
  1498.         UpdateStyles()
  1499.     End Sub
  1500.  
  1501. #End Region
  1502.  
  1503. #Region " Draw Control "
  1504.  
  1505.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  1506.         Dim G As Graphics = e.Graphics
  1507.         With G
  1508.             .Clear(Color.Gainsboro)
  1509.             Cursor = Cursors.Hand
  1510.  
  1511.             .TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
  1512.  
  1513.             .FillRectangle(Brushes.Silver, New Rectangle(0, 0, Width, ItemSize.Height + 2))
  1514.             .DrawRectangle(New Pen(Color.FromArgb(200, Color.DarkGray), 1), New Rectangle(0, 0, Width - 1, Height - 1))
  1515.             .DrawLine(New Pen(Color.FromArgb(200, Color.DarkGray), 1), New Point(1, ItemSize.Height + 2), New Point(Width - 1, ItemSize.Height + 2))
  1516.  
  1517.             For i = 0 To TabCount - 1
  1518.  
  1519.                 Dim R As Rectangle = GetTabRect(i)
  1520.  
  1521.                 If SelectedIndex = i Then
  1522.                     .DrawString(TabPages(i).Text, Font, SolidBrushHTMlColor("097A74"), R.X + 35, R.Y + 15, New StringFormat() With {.Alignment = StringAlignment.Center})
  1523.                 Else
  1524.                     .DrawString(TabPages(i).Text, Font, Brushes.DarkGray, R.X + 35, R.Y + 15, New StringFormat() With {.Alignment = StringAlignment.Center})
  1525.                 End If
  1526.  
  1527.             Next
  1528.  
  1529.         End With
  1530.  
  1531.     End Sub
  1532.  
  1533. #End Region
  1534.  
  1535. #Region " Events "
  1536.  
  1537.     Protected Overrides Sub OnCreateControl()
  1538.         MyBase.OnCreateControl()
  1539.         For Each Tab As TabPage In MyBase.TabPages
  1540.             Tab.BackColor = Color.Gainsboro
  1541.         Next
  1542.     End Sub
  1543.  
  1544. #End Region
  1545.  
  1546. End Class
  1547.  
  1548. #End Region
Advertisement
Add Comment
Please, Sign In to add comment