THE_LORD

Nord Theme

Feb 2nd, 2017
1,214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 72.48 KB | None | 0 0
  1.  
  2. '' <summary>
  3. '' Nord Theme
  4. '' Author : THE LORD
  5. '' Release Date : Friday, February 3, 2017
  6. '' HF Account : https://hackforums.net/member.php?action=profile&uid=3304362
  7. '' PM Me for any bug.
  8. '' </summary>
  9.  
  10. #Region " Namespaces "
  11.  
  12. Imports System.Drawing.Drawing2D
  13. Imports System.ComponentModel
  14.  
  15. #End Region
  16.  
  17. #Region " Helper Methods "
  18.  
  19. Public Module HelperMethods
  20.  
  21.     Public GP As GraphicsPath
  22.  
  23.     Public Enum MouseMode As Byte
  24.         NormalMode
  25.         Hovered
  26.         Pushed
  27.     End Enum
  28.  
  29.     Public Sub DrawImageFromBase64(ByVal G As Graphics, ByVal Base64Image As String, ByVal Rect As Rectangle)
  30.         Dim IM As Image = Nothing
  31.         With G
  32.             Using ms As New System.IO.MemoryStream(Convert.FromBase64String(Base64Image))
  33.                 IM = Image.FromStream(ms) : ms.Close()
  34.             End Using
  35.             .DrawImage(IM, Rect)
  36.         End With
  37.     End Sub
  38.  
  39.     Public Sub FillRoundedPath(ByVal G As Graphics, ByVal C As Color, ByVal Rect As Rectangle, ByVal Curve As Integer, _
  40.                                  Optional ByVal TopLeft As Boolean = True, Optional ByVal TopRight As Boolean = True, _
  41.                                  Optional ByVal BottomLeft As Boolean = True, Optional ByVal BottomRight As Boolean = True)
  42.         With G
  43.             .FillPath(New SolidBrush(C), RoundRec(Rect, Curve, TopLeft, TopRight, BottomLeft, BottomRight))
  44.         End With
  45.     End Sub
  46.  
  47.     Public Sub FillRoundedPath(ByVal G As Graphics, ByVal B As Brush, ByVal Rect As Rectangle, ByVal Curve As Integer, _
  48.                                  Optional ByVal TopLeft As Boolean = True, Optional ByVal TopRight As Boolean = True, _
  49.                                  Optional ByVal BottomLeft As Boolean = True, Optional ByVal BottomRight As Boolean = True)
  50.         With G
  51.             .FillPath(B, RoundRec(Rect, Curve, TopLeft, TopRight, BottomLeft, BottomRight))
  52.         End With
  53.     End Sub
  54.  
  55.     Public Sub DrawRoundedPath(ByVal G As Graphics, ByVal C As Color, ByVal Size As Single, ByVal Rect As Rectangle, ByVal Curve As Integer, _
  56.                                  Optional ByVal TopLeft As Boolean = True, Optional ByVal TopRight As Boolean = True, _
  57.                                  Optional ByVal BottomLeft As Boolean = True, Optional ByVal BottomRight As Boolean = True)
  58.         With G
  59.             .DrawPath(New Pen(C, Size), RoundRec(Rect, Curve, TopLeft, TopRight, BottomLeft, BottomRight))
  60.         End With
  61.     End Sub
  62.  
  63.     Public Function Triangle(ByVal Clr As Color, ByVal P1 As Point, ByVal P2 As Point, ByVal P3 As Point) As Point()
  64.         Return New Point() {P1, P2, P3}
  65.     End Function
  66.  
  67.     Public Function PenRGBColor(ByVal GR As Graphics, ByVal R As Integer, ByVal G As Integer, ByVal B As Integer, ByVal Size As Single) As Pen
  68.         Return New Pen(Color.FromArgb(R, G, B), Size)
  69.     End Function
  70.  
  71.     Public Function PenHTMlColor(ByVal C_WithoutHash As String, ByVal Size As Single) As Pen
  72.         Return New Pen(GetHTMLColor(C_WithoutHash), Size)
  73.     End Function
  74.  
  75.     Public Function SolidBrushRGBColor(ByVal R As Integer, ByVal G As Integer, ByVal B As Integer, Optional ByVal A As Integer = 0) As SolidBrush
  76.         Return New SolidBrush(Color.FromArgb(A, R, G, B))
  77.     End Function
  78.  
  79.     Public Function SolidBrushHTMlColor(ByVal C_WithoutHash As String) As SolidBrush
  80.         Return New SolidBrush(GetHTMLColor(C_WithoutHash))
  81.     End Function
  82.  
  83.     Public Function GetHTMLColor(ByVal C_WithoutHash As String) As Color
  84.         Return ColorTranslator.FromHtml("#" & C_WithoutHash)
  85.     End Function
  86.  
  87.     Public Function ColorToHTML(ByVal C As Color) As String
  88.         Return ColorTranslator.ToHtml(C)
  89.     End Function
  90.  
  91.     Public Sub CentreString(ByVal G As Graphics, ByVal Text As String, ByVal font As Font, ByVal brush As Brush, ByVal Rect As Rectangle)
  92.         G.DrawString(Text, font, brush, New Rectangle(0, Rect.Y + (Rect.Height / 2) - (G.MeasureString(Text, font).Height / 2) + 0, Rect.Width, Rect.Height), New StringFormat With {.Alignment = StringAlignment.Center})
  93.     End Sub
  94.  
  95.     Public Sub LeftString(ByVal G As Graphics, ByVal Text As String, ByVal font As Font, ByVal brush As Brush, ByVal Rect As Rectangle)
  96.         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})
  97.     End Sub
  98.  
  99.     Public Sub RightString(ByVal G As Graphics, ByVal Text As String, ByVal font As Font, ByVal brush As Brush, ByVal Rect As Rectangle)
  100.         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})
  101.     End Sub
  102.  
  103.  
  104. #Region " Round Border "
  105.  
  106.     ''' <summary>
  107.     ''' Credits : AeonHack
  108.     ''' </summary>
  109.  
  110.     Public Function RoundRec(ByVal r As Rectangle, ByVal Curve As Integer, _
  111.                                  Optional ByVal TopLeft As Boolean = True, Optional ByVal TopRight As Boolean = True, _
  112.                                  Optional ByVal BottomLeft As Boolean = True, Optional ByVal BottomRight As Boolean = True) As GraphicsPath
  113.         Dim CreateRoundPath As New GraphicsPath(FillMode.Winding)
  114.         If TopLeft Then
  115.             CreateRoundPath.AddArc(r.X, r.Y, Curve, Curve, 180.0F, 90.0F)
  116.         Else
  117.             CreateRoundPath.AddLine(r.X, r.Y, r.X, r.Y)
  118.         End If
  119.         If TopRight Then
  120.             CreateRoundPath.AddArc(r.Right - Curve, r.Y, Curve, Curve, 270.0F, 90.0F)
  121.         Else
  122.             CreateRoundPath.AddLine(r.Right - r.Width, r.Y, r.Width, r.Y)
  123.         End If
  124.         If BottomRight Then
  125.             CreateRoundPath.AddArc(r.Right - Curve, r.Bottom - Curve, Curve, Curve, 0.0F, 90.0F)
  126.         Else
  127.             CreateRoundPath.AddLine(r.Right, r.Bottom, r.Right, r.Bottom)
  128.  
  129.         End If
  130.         If BottomLeft Then
  131.             CreateRoundPath.AddArc(r.X, r.Bottom - Curve, Curve, Curve, 90.0F, 90.0F)
  132.         Else
  133.             CreateRoundPath.AddLine(r.X, r.Bottom, r.X, r.Bottom)
  134.         End If
  135.         CreateRoundPath.CloseFigure()
  136.         Return CreateRoundPath
  137.     End Function
  138.  
  139. #End Region
  140.  
  141.  
  142.  
  143. End Module
  144.  
  145. #End Region
  146.  
  147. #Region " Form "
  148.  
  149. Public Class NordTheme : Inherits ContainerControl
  150.  
  151. #Region " Constructors "
  152.  
  153.     Sub New()
  154.         SetStyle(ControlStyles.UserPaint Or ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.SupportsTransparentBackColor Or ControlStyles.ContainerControl Or ControlStyles.ResizeRedraw, True)
  155.         DoubleBuffered = True
  156.         Font = New Font("Segoe UI", 13, FontStyle.Bold)
  157.         UpdateStyles()
  158.     End Sub
  159.  
  160. #End Region
  161.  
  162. #Region " Draw Control "
  163.  
  164.     Protected NotOverridable Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  165.         With e.Graphics
  166.  
  167.             Dim Rect As New Rectangle(0, 0, Width, Height)
  168.  
  169.             .FillRectangle(SolidBrushHTMlColor("bbd2d8"), Rect)
  170.             .FillRectangle(SolidBrushHTMlColor("174b7a"), New Rectangle(0, 0, Width, 58))
  171.             .FillRectangle(SolidBrushHTMlColor("164772"), New Rectangle(0, 58, Width, 10))
  172.             .DrawLine(PenHTMlColor("002e5e", 2), New Point(0, 68), New Point(Width, 68))
  173.  
  174.         End With
  175.     End Sub
  176.  
  177. #End Region
  178.  
  179. #Region " Events "
  180.  
  181.     Protected NotOverridable Overrides Sub OnCreateControl()
  182.         MyBase.OnCreateControl()
  183.         Dock = DockStyle.Fill
  184.         Invalidate()
  185.     End Sub
  186.  
  187. #End Region
  188.  
  189. End Class
  190.  
  191. #End Region
  192.  
  193. #Region " Button "
  194.  
  195. Public Class NordButtonGreen : Inherits Control
  196.  
  197. #Region " Variables "
  198.  
  199.     Private State As MouseMode
  200.     Private _NormalColor As Color = GetHTMLColor("75b81b")
  201.     Private _NormalBorderColor As Color = GetHTMLColor("83ae48")
  202.     Private _NormalTextColor As Color = Color.White
  203.     Private _HoverColor As Color = GetHTMLColor("8dd42e")
  204.     Private _HoverBorderColor As Color = GetHTMLColor("83ae48")
  205.     Private _HoverTextColor As Color = Color.White
  206.     Private _PushedColor As Color = GetHTMLColor("548710")
  207.     Private _PushedBorderColor As Color = GetHTMLColor("83ae48")
  208.     Private _PushedTextColor As Color = Color.White
  209.  
  210. #End Region
  211.  
  212. #Region " Properties "
  213.  
  214.     <Category(" Custom Properties "),
  215.     Description("Gets or sets the the button color in normal mouse state.")> Public Property NormalColor As Color
  216.         Get
  217.             Return _NormalColor
  218.         End Get
  219.         Set(value As Color)
  220.             _NormalColor = value
  221.             Invalidate()
  222.         End Set
  223.     End Property
  224.  
  225.     <Category(" Custom Properties "),
  226.     Description("Gets or sets the the button border color in normal mouse state.")> Public Property NormalBorderColor As Color
  227.         Get
  228.             Return _NormalBorderColor
  229.         End Get
  230.         Set(value As Color)
  231.             _NormalBorderColor = value
  232.             Invalidate()
  233.         End Set
  234.     End Property
  235.  
  236.     <Category(" Custom Properties "),
  237.     Description("Gets or sets the the button Text color in normal mouse state.")> Public Property NormalTextColor As Color
  238.         Get
  239.             Return _NormalTextColor
  240.         End Get
  241.         Set(value As Color)
  242.             _NormalTextColor = value
  243.             Invalidate()
  244.         End Set
  245.     End Property
  246.  
  247.     <Category(" Custom Properties "),
  248.     Description("Gets or sets the the button color in hover mouse state.")> Public Property HoverColor As Color
  249.         Get
  250.             Return _HoverColor
  251.         End Get
  252.         Set(value As Color)
  253.             _HoverColor = value
  254.             Invalidate()
  255.         End Set
  256.     End Property
  257.  
  258.     <Category(" Custom Properties "),
  259.     Description("Gets or sets the the button border color in hover mouse state.")> Public Property HoverBorderColor As Color
  260.         Get
  261.             Return _HoverBorderColor
  262.         End Get
  263.         Set(value As Color)
  264.             _HoverBorderColor = value
  265.             Invalidate()
  266.         End Set
  267.     End Property
  268.  
  269.     <Category(" Custom Properties "),
  270.     Description("Gets or sets the the button Text color in hover mouse state.")> Public Property HoverTextColor As Color
  271.         Get
  272.             Return _HoverTextColor
  273.         End Get
  274.         Set(value As Color)
  275.             _HoverTextColor = value
  276.             Invalidate()
  277.         End Set
  278.     End Property
  279.  
  280.     <Category(" Custom Properties "),
  281.     Description("Gets or sets the the button color in mouse down state.")>
  282.     Public Property PushedColor As Color
  283.         Get
  284.             Return _PushedColor
  285.         End Get
  286.         Set(value As Color)
  287.             _PushedColor = value
  288.             Invalidate()
  289.         End Set
  290.     End Property
  291.  
  292.     <Category(" Custom Properties "),
  293.     Description("Gets or sets the the button border color in mouse down state.")> Public Property PushedBorderColor As Color
  294.         Get
  295.             Return _PushedBorderColor
  296.         End Get
  297.         Set(value As Color)
  298.             _PushedBorderColor = value
  299.             Invalidate()
  300.         End Set
  301.     End Property
  302.  
  303.     <Category(" Custom Properties "),
  304.     Description("Gets or sets the the button Text color in mouse down state.")> Public Property PushedTextColor As Color
  305.         Get
  306.             Return _PushedTextColor
  307.         End Get
  308.         Set(value As Color)
  309.             _PushedTextColor = value
  310.             Invalidate()
  311.         End Set
  312.     End Property
  313.  
  314. #End Region
  315.  
  316. #Region " Constructors "
  317.  
  318.     Sub New()
  319.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or ControlStyles.OptimizedDoubleBuffer Or _
  320.         ControlStyles.SupportsTransparentBackColor, True)
  321.         DoubleBuffered = True
  322.         BackColor = Color.Transparent
  323.         Font = New Font("Segoe UI", 12, FontStyle.Bold)
  324.         UpdateStyles()
  325.     End Sub
  326.  
  327. #End Region
  328.  
  329. #Region " Draw Control "
  330.  
  331.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  332.         Dim G As Graphics = e.Graphics
  333.         Dim Rect As Rectangle = New Rectangle(0, 0, Width - 1, Height - 1)
  334.         With G
  335.             .SmoothingMode = SmoothingMode.AntiAlias
  336.             .TextRenderingHint = Drawing.Text.TextRenderingHint.ClearTypeGridFit
  337.             Select Case State
  338.                 Case MouseMode.NormalMode
  339.                     Dim R As RectangleF = RoundRec(Rect, 5).GetBounds
  340.                     Dim lgb As New LinearGradientBrush(New Rectangle(0, Height - 5, Width - 1, Height - 1), _
  341.                                                        Color.FromArgb(20, 0, 0, 0), Color.FromArgb(20, 0, 0, 0), 90S)
  342.                     FillRoundedPath(G, New SolidBrush(NormalColor), Rect, 5)
  343.                     .SmoothingMode = SmoothingMode.None
  344.                     FillRoundedPath(G, lgb, New Rectangle(0, Height - 5, Width - 1, Height - 5), 5, False, False, True, True)
  345.                     .SmoothingMode = SmoothingMode.AntiAlias
  346.                     DrawRoundedPath(G, NormalBorderColor, 1, Rect, 5)
  347.                     CentreString(G, Text, New Font("Arial", 11, FontStyle.Bold), New SolidBrush(NormalTextColor), Rect)
  348.                 Case MouseMode.Hovered
  349.                     Dim lgb As New LinearGradientBrush(New Rectangle(0, Height - 5, Width - 1, Height - 5), _
  350.                                                        Color.FromArgb(20, 0, 0, 0), Color.FromArgb(20, 0, 0, 0), 90S)
  351.                     FillRoundedPath(G, New SolidBrush(HoverColor), Rect, 5)
  352.                     .SmoothingMode = SmoothingMode.None
  353.                     FillRoundedPath(G, lgb, New Rectangle(0, Height - 5, Width - 1, Height - 5), 5, False, False, True, True)
  354.                     .SmoothingMode = SmoothingMode.AntiAlias
  355.                     DrawRoundedPath(G, HoverBorderColor, 1, Rect, 5)
  356.                     CentreString(G, Text, New Font("Arial", 11, FontStyle.Bold), New SolidBrush(HoverTextColor), Rect)
  357.                 Case MouseMode.Pushed
  358.                     Dim lgb As New LinearGradientBrush(New Rectangle(0, Height - 5, Width - 1, Height - 5), _
  359.                                            Color.FromArgb(20, 0, 0, 0), Color.FromArgb(20, 0, 0, 0), 90S)
  360.                     FillRoundedPath(G, New SolidBrush(PushedColor), Rect, 5)
  361.                     .SmoothingMode = SmoothingMode.None
  362.                     FillRoundedPath(G, lgb, New Rectangle(0, Height - 5, Width - 1, Height - 5), 5, False, False, True, True)
  363.                     .SmoothingMode = SmoothingMode.AntiAlias
  364.                     DrawRoundedPath(G, PushedBorderColor, 1, Rect, 5)
  365.                     CentreString(G, Text, New Font("Arial", 11, FontStyle.Bold), New SolidBrush(PushedTextColor), Rect)
  366.  
  367.             End Select
  368.  
  369.         End With
  370.  
  371.     End Sub
  372.  
  373. #End Region
  374.  
  375. #Region " Events "
  376.  
  377.     Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  378.         MyBase.OnMouseUp(e)
  379.         State = MouseMode.Hovered : Invalidate()
  380.     End Sub
  381.  
  382.     Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  383.         MyBase.OnMouseUp(e)
  384.         State = MouseMode.Pushed : Invalidate()
  385.     End Sub
  386.  
  387.     Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
  388.         MyBase.OnMouseEnter(e)
  389.         State = MouseMode.Hovered : Invalidate()
  390.     End Sub
  391.  
  392.     Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
  393.         MyBase.OnMouseEnter(e)
  394.         State = MouseMode.NormalMode : Invalidate()
  395.     End Sub
  396.  
  397. #End Region
  398.  
  399. End Class
  400.  
  401. Public Class NordButtonClear : Inherits Control
  402.  
  403. #Region " Variables "
  404.  
  405.     Private State As MouseMode
  406.     Private _RoundRadius As Integer = 5
  407.     Private _IsEnabled As Boolean = True
  408.  
  409. #End Region
  410.  
  411. #Region " Properties "
  412.  
  413.     <Category(" Custom Properties "),
  414.     Description("Gets or sets a value indicating whether the control can Rounded in corners.")>
  415.     Public Property RoundRadius As Integer
  416.         Get
  417.             Return _RoundRadius
  418.         End Get
  419.         Set(value As Integer)
  420.             _RoundRadius = value
  421.  
  422.             Invalidate()
  423.         End Set
  424.     End Property
  425.  
  426.     <Category(" Custom Properties "),
  427.     Description("Gets or sets a value indicating whether the control can respond to user interaction.")> Public Property IsEnabled As Boolean
  428.         Get
  429.             Return _IsEnabled
  430.         End Get
  431.         Set(value As Boolean)
  432.             Enabled = value
  433.             _IsEnabled = value
  434.             Invalidate()
  435.         End Set
  436.     End Property
  437.  
  438. #End Region
  439.  
  440. #Region " Constructors "
  441.  
  442.     Sub New()
  443.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or ControlStyles.OptimizedDoubleBuffer Or _
  444.         ControlStyles.SupportsTransparentBackColor, True)
  445.         DoubleBuffered = True
  446.         BackColor = Color.Transparent
  447.         Font = New Font("Segoe UI", 12, FontStyle.Bold)
  448.         UpdateStyles()
  449.     End Sub
  450.  
  451. #End Region
  452.  
  453. #Region " Draw Control "
  454.  
  455.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  456.         Dim G As Graphics = e.Graphics
  457.         Dim Rect As Rectangle = New Rectangle(0, 0, Width - 1, Height - 1)
  458.         With G
  459.             .SmoothingMode = SmoothingMode.AntiAlias
  460.             .TextRenderingHint = Drawing.Text.TextRenderingHint.ClearTypeGridFit
  461.             If IsEnabled Then
  462.                 Select Case State
  463.                     Case MouseMode.NormalMode
  464.                         DrawRoundedPath(G, GetHTMLColor("164772"), 1, Rect, RoundRadius)
  465.                         CentreString(G, Text, New Font("Arial", 11, FontStyle.Regular), SolidBrushHTMlColor("164772"), Rect)
  466.                     Case MouseMode.Hovered
  467.                         FillRoundedPath(G, SolidBrushHTMlColor("eeeeee"), Rect, RoundRadius)
  468.                         DrawRoundedPath(G, GetHTMLColor("d7d7d7"), 1, Rect, RoundRadius)
  469.                         CentreString(G, Text, New Font("Arial", 9, FontStyle.Bold), SolidBrushHTMlColor("d7d7d7"), Rect)
  470.                     Case MouseMode.Pushed
  471.                         FillRoundedPath(G, SolidBrushHTMlColor("f3f3f3"), Rect, RoundRadius)
  472.                         DrawRoundedPath(G, GetHTMLColor("d7d7d7"), 1, Rect, RoundRadius)
  473.                         CentreString(G, Text, New Font("Arial", 9, FontStyle.Bold), SolidBrushHTMlColor("747474"), Rect)
  474.  
  475.                 End Select
  476.             Else
  477.  
  478.                 DrawRoundedPath(G, GetHTMLColor("dadada"), 1, Rect, RoundRadius)
  479.                 CentreString(G, Text, New Font("Arial", 9, FontStyle.Bold), SolidBrushHTMlColor("dadada"), Rect)
  480.  
  481.             End If
  482.         End With
  483.     End Sub
  484.  
  485. #End Region
  486.  
  487. #Region " Events "
  488.  
  489.     Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  490.         MyBase.OnMouseUp(e)
  491.         State = MouseMode.Hovered : Invalidate()
  492.     End Sub
  493.  
  494.     Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  495.         MyBase.OnMouseUp(e)
  496.         State = MouseMode.Pushed : Invalidate()
  497.     End Sub
  498.  
  499.     Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
  500.         MyBase.OnMouseEnter(e)
  501.         State = MouseMode.Hovered : Invalidate()
  502.     End Sub
  503.  
  504.     Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
  505.         MyBase.OnMouseEnter(e)
  506.         State = MouseMode.NormalMode : Invalidate()
  507.     End Sub
  508.  
  509. #End Region
  510.  
  511. End Class
  512.  
  513. #End Region
  514.  
  515. #Region " Switch "
  516.  
  517. <DefaultEvent("CheckedChanged")> Public Class NordSwitchBlue : Inherits Control
  518.  
  519. #Region " Variables "
  520.  
  521.     Private _Checked As Boolean
  522.     Protected State As MouseMode = MouseMode.NormalMode
  523.     Private _UnCheckedColor As Color = Color.Black
  524.     Private _CheckedColor As Color = GetHTMLColor("3075bb")
  525.     Private _CheckedBallColor As Color = Color.White
  526.     Private _UnCheckedBallColor As Color = Color.Black
  527.  
  528. #End Region
  529.  
  530. #Region " Properties "
  531.  
  532.     <Category("Appearance")>
  533.     Property Checked As Boolean
  534.         Get
  535.             Return _Checked
  536.         End Get
  537.         Set(ByVal value As Boolean)
  538.             _Checked = value
  539.             RaiseEvent CheckedChanged(Me)
  540.             Invalidate()
  541.         End Set
  542.     End Property
  543.  
  544.     <Category("Custom Properties"),
  545.     Description("Gets or sets the switch control color while unchecked")>
  546.     Public Property UnCheckedColor As Color
  547.         Get
  548.             Return _UnCheckedColor
  549.         End Get
  550.         Set(value As Color)
  551.             _UnCheckedColor = value
  552.             Invalidate()
  553.         End Set
  554.     End Property
  555.  
  556.     <Category("Custom Properties"),
  557.     Description("Gets or sets the switch control color while checked")>
  558.     Public Property CheckedColor As Color
  559.         Get
  560.             Return _CheckedColor
  561.         End Get
  562.         Set(value As Color)
  563.             _CheckedColor = value
  564.             Invalidate()
  565.         End Set
  566.     End Property
  567.  
  568.     <Category("Custom Properties"),
  569.     Description("Gets or sets the switch control ball color while checked")>
  570.     Public Property CheckedBallColor As Color
  571.         Get
  572.             Return _CheckedBallColor
  573.         End Get
  574.         Set(value As Color)
  575.             _CheckedBallColor = value
  576.             Invalidate()
  577.         End Set
  578.     End Property
  579.  
  580.     <Category("Custom Properties"),
  581.     Description("Gets or sets the switch control ball color while unchecked")>
  582.     Public Property UnCheckedBallColor As Color
  583.         Get
  584.             Return _UnCheckedBallColor
  585.         End Get
  586.         Set(value As Color)
  587.             _UnCheckedBallColor = value
  588.             Invalidate()
  589.         End Set
  590.     End Property
  591.  
  592. #End Region
  593.  
  594. #Region " Draw Control "
  595.  
  596.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  597.         With e.Graphics
  598.             .SmoothingMode = SmoothingMode.AntiAlias
  599.  
  600.             If Checked Then
  601.                 FillRoundedPath(e.Graphics, New SolidBrush(CheckedColor), New Rectangle(0, 0, 40, 16), 16)
  602.                 .FillEllipse(New SolidBrush(CheckedBallColor), New Rectangle(Width - 14.5, 2.7, 10, 10))
  603.             Else
  604.                 DrawRoundedPath(e.Graphics, UnCheckedColor, 1.8, New Rectangle(0, 0, 40, 16), 16)
  605.                 .FillEllipse(New SolidBrush(UnCheckedBallColor), New Rectangle(2.7, 2.7, 10, 10))
  606.             End If
  607.  
  608.         End With
  609.     End Sub
  610.  
  611. #End Region
  612.  
  613. #Region " Constructors "
  614.  
  615.     Sub New()
  616.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or _
  617.      ControlStyles.SupportsTransparentBackColor Or ControlStyles.UserPaint, True)
  618.         DoubleBuffered = True
  619.         Cursor = Cursors.Hand
  620.         BackColor = Color.Transparent
  621.         ForeColor = GetHTMLColor("222222")
  622.         UpdateStyles()
  623.     End Sub
  624.  
  625. #End Region
  626.  
  627. #Region " Events "
  628.  
  629.     Event CheckedChanged(ByVal sender As Object)
  630.  
  631.     Protected Overrides Sub OnResize(e As EventArgs)
  632.         MyBase.OnResize(e)
  633.         Size = New Size(42, 18)
  634.         Invalidate()
  635.     End Sub
  636.  
  637.     Protected Overrides Sub OnClick(ByVal e As EventArgs)
  638.         _Checked = Not Checked
  639.         MyBase.OnClick(e)
  640.         Invalidate()
  641.     End Sub
  642.  
  643.     Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
  644.         Invalidate() : MyBase.OnTextChanged(e)
  645.     End Sub
  646.  
  647.     Protected Overrides Sub OnMouseHover(e As EventArgs)
  648.         MyBase.OnMouseHover(e)
  649.         State = MouseMode.Hovered
  650.         Invalidate()
  651.     End Sub
  652.  
  653.     Protected Overrides Sub OnMouseLeave(e As EventArgs)
  654.         MyBase.OnMouseLeave(e)
  655.         State = MouseMode.NormalMode
  656.         Invalidate()
  657.     End Sub
  658.  
  659. #End Region
  660.  
  661. End Class
  662.  
  663. <DefaultEvent("CheckedChanged")> Public Class NordSwitchGreen : Inherits Control
  664.  
  665. #Region " Variables "
  666.  
  667.     Private _Checked As Boolean
  668.     Protected State As MouseMode = MouseMode.NormalMode
  669.     Private _UnCheckedColor As Color = GetHTMLColor("dedede")
  670.     Private _CheckedColor As Color = GetHTMLColor("3acf5f")
  671.     Private _CheckedBallColor As Color = Color.White
  672.     Private _UnCheckedBallColor As Color = Color.White
  673.  
  674. #End Region
  675.  
  676. #Region " Properties "
  677.  
  678.     <Category("Appearance")>
  679.     Property Checked As Boolean
  680.         Get
  681.             Return _Checked
  682.         End Get
  683.         Set(ByVal value As Boolean)
  684.             _Checked = value
  685.             RaiseEvent CheckedChanged(Me)
  686.             Invalidate()
  687.         End Set
  688.     End Property
  689.  
  690.     <Category("Custom Properties"),
  691.     Description("Gets or sets the switch control color while unchecked")>
  692.     Public Property UnCheckedColor As Color
  693.         Get
  694.             Return _UnCheckedColor
  695.         End Get
  696.         Set(value As Color)
  697.             _UnCheckedColor = value
  698.             Invalidate()
  699.         End Set
  700.     End Property
  701.  
  702.     <Category("Custom Properties"),
  703.     Description("Gets or sets the switch control color while checked")>
  704.     Public Property CheckedColor As Color
  705.         Get
  706.             Return _CheckedColor
  707.         End Get
  708.         Set(value As Color)
  709.             _CheckedColor = value
  710.             Invalidate()
  711.         End Set
  712.     End Property
  713.  
  714.     <Category("Custom Properties"),
  715.     Description("Gets or sets the switch control ball color while checked")>
  716.     Public Property CheckedBallColor As Color
  717.         Get
  718.             Return _CheckedBallColor
  719.         End Get
  720.         Set(value As Color)
  721.             _CheckedBallColor = value
  722.             Invalidate()
  723.         End Set
  724.     End Property
  725.  
  726.     <Category("Custom Properties"),
  727.     Description("Gets or sets the switch control ball color while unchecked")>
  728.     Public Property UnCheckedBallColor As Color
  729.         Get
  730.             Return _UnCheckedBallColor
  731.         End Get
  732.         Set(value As Color)
  733.             _UnCheckedBallColor = value
  734.             Invalidate()
  735.         End Set
  736.     End Property
  737.  
  738. #End Region
  739.  
  740. #Region " Constructors "
  741.  
  742.     Sub New()
  743.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or _
  744.      ControlStyles.SupportsTransparentBackColor Or ControlStyles.UserPaint, True)
  745.         DoubleBuffered = True
  746.         Cursor = Cursors.Hand
  747.         BackColor = Color.Transparent
  748.         UpdateStyles()
  749.     End Sub
  750.  
  751. #End Region
  752.  
  753. #Region " Events "
  754.  
  755.     Event CheckedChanged(ByVal sender As Object)
  756.  
  757.     Protected Overrides Sub OnResize(e As EventArgs)
  758.         MyBase.OnResize(e)
  759.         Size = New Size(30, 19)
  760.         Invalidate()
  761.     End Sub
  762.  
  763.     Protected Overrides Sub OnClick(ByVal e As EventArgs)
  764.         _Checked = Not Checked
  765.         MyBase.OnClick(e)
  766.         Invalidate()
  767.     End Sub
  768.  
  769.     Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
  770.         Invalidate() : MyBase.OnTextChanged(e)
  771.     End Sub
  772.  
  773.     Protected Overrides Sub OnMouseHover(e As EventArgs)
  774.         MyBase.OnMouseHover(e)
  775.         State = MouseMode.Hovered
  776.         Invalidate()
  777.     End Sub
  778.  
  779.     Protected Overrides Sub OnMouseLeave(e As EventArgs)
  780.         MyBase.OnMouseLeave(e)
  781.         State = MouseMode.NormalMode
  782.         Invalidate()
  783.     End Sub
  784.  
  785. #End Region
  786.  
  787. #Region " Draw Control "
  788.  
  789.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  790.         With e.Graphics
  791.             .SmoothingMode = SmoothingMode.AntiAlias
  792.             If Checked Then
  793.                 FillRoundedPath(e.Graphics, New SolidBrush(CheckedColor), New Rectangle(0, 1, 28, 16), 16)
  794.                 .FillEllipse(New SolidBrush(CheckedBallColor), New Rectangle(Width - 17, 0, 16, 18))
  795.             Else
  796.                 FillRoundedPath(e.Graphics, New SolidBrush(UnCheckedColor), New Rectangle(0, 1, 28, 16), 16)
  797.                 .FillEllipse(New SolidBrush(UnCheckedBallColor), New Rectangle(0.5, 0, 16, 18))
  798.             End If
  799.  
  800.         End With
  801.     End Sub
  802.  
  803. #End Region
  804.  
  805. End Class
  806.  
  807. <DefaultEvent("CheckedChanged")> Public Class NordSwitchPower : Inherits Control
  808.  
  809. #Region " Variables "
  810.  
  811.     Private _Checked As Boolean
  812.     Protected State As MouseMode = MouseMode.NormalMode
  813.     Private _UnCheckedColor As Color = GetHTMLColor("103859")
  814.     Private _CheckedColor As Color = GetHTMLColor("103859")
  815.     Private _CheckedBallColor As Color = GetHTMLColor("f1f1f1")
  816.     Private _UnCheckedBallColor As Color = GetHTMLColor("f1f1f1")
  817.     Private _CheckedPowerColor As Color = GetHTMLColor("73ba10")
  818.     Private _UnCheckedPowerColor As Color = GetHTMLColor("c3c3c3")
  819.  
  820. #End Region
  821.  
  822. #Region " Properties "
  823.  
  824.     <Category("Appearance")>
  825.     Property Checked As Boolean
  826.         Get
  827.             Return _Checked
  828.         End Get
  829.         Set(ByVal value As Boolean)
  830.             _Checked = value
  831.             RaiseEvent CheckedChanged(Me)
  832.             Invalidate()
  833.         End Set
  834.     End Property
  835.  
  836.     <Category("Custom Properties"),
  837.     Description("Gets or sets the switch control color while unchecked")>
  838.     Public Property UnCheckedColor As Color
  839.         Get
  840.             Return _UnCheckedColor
  841.         End Get
  842.         Set(value As Color)
  843.             _UnCheckedColor = value
  844.             Invalidate()
  845.         End Set
  846.     End Property
  847.  
  848.     <Category("Custom Properties"),
  849.     Description("Gets or sets the switch control color while checked")>
  850.     Public Property CheckedColor As Color
  851.         Get
  852.             Return _CheckedColor
  853.         End Get
  854.         Set(value As Color)
  855.             _CheckedColor = value
  856.             Invalidate()
  857.         End Set
  858.     End Property
  859.  
  860.     <Category("Custom Properties"),
  861.     Description("Gets or sets the switch control ball color while checked")>
  862.     Public Property CheckedBallColor As Color
  863.         Get
  864.             Return _CheckedBallColor
  865.         End Get
  866.         Set(value As Color)
  867.             _CheckedBallColor = value
  868.             Invalidate()
  869.         End Set
  870.     End Property
  871.  
  872.     <Category("Custom Properties"),
  873.     Description("Gets or sets the switch control ball color while unchecked")>
  874.     Public Property UnCheckedBallColor As Color
  875.         Get
  876.             Return _UnCheckedBallColor
  877.         End Get
  878.         Set(value As Color)
  879.             _UnCheckedBallColor = value
  880.             Invalidate()
  881.         End Set
  882.     End Property
  883.  
  884.     <Category("Custom Properties"),
  885.     Description("Gets or sets the switch control power symbol color while checked")>
  886.     Public Property CheckedPowerColor As Color
  887.         Get
  888.             Return _CheckedPowerColor
  889.         End Get
  890.         Set(value As Color)
  891.             _CheckedPowerColor = value
  892.             Invalidate()
  893.         End Set
  894.     End Property
  895.  
  896.     <Category("Custom Properties"),
  897.     Description("Gets or sets the switch control power symbol color while unchecked")>
  898.     Public Property UnCheckedPowerColor As Color
  899.         Get
  900.             Return _UnCheckedPowerColor
  901.         End Get
  902.         Set(value As Color)
  903.             _UnCheckedPowerColor = value
  904.             Invalidate()
  905.         End Set
  906.     End Property
  907.  
  908. #End Region
  909.  
  910. #Region " Constructors "
  911.  
  912.     Sub New()
  913.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or _
  914.      ControlStyles.SupportsTransparentBackColor Or ControlStyles.UserPaint, True)
  915.         DoubleBuffered = True
  916.         Cursor = Cursors.Hand
  917.         BackColor = Color.Transparent
  918.         UpdateStyles()
  919.     End Sub
  920.  
  921. #End Region
  922.  
  923. #Region " Draw Control "
  924.  
  925.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  926.  
  927.         With e.Graphics
  928.             .SmoothingMode = SmoothingMode.AntiAlias
  929.             If Checked Then
  930.                 FillRoundedPath(e.Graphics, New SolidBrush(CheckedColor), New Rectangle(0, 8, 55, 25), 20)
  931.                 .FillEllipse(New SolidBrush(UnCheckedBallColor), New Rectangle(Width - 39, 0, 35, 40))
  932.                 .DrawArc(New Pen(CheckedPowerColor, 2), Width - 31, 10, 19, Height - 23, -62, 300)
  933.                 .DrawLine(New Pen(CheckedPowerColor, 2), Width - 22, 8, Width - 22, 17)
  934.             Else
  935.                 FillRoundedPath(e.Graphics, New SolidBrush(UnCheckedColor), New Rectangle(2, 8, 55, 25), 20)
  936.                 .FillEllipse(New SolidBrush(UnCheckedBallColor), New Rectangle(0, 0, 35, 40))
  937.                 .DrawArc(New Pen(UnCheckedPowerColor, 2), CInt(7.5), 10, Width - 41, Height - 23, -62, 300)
  938.                 .DrawLine(New Pen(UnCheckedPowerColor, 2), 17, 8, 17, 17)
  939.             End If
  940.         End With
  941.  
  942.     End Sub
  943.  
  944. #End Region
  945.  
  946. #Region " Events "
  947.  
  948.     Event CheckedChanged(ByVal sender As Object)
  949.  
  950.     Protected Overrides Sub OnClick(ByVal e As EventArgs)
  951.         _Checked = Not Checked
  952.         RaiseEvent CheckedChanged(Me)
  953.         MyBase.OnClick(e)
  954.         Invalidate()
  955.     End Sub
  956.  
  957.     Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
  958.         Invalidate() : MyBase.OnTextChanged(e)
  959.     End Sub
  960.  
  961.     Protected Overrides Sub OnResize(ByVal e As System.EventArgs)
  962.         MyBase.OnResize(e)
  963.         Size = New Size(60, 44)
  964.         Invalidate()
  965.     End Sub
  966.  
  967.     Protected Overrides Sub OnMouseHover(e As EventArgs)
  968.         MyBase.OnMouseHover(e)
  969.         State = MouseMode.Hovered
  970.         Invalidate()
  971.     End Sub
  972.  
  973.     Protected Overrides Sub OnMouseLeave(e As EventArgs)
  974.         MyBase.OnMouseLeave(e)
  975.         State = MouseMode.NormalMode
  976.         Invalidate()
  977.     End Sub
  978.  
  979. #End Region
  980.  
  981. End Class
  982.  
  983. #End Region
  984.  
  985. #Region " TabControl "
  986.  
  987. #Region " Hrizontal TabControl "
  988.  
  989. Public Class NordHorizontalTabControl : Inherits TabControl
  990.  
  991. #Region " Variables "
  992.  
  993.     Private _TabPageColor As Color = GetHTMLColor("bbd2d8")
  994.     Private _TabColor As Color = GetHTMLColor("174b7a")
  995.     Private _TabLowerColor As Color = GetHTMLColor("164772")
  996.     Private _TabSelectedTextColor As Color = Color.White
  997.     Private _TabUnSlectedTextColor As Color = GetHTMLColor("7188ad")
  998.  
  999. #End Region
  1000.  
  1001. #Region " Constructors "
  1002.  
  1003.     Sub New()
  1004.         SetStyle(ControlStyles.UserPaint Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.AllPaintingInWmPaint Or ControlStyles.SupportsTransparentBackColor, True)
  1005.         DoubleBuffered = True
  1006.         SizeMode = TabSizeMode.Fixed
  1007.         Dock = DockStyle.None
  1008.         ItemSize = New Size(80, 55)
  1009.         Alignment = TabAlignment.Top
  1010.         UpdateStyles()
  1011.     End Sub
  1012.  
  1013. #End Region
  1014.  
  1015. #Region " Draw Control "
  1016.  
  1017.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  1018.         Dim G As Graphics = e.Graphics
  1019.         With G
  1020.             .Clear(TabPageColor)
  1021.             Cursor = Cursors.Hand
  1022.  
  1023.             .TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
  1024.  
  1025.             .FillRectangle(New SolidBrush(TabColor), New Rectangle(0, 0, Width, 60))
  1026.  
  1027.             .FillRectangle(New SolidBrush(TabLowerColor), New Rectangle(0, 52, Width, 8))
  1028.  
  1029.             For i = 0 To TabCount - 1
  1030.  
  1031.                 Dim R As Rectangle = GetTabRect(i)
  1032.  
  1033.                 If SelectedIndex = i Then
  1034.                     .DrawString(TabPages(i).Text, New Font("Helvetica CE", 9, FontStyle.Bold), New SolidBrush(TabSelectedTextColor), R.X + 30, R.Y + 20, New StringFormat() With {.Alignment = StringAlignment.Center})
  1035.                 Else
  1036.                     .DrawString(TabPages(i).Text, New Font("Helvetica CE", 9, FontStyle.Bold), New SolidBrush(TabUnSlectedTextColor), R.X + 30, R.Y + 20, New StringFormat() With {.Alignment = StringAlignment.Center})
  1037.                 End If
  1038.  
  1039.             Next
  1040.         End With
  1041.  
  1042.     End Sub
  1043.  
  1044. #End Region
  1045.  
  1046. #Region " Events "
  1047.  
  1048.     Protected Overrides Sub OnCreateControl()
  1049.         MyBase.OnCreateControl()
  1050.         For Each Tab As TabPage In MyBase.TabPages
  1051.             Tab.BackColor = TabPageColor
  1052.         Next
  1053.     End Sub
  1054.  
  1055. #End Region
  1056.  
  1057. #Region " Properties "
  1058.  
  1059.     <Category("Custom Properties"),
  1060.     Description("Gets or sets the tabpages color of the tabcontrol")>
  1061.     Public Property TabPageColor As Color
  1062.         Get
  1063.             Return _TabPageColor
  1064.         End Get
  1065.         Set(value As Color)
  1066.             _TabPageColor = value
  1067.             Invalidate()
  1068.         End Set
  1069.     End Property
  1070.  
  1071.     <Category("Custom Properties"),
  1072.     Description("Gets or sets the tabcontrol header color")>
  1073.     Public Property TabColor As Color
  1074.         Get
  1075.             Return _TabColor
  1076.         End Get
  1077.         Set(value As Color)
  1078.             _TabColor = value
  1079.             Invalidate()
  1080.         End Set
  1081.     End Property
  1082.  
  1083.     <Category("Custom Properties"),
  1084.     Description("Gets or sets the tabcontrol line color below the header")>
  1085.     Public Property TabLowerColor As Color
  1086.         Get
  1087.             Return _TabLowerColor
  1088.         End Get
  1089.         Set(value As Color)
  1090.             _TabLowerColor = value
  1091.             Invalidate()
  1092.         End Set
  1093.     End Property
  1094.  
  1095.     <Category("Custom Properties"),
  1096.     Description("Gets or sets the tabcontrol Text color while unchecked")>
  1097.     Public Property TabSelectedTextColor As Color
  1098.         Get
  1099.             Return _TabSelectedTextColor
  1100.         End Get
  1101.         Set(value As Color)
  1102.             _TabSelectedTextColor = value
  1103.             Invalidate()
  1104.         End Set
  1105.     End Property
  1106.  
  1107.     <Category("Custom Properties"),
  1108.     Description("Gets or sets the tabcontrol Text color while unchecked")>
  1109.     Public Property TabUnSlectedTextColor As Color
  1110.         Get
  1111.             Return _TabUnSlectedTextColor
  1112.         End Get
  1113.         Set(value As Color)
  1114.             _TabUnSlectedTextColor = value
  1115.             Invalidate()
  1116.         End Set
  1117.     End Property
  1118.  
  1119. #End Region
  1120.  
  1121. End Class
  1122.  
  1123. #End Region
  1124.  
  1125. #Region " Vertical TabControl "
  1126.  
  1127. Public Class NordVerticalTabControl : Inherits TabControl
  1128.  
  1129. #Region " Variables "
  1130.  
  1131.     Private _TabColor As Color = GetHTMLColor("f6f6f6")
  1132.     Private _TabPageColor As Color = Color.White
  1133.     Private _TabSelectedTextColor As Color = GetHTMLColor("174b7a")
  1134.     Private _TabUnSlectedTextColor As Color = Color.DarkGray
  1135.  
  1136. #End Region
  1137.  
  1138. #Region " Constructors "
  1139.  
  1140.     Sub New()
  1141.         SetStyle(ControlStyles.UserPaint Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.AllPaintingInWmPaint Or ControlStyles.SupportsTransparentBackColor, True)
  1142.         DoubleBuffered = True
  1143.         SizeMode = TabSizeMode.Fixed
  1144.         Dock = DockStyle.None
  1145.         ItemSize = New Size(35, 135)
  1146.         Alignment = TabAlignment.Left
  1147.         Font = New Font("Segoe UI", 8)
  1148.         UpdateStyles()
  1149.     End Sub
  1150.  
  1151. #End Region
  1152.  
  1153. #Region " Properties "
  1154.  
  1155.     <Category("Custom Properties"),
  1156.     Description("Gets or sets the tabcontrol left side color")>
  1157.     Public Property TabColor As Color
  1158.         Get
  1159.             Return _TabColor
  1160.         End Get
  1161.         Set(value As Color)
  1162.             _TabColor = value
  1163.             Invalidate()
  1164.         End Set
  1165.     End Property
  1166.  
  1167.     <Category("Custom Properties"),
  1168.     Description("Gets or sets the tabpages color of the tabcontrol")>
  1169.     Public Property TabPageColor As Color
  1170.         Get
  1171.             Return _TabPageColor
  1172.         End Get
  1173.         Set(value As Color)
  1174.             _TabPageColor = value
  1175.             Invalidate()
  1176.         End Set
  1177.     End Property
  1178.  
  1179.     <Category("Custom Properties"),
  1180.     Description("Gets or sets the tabcontrol Text color while selected")>
  1181.     Public Property TabSelectedTextColor As Color
  1182.         Get
  1183.             Return _TabSelectedTextColor
  1184.         End Get
  1185.         Set(value As Color)
  1186.             _TabSelectedTextColor = value
  1187.             Invalidate()
  1188.         End Set
  1189.     End Property
  1190.  
  1191.     <Category("Custom Properties"),
  1192.     Description("Gets or sets the tabcontrol Text color while not selected")>
  1193.     Public Property TabUnSlectedTextColor As Color
  1194.         Get
  1195.             Return _TabUnSlectedTextColor
  1196.         End Get
  1197.         Set(value As Color)
  1198.             _TabUnSlectedTextColor = value
  1199.             Invalidate()
  1200.         End Set
  1201.     End Property
  1202.  
  1203. #End Region
  1204.  
  1205. #Region " Draw Control "
  1206.  
  1207.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  1208.         Dim G As Graphics = e.Graphics
  1209.  
  1210.         With G
  1211.  
  1212.             .TextRenderingHint = Drawing.Text.TextRenderingHint.ClearTypeGridFit
  1213.             .FillRectangle(New SolidBrush(TabColor), New Rectangle(0, 0, ItemSize.Height, Height))
  1214.             .FillRectangle(New SolidBrush(TabPageColor), New Rectangle(ItemSize.Height, 0, Width, Height))
  1215.  
  1216.             For i = 0 To TabCount - 1
  1217.  
  1218.                 Dim R As Rectangle = GetTabRect(i)
  1219.                 If SelectedIndex = i Then
  1220.  
  1221.                     CentreString(G, TabPages(i).Text, Font, New SolidBrush(TabSelectedTextColor), New Rectangle(R.X, R.Y + 5, R.Width - 4, R.Height))
  1222.                 Else
  1223.                     CentreString(G, TabPages(i).Text, Font, New SolidBrush(TabUnSlectedTextColor), New Rectangle(R.X, R.Y + 5, R.Width - 4, R.Height))
  1224.  
  1225.                 End If
  1226.                 If Not ImageList Is Nothing Then
  1227.  
  1228.                     .DrawImage(ImageList.Images(i), New Rectangle(R.X + 9, R.Y + 10, 20, 20))
  1229.  
  1230.                 End If
  1231.  
  1232.             Next
  1233.  
  1234.         End With
  1235.  
  1236.     End Sub
  1237.  
  1238. #End Region
  1239.  
  1240. #Region " Events "
  1241.  
  1242.     Protected Overrides Sub OnCreateControl()
  1243.         MyBase.OnCreateControl()
  1244.         For Each Tab As TabPage In MyBase.TabPages
  1245.             Tab.BackColor = TabPageColor
  1246.         Next
  1247.     End Sub
  1248.  
  1249. #End Region
  1250.  
  1251. End Class
  1252.  
  1253. #End Region
  1254.  
  1255. #End Region
  1256.  
  1257. #Region " GroupBox "
  1258.  
  1259. Public Class NordGroupBox : Inherits ContainerControl
  1260.  
  1261. #Region " Variables "
  1262.  
  1263.     Private _HeaderColor As Color = GetHTMLColor("f8f8f9")
  1264.     Private _HeaderTextColor As Color = GetHTMLColor("dadada")
  1265.     Private _BorderColor As Color = GetHTMLColor("eaeaeb")
  1266.     Private _BaseColor As Color = Color.White
  1267.  
  1268. #End Region
  1269.  
  1270. #Region " Properties "
  1271.  
  1272.     <Category(" Custom Properties "),
  1273.     Description("Gets or sets the Header color for the control.")>
  1274.     Public Property HeaderColor As Color
  1275.         Get
  1276.             Return _HeaderColor
  1277.         End Get
  1278.         Set(value As Color)
  1279.             _HeaderColor = value
  1280.             Invalidate()
  1281.         End Set
  1282.     End Property
  1283.  
  1284.     <Category(" Custom Properties "),
  1285.     Description("Gets or sets the text color for the control.")>
  1286.     Public Property HeaderTextColor As Color
  1287.         Get
  1288.             Return _HeaderTextColor
  1289.         End Get
  1290.         Set(value As Color)
  1291.             _HeaderTextColor = value
  1292.             Invalidate()
  1293.         End Set
  1294.     End Property
  1295.  
  1296.     <Category(" Custom Properties "),
  1297.     Description("Gets or sets the background border color for the control.")>
  1298.     Public Property BorderColor As Color
  1299.         Get
  1300.             Return _BorderColor
  1301.         End Get
  1302.         Set(value As Color)
  1303.             _BorderColor = value
  1304.             Invalidate()
  1305.         End Set
  1306.     End Property
  1307.  
  1308.     <Category(" Custom Properties "),
  1309.     Description("Gets or sets the background color for the control.")>
  1310.     Public Property BaseColor As Color
  1311.         Get
  1312.             Return _BaseColor
  1313.         End Get
  1314.         Set(value As Color)
  1315.             _BaseColor = value
  1316.             Invalidate()
  1317.         End Set
  1318.     End Property
  1319.  
  1320. #End Region
  1321.  
  1322. #Region " Draw Control "
  1323.  
  1324.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  1325.         With e.Graphics
  1326.             Dim Rect As New Rectangle(0, 0, Width, Height)
  1327.  
  1328.             .FillRectangle(New SolidBrush(BaseColor), Rect)
  1329.             .FillRectangle(New SolidBrush(HeaderColor), New Rectangle(0, 0, Width, 50))
  1330.  
  1331.             .DrawLine(New Pen(BorderColor, 1), New Point(0, 50), New Point(Width, 50))
  1332.             .DrawRectangle(New Pen(BorderColor, 1), New Rectangle(0, 0, Width - 1, Height - 1))
  1333.  
  1334.             .DrawString(Text, Font, New SolidBrush(HeaderTextColor), New Rectangle(5, 0, Width, 50), New StringFormat() With {.LineAlignment = StringAlignment.Center})
  1335.  
  1336.         End With
  1337.     End Sub
  1338.  
  1339. #End Region
  1340.  
  1341. #Region " Constructors "
  1342.  
  1343.     Sub New()
  1344.         SetStyle(ControlStyles.UserPaint Or ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.SupportsTransparentBackColor, True)
  1345.         DoubleBuffered = True
  1346.         Font = New Font("Segoe UI", 10)
  1347.         BackColor = Color.Transparent
  1348.         UpdateStyles()
  1349.     End Sub
  1350.  
  1351. #End Region
  1352.  
  1353. End Class
  1354.  
  1355. #End Region
  1356.  
  1357. #Region " TextBox "
  1358.  
  1359. Public Class NordTextbox : Inherits Control
  1360.  
  1361. #Region " Variables "
  1362.  
  1363.     Private WithEvents T As New TextBox
  1364.     Private _TextAlign As HorizontalAlignment = HorizontalAlignment.Left
  1365.     Private _MaxLength As Integer = 32767
  1366.     Private _ReadOnly As Boolean = False
  1367.     Private _UseSystemPasswordChar As Boolean = False
  1368.     Private _WatermarkText As String = String.Empty
  1369.     Private _SideImage As Image
  1370.     Private TBC As Color = GetHTMLColor("bbd2d8")
  1371.     Private TFC As Color = GetHTMLColor("eaeaeb")
  1372.     Private State As MouseMode = MouseMode.NormalMode
  1373.     Private _BackColor As Color = TBC
  1374.     Private _NormalLineColor As Color = GetHTMLColor("eaeaeb")
  1375.     Private _HoverLineColor As Color = GetHTMLColor("fc3955")
  1376.     Private _PushedLineColor As Color = GetHTMLColor("fc3955")
  1377.  
  1378. #End Region
  1379.  
  1380. #Region " Native Methods "
  1381.  
  1382.     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
  1383.  
  1384. #End Region
  1385.  
  1386. #Region " Properties "
  1387.  
  1388.     <Browsable(False), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
  1389.     ReadOnly Property BorderStyle As BorderStyle
  1390.         Get
  1391.             Return BorderStyle.None
  1392.         End Get
  1393.     End Property
  1394.  
  1395.     <Category("Appearance"),
  1396.     Description("Gets or sets how text is aligned in a System.Windows.Forms.TextBox control.")>
  1397.     Public Overridable Shadows Property TextAlign() As HorizontalAlignment
  1398.         Get
  1399.             Return _TextAlign
  1400.         End Get
  1401.         Set(ByVal value As HorizontalAlignment)
  1402.             _TextAlign = value
  1403.             If T IsNot Nothing Then
  1404.                 T.TextAlign = value
  1405.             End If
  1406.         End Set
  1407.     End Property
  1408.  
  1409.     <Category("Behavior"),
  1410.      Description("Gets or sets how text is aligned in a System.Windows.Forms.TextBox control.")>
  1411.     Public Overridable Shadows Property MaxLength() As Integer
  1412.         Get
  1413.             Return _MaxLength
  1414.         End Get
  1415.         Set(ByVal value As Integer)
  1416.             _MaxLength = value
  1417.             If T IsNot Nothing Then
  1418.                 T.MaxLength = value
  1419.             End If
  1420.         End Set
  1421.     End Property
  1422.  
  1423.     <Category("Appearance"),
  1424.      Description("Gets or sets the background color of the control.")>
  1425.     Public Shadows Property BackColor As Color
  1426.         Get
  1427.             Return _BackColor
  1428.         End Get
  1429.         Set(value As Color)
  1430.             MyBase.BackColor = value
  1431.             _BackColor = value
  1432.             T.BackColor = value
  1433.             Invalidate()
  1434.         End Set
  1435.     End Property
  1436.  
  1437.     <Category("Behavior"),
  1438.      Description("Gets or sets a value indicating whether text in the text box is read-only.")>
  1439.     Public Overridable Shadows Property [ReadOnly]() As Boolean
  1440.         Get
  1441.             Return _ReadOnly
  1442.         End Get
  1443.         Set(ByVal value As Boolean)
  1444.             _ReadOnly = value
  1445.             If T IsNot Nothing Then
  1446.                 T.ReadOnly = value
  1447.             End If
  1448.         End Set
  1449.     End Property
  1450.  
  1451.     <Category("Behavior"),
  1452.      Description("Gets or sets a value indicating whether the text in the System.Windows.Forms.TextBox control should appear as the default password character.")>
  1453.     Public Overridable Shadows Property UseSystemPasswordChar() As Boolean
  1454.         Get
  1455.             Return _UseSystemPasswordChar
  1456.         End Get
  1457.         Set(ByVal value As Boolean)
  1458.             _UseSystemPasswordChar = value
  1459.             If T IsNot Nothing Then
  1460.                 T.UseSystemPasswordChar = value
  1461.             End If
  1462.         End Set
  1463.     End Property
  1464.  
  1465.     <Browsable(False), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
  1466.     Public Overridable Shadows ReadOnly Property Multiline() As Boolean
  1467.         Get
  1468.             Return False
  1469.         End Get
  1470.     End Property
  1471.  
  1472.     <Browsable(False), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
  1473.     Public Overridable Shadows ReadOnly Property BackgroundImage() As Image
  1474.         Get
  1475.             Return Nothing
  1476.         End Get
  1477.     End Property
  1478.  
  1479.     <Category("Appearance"),
  1480.     Description("Gets or sets the current text in the System.Windows.Forms.TextBox.")>
  1481.     Public Overridable Shadows Property Text As String
  1482.         Get
  1483.             Return MyBase.Text
  1484.         End Get
  1485.         Set(ByVal value As String)
  1486.             MyBase.Text = value
  1487.             If T IsNot Nothing Then
  1488.                 T.Text = value
  1489.             End If
  1490.         End Set
  1491.     End Property
  1492.  
  1493.     <Category("Custom Properties "),
  1494.      Description("Gets or sets the text in the System.Windows.Forms.TextBox while being empty.")>
  1495.     Public Property WatermarkText As String
  1496.         Get
  1497.             Return _WatermarkText
  1498.         End Get
  1499.         Set(value As String)
  1500.             _WatermarkText = value
  1501.             SendMessage(T.Handle, &H1501, 0, value)
  1502.             Invalidate()
  1503.         End Set
  1504.     End Property
  1505.  
  1506.     <Category("Custom Properties "),
  1507.      Description("Gets or sets the image of the control.")>
  1508.     <Browsable(True)> Public Property SideImage As Image
  1509.         Get
  1510.             Return _SideImage
  1511.         End Get
  1512.         Set(value As Image)
  1513.             _SideImage = value
  1514.             Invalidate()
  1515.         End Set
  1516.     End Property
  1517.  
  1518.     <Category("Custom Properties "),
  1519.      Description("Gets or sets the lower line color of the control in normal mouse state.")>
  1520.     Public Property NormalLineColor As Color
  1521.         Get
  1522.             Return _NormalLineColor
  1523.         End Get
  1524.         Set(value As Color)
  1525.             _NormalLineColor = value
  1526.             Invalidate()
  1527.         End Set
  1528.     End Property
  1529.  
  1530.     <Category("Custom Properties "),
  1531.      Description("Gets or sets the lower line color of the control in mouse hover state.")>
  1532.     Public Property HoverLineColor As Color
  1533.         Get
  1534.             Return _HoverLineColor
  1535.         End Get
  1536.         Set(value As Color)
  1537.             _HoverLineColor = value
  1538.             Invalidate()
  1539.         End Set
  1540.     End Property
  1541.  
  1542.     <Category("Custom Properties "),
  1543.     Description("Gets or sets the lower line color of the control in mouse down state.")>
  1544.     Public Property PushedLineColor As Color
  1545.         Get
  1546.             Return _PushedLineColor
  1547.         End Get
  1548.         Set(value As Color)
  1549.             _PushedLineColor = value
  1550.             Invalidate()
  1551.         End Set
  1552.     End Property
  1553.  
  1554. #End Region
  1555.  
  1556. #Region " Constructors "
  1557.  
  1558.     Sub New()
  1559.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or _
  1560.                   ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer Or _
  1561.                   ControlStyles.SupportsTransparentBackColor, True)
  1562.         DoubleBuffered = True
  1563.         BackColor = TBC
  1564.         Font = New Font("Segoe UI", 11, FontStyle.Regular)
  1565.         With T
  1566.             .Multiline = False
  1567.             .Cursor = Cursors.IBeam
  1568.             .BackColor = BackColor
  1569.             .ForeColor = TFC
  1570.             .BorderStyle = BorderStyle.None
  1571.             .Location = New Point(7, 8)
  1572.             .Font = Font
  1573.             .Size = New Size(Width - 10, 30)
  1574.             .UseSystemPasswordChar = _UseSystemPasswordChar
  1575.         End With
  1576.         Size = New Size(135, 30)
  1577.         UpdateStyles()
  1578.     End Sub
  1579.  
  1580. #End Region
  1581.  
  1582. #Region " Events "
  1583.  
  1584.     Private Sub T_TextChanged(ByVal sender As Object, ByVal e As EventArgs) Handles T.TextChanged
  1585.         Text = T.Text
  1586.     End Sub
  1587.  
  1588.     Private Sub T_KeyDown(ByVal sender As Object, ByVal e As KeyEventArgs) Handles T.KeyDown
  1589.         If e.Control AndAlso e.KeyCode = Keys.A Then e.SuppressKeyPress = True
  1590.         If e.Control AndAlso e.KeyCode = Keys.C Then
  1591.             T.Copy()
  1592.             e.SuppressKeyPress = True
  1593.         End If
  1594.     End Sub
  1595.  
  1596.     Protected NotOverridable Overrides Sub OnCreateControl()
  1597.         MyBase.OnCreateControl()
  1598.         If Not Controls.Contains(T) Then Controls.Add(T)
  1599.     End Sub
  1600.  
  1601.     Protected NotOverridable Overrides Sub OnResize(e As EventArgs)
  1602.         MyBase.OnResize(e)
  1603.         Height = 30
  1604.     End Sub
  1605.  
  1606.     Private Sub T_MouseHover(ByVal sender As Object, e As EventArgs) Handles T.MouseHover
  1607.         State = MouseMode.Hovered
  1608.         Invalidate()
  1609.     End Sub
  1610.     Protected Overrides Sub OnMouseHover(e As EventArgs)
  1611.         MyBase.OnMouseHover(e)
  1612.         State = MouseMode.Hovered
  1613.         Invalidate()
  1614.     End Sub
  1615.     Protected Overrides Sub OnMouseLeave(e As EventArgs)
  1616.         MyBase.OnMouseLeave(e)
  1617.         State = MouseMode.NormalMode
  1618.         Invalidate()
  1619.     End Sub
  1620.     Private Sub T_MouseLeave(ByVal sender As Object, e As EventArgs) Handles T.MouseLeave
  1621.         State = MouseMode.NormalMode
  1622.         Invalidate()
  1623.     End Sub
  1624.  
  1625.     Private Sub T_MouseUp(ByVal sender As Object, e As MouseEventArgs) Handles T.MouseUp
  1626.         State = MouseMode.NormalMode
  1627.         Invalidate()
  1628.     End Sub
  1629.  
  1630.     Private Sub T_MouseEnter(ByVal sender As Object, e As EventArgs) Handles T.MouseEnter
  1631.         State = MouseMode.NormalMode
  1632.         Invalidate()
  1633.     End Sub
  1634.  
  1635.     Private Sub T_MouseDown(ByVal sender As Object, e As EventArgs) Handles T.MouseDown
  1636.         State = MouseMode.Pushed
  1637.         Invalidate()
  1638.     End Sub
  1639.  
  1640. #End Region
  1641.  
  1642. #Region " Draw Control "
  1643.  
  1644.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  1645.         Dim G As Graphics = e.Graphics
  1646.         With G
  1647.  
  1648.             .TextRenderingHint = Drawing.Text.TextRenderingHint.ClearTypeGridFit
  1649.  
  1650.             Select Case State
  1651.  
  1652.                 Case MouseMode.NormalMode
  1653.                     .DrawLine(New Pen(NormalLineColor, 1), New Point(0, 29), New Point(Width, 29))
  1654.                 Case MouseMode.Hovered
  1655.                     .DrawLine(New Pen(HoverLineColor, 1), New Point(0, 29), New Point(Width, 29))
  1656.                 Case MouseMode.Pushed
  1657.                     .DrawLine(New Pen(PushedLineColor, 1), New Point(0, 29), New Point(Width, 29))
  1658.  
  1659.             End Select
  1660.  
  1661.             If Not SideImage Is Nothing Then
  1662.                 T.Location = New Point(33, 5)
  1663.                 T.Width = Width - 60
  1664.                 .InterpolationMode = InterpolationMode.HighQualityBicubic
  1665.                 .DrawImage(SideImage, New Rectangle(8, 5, 16, 16))
  1666.             Else
  1667.                 T.Location = New Point(7, 5)
  1668.                 T.Width = Width - 10
  1669.             End If
  1670.  
  1671.             If Not ContextMenuStrip Is Nothing Then T.ContextMenuStrip = ContextMenuStrip
  1672.  
  1673.         End With
  1674.  
  1675.     End Sub
  1676.  
  1677. #End Region
  1678.  
  1679. End Class
  1680.  
  1681. #End Region
  1682.  
  1683. #Region " CheckBox "
  1684.  
  1685. Public Class NordCheckBox : Inherits Control
  1686.  
  1687. #Region " Variables "
  1688.  
  1689.     Private _Checked As Boolean
  1690.     Protected State As MouseMode = MouseMode.NormalMode
  1691.     Private _BorderColor As Color = GetHTMLColor("164772")
  1692.     Private _CheckColor As Color = GetHTMLColor("5db5e9")
  1693.  
  1694. #End Region
  1695.  
  1696. #Region " Properties "
  1697.  
  1698.     <Category("Appearance")>
  1699.     Property Checked As Boolean
  1700.         Get
  1701.             Return _Checked
  1702.         End Get
  1703.         Set(ByVal value As Boolean)
  1704.             _Checked = value
  1705.             RaiseEvent CheckedChanged(Me)
  1706.             Invalidate()
  1707.         End Set
  1708.     End Property
  1709.  
  1710.     <Category("Custom Properties"),
  1711.     Description("Gets or sets the Checkbox control color while checked.")>
  1712.     Property BorderColor As Color
  1713.         Get
  1714.             Return _BorderColor
  1715.         End Get
  1716.         Set(value As Color)
  1717.             _BorderColor = value
  1718.             Invalidate()
  1719.         End Set
  1720.     End Property
  1721.  
  1722.     <Category("Custom Properties"),
  1723.     Description("Gets or sets the Checkbox control check symbol color while checked.")>
  1724.     Property CheckColor As Color
  1725.         Get
  1726.             Return _CheckColor
  1727.         End Get
  1728.         Set(value As Color)
  1729.             _CheckColor = value
  1730.             Invalidate()
  1731.         End Set
  1732.     End Property
  1733.  
  1734. #End Region
  1735.  
  1736. #Region " Constructors "
  1737.  
  1738.     Sub New()
  1739.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or _
  1740.      ControlStyles.SupportsTransparentBackColor Or ControlStyles.UserPaint, True)
  1741.         DoubleBuffered = True
  1742.         Cursor = Cursors.Hand
  1743.         BackColor = Color.Transparent
  1744.         ForeColor = GetHTMLColor("222222")
  1745.         Font = New Font("Segoe UI", 9, FontStyle.Regular)
  1746.         UpdateStyles()
  1747.     End Sub
  1748.  
  1749. #End Region
  1750.  
  1751. #Region " Draw Control "
  1752.  
  1753.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  1754.         Dim G As Graphics = e.Graphics
  1755.         G.TextRenderingHint = Drawing.Text.TextRenderingHint.ClearTypeGridFit
  1756.         G.SmoothingMode = SmoothingMode.AntiAlias
  1757.         Using CheckBorder As New GraphicsPath With {.FillMode = FillMode.Winding}
  1758.             CheckBorder.AddArc(0, 0, 10, 8, 180, 90)
  1759.             CheckBorder.AddArc(8, 0, 8, 10, -90, 90)
  1760.             CheckBorder.AddArc(8, 8, 8, 8, 0, 70)
  1761.             CheckBorder.AddArc(0, 8, 10, 8, 90, 90)
  1762.             CheckBorder.CloseAllFigures()
  1763.             G.DrawPath(New Pen(BorderColor, 1.5), CheckBorder)
  1764.             If Checked Then
  1765.                 G.DrawString("b", New Font("Marlett", 13), New SolidBrush(CheckColor), New Rectangle(-2, 0.5, Width, Height))
  1766.             End If
  1767.         End Using
  1768.  
  1769.         G.DrawString(Text, Font, New SolidBrush(ForeColor), New Rectangle(18, 1, Width, Height - 4), New StringFormat With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Center})
  1770.  
  1771.     End Sub
  1772.  
  1773. #End Region
  1774.  
  1775. #Region " Events "
  1776.  
  1777.     Event CheckedChanged(ByVal sender As Object)
  1778.  
  1779.     Protected Overrides Sub OnClick(ByVal e As EventArgs)
  1780.         _Checked = Not Checked
  1781.         RaiseEvent CheckedChanged(Me)
  1782.         MyBase.OnClick(e)
  1783.         Invalidate()
  1784.     End Sub
  1785.  
  1786.     Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
  1787.         Invalidate() : MyBase.OnTextChanged(e)
  1788.     End Sub
  1789.  
  1790.     Protected Overrides Sub OnResize(ByVal e As System.EventArgs)
  1791.         MyBase.OnResize(e)
  1792.         Height = 18
  1793.         Invalidate()
  1794.     End Sub
  1795.  
  1796.     Protected Overrides Sub OnMouseHover(e As EventArgs)
  1797.         MyBase.OnMouseHover(e)
  1798.         State = MouseMode.Hovered
  1799.         Invalidate()
  1800.     End Sub
  1801.  
  1802.     Protected Overrides Sub OnMouseLeave(e As EventArgs)
  1803.         MyBase.OnMouseLeave(e)
  1804.         State = MouseMode.NormalMode
  1805.         Invalidate()
  1806.     End Sub
  1807.  
  1808. #End Region
  1809.  
  1810. End Class
  1811.  
  1812. #End Region
  1813.  
  1814. #Region " RadioButton "
  1815.  
  1816. <DefaultEvent("CheckedChanged")> Public Class NordRadioButton : Inherits Control
  1817.  
  1818. #Region " Variables "
  1819.  
  1820.     Private _Checked As Boolean
  1821.     Protected _Group As Integer = 1
  1822.     Protected State As MouseMode = MouseMode.NormalMode
  1823.     Private _CheckBorderColor As Color = GetHTMLColor("164772")
  1824.     Private _UnCheckBorderColor As Color = Color.Black
  1825.     Private _CheckColor As Color = Color.Black
  1826.  
  1827. #End Region
  1828.  
  1829. #Region " Events "
  1830.  
  1831.     Event CheckedChanged(ByVal sender As Object)
  1832.  
  1833. #End Region
  1834.  
  1835. #Region " Properties "
  1836.  
  1837.     <Category("Appearance")>
  1838.     Property Checked As Boolean
  1839.         Get
  1840.             Return _Checked
  1841.         End Get
  1842.         Set(ByVal value As Boolean)
  1843.             _Checked = value
  1844.             RaiseEvent CheckedChanged(Me)
  1845.             Invalidate()
  1846.         End Set
  1847.     End Property
  1848.  
  1849.     <Category("Appearance")>
  1850.     Property Group As Integer
  1851.         Get
  1852.             Return _Group
  1853.         End Get
  1854.         Set(ByVal value As Integer)
  1855.             _Group = value
  1856.             Invalidate()
  1857.         End Set
  1858.     End Property
  1859.  
  1860.     <Category("Custom Properties"),
  1861.     Description("Gets or sets the Radiobutton control border color while checked.")>
  1862.     Property CheckBorderColor As Color
  1863.         Get
  1864.             Return _CheckBorderColor
  1865.         End Get
  1866.         Set(value As Color)
  1867.             _CheckBorderColor = value
  1868.             Invalidate()
  1869.         End Set
  1870.     End Property
  1871.  
  1872.     <Category("Custom Properties"),
  1873.     Description("Gets or sets the Radiobutton control border color while unchecked.")>
  1874.     Property UnCheckBorderColor As Color
  1875.         Get
  1876.             Return _UnCheckBorderColor
  1877.         End Get
  1878.         Set(value As Color)
  1879.             _UnCheckBorderColor = value
  1880.             Invalidate()
  1881.         End Set
  1882.     End Property
  1883.  
  1884.     <Category("Custom Properties"),
  1885.     Description("Gets or sets the Radiobutton control check symbol color while checked.")>
  1886.     Property CheckColor As Color
  1887.         Get
  1888.             Return _CheckColor
  1889.         End Get
  1890.         Set(value As Color)
  1891.             _CheckColor = value
  1892.             Invalidate()
  1893.         End Set
  1894.     End Property
  1895.  
  1896. #End Region
  1897.  
  1898. #Region " Constructors "
  1899.  
  1900.     Sub New()
  1901.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or _
  1902.     ControlStyles.SupportsTransparentBackColor Or ControlStyles.UserPaint, True)
  1903.         DoubleBuffered = True
  1904.         Cursor = Cursors.Hand
  1905.         BackColor = Color.Transparent
  1906.         ForeColor = GetHTMLColor("222222")
  1907.         Font = New Font("Segoe UI", 9, FontStyle.Regular)
  1908.         UpdateStyles()
  1909.     End Sub
  1910.  
  1911. #End Region
  1912.  
  1913. #Region " Draw Control "
  1914.  
  1915.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  1916.         Dim G As Graphics = e.Graphics
  1917.         Dim R As New Rectangle(1, 1, 18, 18)
  1918.         With G
  1919.             .SmoothingMode = SmoothingMode.HighQuality
  1920.             .TextRenderingHint = Drawing.Text.TextRenderingHint.ClearTypeGridFit
  1921.             If Checked Then
  1922.                 .FillEllipse(New SolidBrush(CheckColor), New Rectangle(4, 4, 12, 12))
  1923.                 .DrawEllipse(New Pen(CheckBorderColor, 2), R)
  1924.             Else
  1925.                 .DrawEllipse(New Pen(UnCheckBorderColor, 2), R)
  1926.             End If
  1927.             .DrawString(Text, Font, New SolidBrush(ForeColor), New Rectangle(21, 1.5, Width, Height - 2), New StringFormat With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Center})
  1928.         End With
  1929.  
  1930.     End Sub
  1931.  
  1932. #End Region
  1933.  
  1934. #Region " Events "
  1935.  
  1936.     Private Sub UpdateState()
  1937.         If Not IsHandleCreated OrElse Not Checked Then Return
  1938.         For Each C As Control In Parent.Controls
  1939.             If C IsNot Me AndAlso TypeOf C Is NordRadioButton AndAlso DirectCast(C, NordRadioButton).Group = _Group Then
  1940.                 DirectCast(C, NordRadioButton).Checked = False
  1941.             End If
  1942.         Next
  1943.     End Sub
  1944.  
  1945.     Protected Overrides Sub OnClick(ByVal e As EventArgs)
  1946.         _Checked = Not Checked
  1947.         UpdateState()
  1948.         MyBase.OnClick(e)
  1949.         Invalidate()
  1950.     End Sub
  1951.  
  1952.     Protected Overrides Sub OnCreateControl()
  1953.         UpdateState()
  1954.         MyBase.OnCreateControl()
  1955.     End Sub
  1956.  
  1957.     Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
  1958.         Invalidate() : MyBase.OnTextChanged(e)
  1959.     End Sub
  1960.  
  1961.     Protected Overrides Sub OnResize(ByVal e As System.EventArgs)
  1962.         MyBase.OnResize(e)
  1963.         Height = 21
  1964.         Invalidate()
  1965.     End Sub
  1966.  
  1967. #End Region
  1968.  
  1969. End Class
  1970.  
  1971. #End Region
  1972.  
  1973. #Region " ComboBox "
  1974.  
  1975. Public Class NordComboBox : Inherits ComboBox
  1976.  
  1977. #Region " Variables "
  1978.  
  1979.     Private _StartIndex As Integer = 0
  1980.     Private _BaseColor As Color = GetHTMLColor("bbd2d8")
  1981.     Private _LinesColor As Color = GetHTMLColor("75b81b")
  1982.     Private _TextColor As Color = Color.Gray
  1983.  
  1984. #End Region
  1985.  
  1986. #Region " Constructors "
  1987.  
  1988.     Sub New()
  1989.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint, True)
  1990.         BackColor = GetHTMLColor("291a2a")
  1991.         Font = New Font("Segoe UI", 12, FontStyle.Regular)
  1992.         DrawMode = Windows.Forms.DrawMode.OwnerDrawFixed
  1993.         DoubleBuffered = True
  1994.         StartIndex = 0
  1995.         DropDownHeight = 100
  1996.         DropDownStyle = ComboBoxStyle.DropDownList
  1997.         UpdateStyles()
  1998.     End Sub
  1999.  
  2000. #End Region
  2001.  
  2002. #Region " Properties "
  2003.  
  2004.     <Category("Behavior"),
  2005.     Description("When overridden in a derived class, gets or sets the zero-based index of the currently selected item.")>
  2006.     Private Property StartIndex As Integer
  2007.         Get
  2008.             Return _StartIndex
  2009.         End Get
  2010.         Set(ByVal value As Integer)
  2011.             _StartIndex = value
  2012.             Try
  2013.                 MyBase.SelectedIndex = value
  2014.             Catch
  2015.             End Try
  2016.             Invalidate()
  2017.         End Set
  2018.     End Property
  2019.  
  2020.     <Category(" Custom Properties "),
  2021.     Description("Gets or sets the background color for the control.")>
  2022.     Public Property BaseColor As Color
  2023.         Get
  2024.             Return _BaseColor
  2025.         End Get
  2026.         Set(value As Color)
  2027.             _BaseColor = value
  2028.             Invalidate()
  2029.         End Set
  2030.     End Property
  2031.  
  2032.     <Category(" Custom Properties "),
  2033.     Description("Gets or sets the lines color for the control.")>
  2034.     Public Property LinesColor As Color
  2035.         Get
  2036.             Return _LinesColor
  2037.         End Get
  2038.         Set(value As Color)
  2039.             _LinesColor = value
  2040.             Invalidate()
  2041.         End Set
  2042.     End Property
  2043.  
  2044.     <Category(" Custom Properties "),
  2045.     Description("Gets or sets the text color for the control.")>
  2046.     Public Property TextColor As Color
  2047.         Get
  2048.             Return _TextColor
  2049.         End Get
  2050.         Set(value As Color)
  2051.             _TextColor = value
  2052.             Invalidate()
  2053.         End Set
  2054.     End Property
  2055.  
  2056. #End Region
  2057.  
  2058. #Region " Draw Control "
  2059.  
  2060.     Protected Overrides Sub OnDrawItem(e As DrawItemEventArgs)
  2061.         Try
  2062.             Dim G As Graphics = e.Graphics
  2063.             e.DrawBackground()
  2064.             With G
  2065.                 .TextRenderingHint = Drawing.Text.TextRenderingHint.ClearTypeGridFit
  2066.                 .FillRectangle(New SolidBrush(BaseColor), e.Bounds)
  2067.  
  2068.                 If (e.State And DrawItemState.Selected) = DrawItemState.Selected Then
  2069.                     Cursor = Cursors.Hand
  2070.                     CentreString(G, Items(e.Index), Font, New SolidBrush(TextColor), New Rectangle(e.Bounds.X + 1, e.Bounds.Y + 3, e.Bounds.Width - 2, e.Bounds.Height - 2))
  2071.                 Else
  2072.                     CentreString(G, Items(e.Index), Font, Brushes.DimGray, New Rectangle(e.Bounds.X + 1, e.Bounds.Y + 2, e.Bounds.Width - 2, e.Bounds.Height - 2))
  2073.                 End If
  2074.             End With
  2075.         Catch
  2076.         End Try
  2077.         Invalidate()
  2078.     End Sub
  2079.  
  2080.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  2081.         Dim Rect As New Rectangle(0, 0, Width, Height - 1)
  2082.         With e.Graphics
  2083.             .TextRenderingHint = Drawing.Text.TextRenderingHint.ClearTypeGridFit
  2084.             .FillRectangle(New SolidBrush(BaseColor), Rect)
  2085.  
  2086.             .DrawLine(New Pen(LinesColor, 2), New Point(Width - 21, (Height / 2) - 3), New Point(Width - 7, (Height / 2) - 3))
  2087.             .DrawLine(New Pen(LinesColor, 2), New Point(Width - 21, (Height / 2) + 1), New Point(Width - 7, (Height / 2) + 1))
  2088.             .DrawLine(New Pen(LinesColor, 2), New Point(Width - 21, (Height / 2) + 5), New Point(Width - 7, (Height / 2) + 5))
  2089.  
  2090.             .DrawLine(New Pen(LinesColor, 1), New Point(0, Height - 1), New Point(Width, Height - 1))
  2091.             .DrawString(Text, Font, New SolidBrush(TextColor), New Rectangle(5, 1, Width - 1, Height - 1), New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Near})
  2092.         End With
  2093.     End Sub
  2094.  
  2095. #End Region
  2096.  
  2097. #Region " Events "
  2098.  
  2099.     Protected Overrides Sub OnResize(e As EventArgs)
  2100.         MyBase.OnResize(e)
  2101.         Invalidate()
  2102.     End Sub
  2103.  
  2104. #End Region
  2105.  
  2106. End Class
  2107.  
  2108. #End Region
  2109.  
  2110. #Region " Seperator "
  2111.  
  2112. Public Class NordSeperator : Inherits Control
  2113.  
  2114. #Region " Variables "
  2115.  
  2116.     Private _SepStyle As Style = Style.Horizental
  2117.     Private _SeperatorColor As Color = GetHTMLColor("eaeaeb")
  2118.  
  2119. #End Region
  2120.  
  2121. #Region " Enumerators "
  2122.  
  2123.     Enum Style
  2124.         Horizental
  2125.         Vertiacal
  2126.     End Enum
  2127.  
  2128. #End Region
  2129.  
  2130. #Region " Properties "
  2131.  
  2132.     <Category("Appearance"),
  2133.     Description("Gets or sets the style for the control.")>
  2134.     Public Property SepStyle As Style
  2135.         Get
  2136.             Return _SepStyle
  2137.         End Get
  2138.         Set(value As Style)
  2139.             _SepStyle = value
  2140.             Invalidate()
  2141.         End Set
  2142.     End Property
  2143.  
  2144.     <Category(" Custom Properties "),
  2145.     Description("Gets or sets the color for the control.")>
  2146.     Public Property SeperatorColor As Color
  2147.         Get
  2148.             Return _SeperatorColor
  2149.         End Get
  2150.         Set(value As Color)
  2151.             _SeperatorColor = value
  2152.             Invalidate()
  2153.         End Set
  2154.     End Property
  2155.  
  2156. #End Region
  2157.  
  2158. #Region " Constructors "
  2159.  
  2160.     Sub New()
  2161.         SetStyle(ControlStyles.SupportsTransparentBackColor Or ControlStyles.UserPaint, True)
  2162.         DoubleBuffered = True
  2163.         BackColor = Color.Transparent
  2164.         UpdateStyles()
  2165.     End Sub
  2166.  
  2167. #End Region
  2168.  
  2169. #Region " Draw Control "
  2170.  
  2171.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  2172.         Dim G As Graphics = e.Graphics
  2173.         With G
  2174.             Select Case SepStyle
  2175.                 Case Style.Horizental
  2176.                     .DrawLine(New Pen(SeperatorColor), 0, 1, Width, 1)
  2177.                 Case Style.Vertiacal
  2178.                     .DrawLine(New Pen(SeperatorColor), 1, 0, 1, Height)
  2179.             End Select
  2180.         End With
  2181.  
  2182.     End Sub
  2183.  
  2184. #End Region
  2185.  
  2186. #Region " Events "
  2187.  
  2188.     Protected Overrides Sub OnResize(e As EventArgs)
  2189.         MyBase.OnResize(e)
  2190.         If SepStyle = Style.Horizental Then
  2191.             Height = 4
  2192.         Else
  2193.             Width = 4
  2194.         End If
  2195.     End Sub
  2196.  
  2197. #End Region
  2198.  
  2199. End Class
  2200.  
  2201. #End Region
  2202.  
  2203. #Region " Label "
  2204.  
  2205. <DefaultEvent("TextChanged")> Public Class NordLabel : Inherits Control
  2206.  
  2207. #Region " Draw Cotnrol "
  2208.  
  2209.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  2210.         With e.Graphics
  2211.             .TextRenderingHint = Drawing.Text.TextRenderingHint.ClearTypeGridFit
  2212.             .DrawString(Text, Font, New SolidBrush(ForeColor), ClientRectangle)
  2213.         End With
  2214.     End Sub
  2215.  
  2216. #End Region
  2217.  
  2218. #Region " Constructors "
  2219.  
  2220.     Sub New()
  2221.         SetStyle(ControlStyles.SupportsTransparentBackColor Or ControlStyles.UserPaint Or ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer, True)
  2222.         DoubleBuffered = True
  2223.         BackColor = Color.Transparent
  2224.         Font = New Font("Segoe UI", 12, FontStyle.Regular)
  2225.         UpdateStyles()
  2226.     End Sub
  2227.  
  2228. #End Region
  2229.  
  2230. #Region " Events "
  2231.  
  2232.     Protected Overrides Sub OnResize(e As EventArgs)
  2233.         Height = Font.Height
  2234.     End Sub
  2235.  
  2236.     Protected Overrides Sub OnTextChanged(e As EventArgs)
  2237.         MyBase.OnTextChanged(e)
  2238.         Invalidate()
  2239.     End Sub
  2240.  
  2241. #End Region
  2242.  
  2243. End Class
  2244.  
  2245. #End Region
  2246.  
  2247. #Region " LinkLabel "
  2248.  
  2249. <DefaultEvent("TextChanged")> Public Class NordLinkLabel : Inherits Control
  2250.  
  2251. #Region " Variables "
  2252.  
  2253.     Private State As MouseMode = MouseMode.NormalMode
  2254.     Private _HoverColor As Color = Color.SteelBlue
  2255.     Private _PushedColor As Color = Color.DarkBlue
  2256.  
  2257. #End Region
  2258.  
  2259. #Region " Properties "
  2260.  
  2261.     <Category("Custom Properties "),
  2262.     Description("Gets or sets the tect color of the control in mouse hover state.")>
  2263.     Public Property HoverColor As Color
  2264.         Get
  2265.             Return _HoverColor
  2266.         End Get
  2267.         Set(value As Color)
  2268.             _HoverColor = value
  2269.             Invalidate()
  2270.         End Set
  2271.     End Property
  2272.  
  2273.     <Category("Custom Properties "),
  2274.     Description("Gets or sets the text color of the control in mouse down state.")>
  2275.     Public Property PushedColor As Color
  2276.         Get
  2277.             Return _PushedColor
  2278.         End Get
  2279.         Set(value As Color)
  2280.             _PushedColor = value
  2281.             Invalidate()
  2282.         End Set
  2283.     End Property
  2284.  
  2285. #End Region
  2286.  
  2287. #Region " Draw Control "
  2288.  
  2289.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  2290.         With e.Graphics
  2291.             .TextRenderingHint = Drawing.Text.TextRenderingHint.ClearTypeGridFit
  2292.             Select Case State
  2293.                 Case 0
  2294.                     .DrawString(Text, Font, New SolidBrush(ForeColor), ClientRectangle)
  2295.                 Case 1
  2296.                     Cursor = Cursors.Hand
  2297.                     .DrawString(Text, Font, New SolidBrush(HoverColor), ClientRectangle)
  2298.                 Case 2
  2299.                     .DrawString(Text, Font, New SolidBrush(PushedColor), ClientRectangle)
  2300.             End Select
  2301.  
  2302.         End With
  2303.     End Sub
  2304.  
  2305. #End Region
  2306.  
  2307. #Region " Constructors "
  2308.  
  2309.     Sub New()
  2310.         SetStyle(ControlStyles.SupportsTransparentBackColor Or ControlStyles.UserPaint Or ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer, True)
  2311.         DoubleBuffered = True
  2312.         BackColor = Color.Transparent
  2313.         ForeColor = Color.MediumBlue
  2314.         Font = New Font("Segoe UI", 12, FontStyle.Underline)
  2315.         UpdateStyles()
  2316.     End Sub
  2317.  
  2318. #End Region
  2319.  
  2320. #Region " Events "
  2321.  
  2322.     Protected Overrides Sub OnResize(e As EventArgs)
  2323.         Height = Font.Height + 2
  2324.     End Sub
  2325.     Protected Overrides Sub OnTextChanged(e As EventArgs)
  2326.         MyBase.OnTextChanged(e)
  2327.         Invalidate()
  2328.     End Sub
  2329.  
  2330.     Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  2331.         MyBase.OnMouseUp(e)
  2332.         State = MouseMode.Hovered : Invalidate()
  2333.     End Sub
  2334.  
  2335.     Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  2336.         MyBase.OnMouseUp(e)
  2337.         State = MouseMode.Pushed : Invalidate()
  2338.     End Sub
  2339.  
  2340.     Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
  2341.         MyBase.OnMouseEnter(e)
  2342.         State = MouseMode.Hovered : Invalidate()
  2343.     End Sub
  2344.  
  2345.     Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
  2346.         MyBase.OnMouseEnter(e)
  2347.         State = MouseMode.NormalMode : Invalidate()
  2348.     End Sub
  2349.  
  2350. #End Region
  2351.  
  2352. End Class
  2353.  
  2354. #End Region
Advertisement
Add Comment
Please, Sign In to add comment