Advertisement
IntSofDev

Advanced UI

Aug 30th, 2015
764
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 181.23 KB | None | 0 0
  1. Imports System.Drawing, System.Drawing.Drawing2D, System.Drawing.Text, System.Windows.Forms, System.ComponentModel
  2.  
  3. 'Name (Theme):              Advanced UI
  4. 'Inspired by:               Flat UI (by iSynthesis), LogIn (by Xertz), Driver Booster (by IObit)
  5. 'Creator:                   Intelligent Software Development (ISD)
  6. 'Version:                   1.0.0 (Release Version)
  7. 'Date Created:              05/07/2015
  8. 'Release Date:              08/30/2015
  9. 'Created with:              Visual Studio Community 2015 (.NET Framework 4.6)
  10. 'Support/Feedback:
  11. '   E-Mail;                 IntSofDev@outlook.com (Recommended for Support)
  12. '   Steam;                  http://steamcommunity.com/id/IntelligentSoftwareDevelopment
  13. '   High-Minded;            https://high-minded.net/members/isd.21157/
  14. '   CoderBay;               https://www.coderbay.net/index.php?/user/102-isd/
  15. '   MPGH;                   http://www.mpgh.net/forum/member.php?u=2616998
  16. '   Hack Forums;            http://www.hackforums.net/member.php?action=profile&uid=2807959
  17.  
  18. Module Support
  19.  
  20. #Region "Variables"
  21.  
  22.     Friend G As Graphics, B As Bitmap
  23.     Friend Near As New StringFormat() With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Near}
  24.     Friend Center As New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center}
  25.     Friend Far As New StringFormat() With {.Alignment = StringAlignment.Far, .LineAlignment = StringAlignment.Far}
  26.     Friend ColorBlendPositions() As Single = {0.0, 0.33, 0.66, 1.0}
  27.     'Colors
  28.     Friend Black As Color = Color.FromArgb(50, 50, 50)      'Black
  29.     Friend Gray As Color = Color.FromArgb(70, 70, 70)       'Gray
  30.     Friend White As Color = Color.FromArgb(255, 255, 255)   'White
  31.     Friend Orange As Color = Color.FromArgb(250, 190, 60)   'Orange
  32.     Friend Red As Color = Color.FromArgb(220, 85, 100)      'Red
  33.     Friend Green As Color = Color.FromArgb(35, 170, 110)    'Green
  34.     Friend Blue As Color = Color.FromArgb(0, 130, 255)      'Blue
  35.  
  36. #End Region
  37.  
  38. #Region "Functions"
  39.  
  40.     Public Function rRectangle(ByVal Rectangle As Rectangle, ByVal Curve As Integer) As GraphicsPath
  41.         Dim GP As New GraphicsPath()
  42.         Dim ArcRectangleWidth As Integer = Curve * 2
  43.         GP.AddArc(New Rectangle(Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -180, 90)
  44.         GP.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -90, 90)
  45.         GP.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 0, 90)
  46.         GP.AddArc(New Rectangle(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 90, 90)
  47.         GP.AddLine(New Point(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y), New Point(Rectangle.X, Curve + Rectangle.Y))
  48.         Return GP
  49.     End Function
  50.  
  51. #End Region
  52.  
  53. #Region "Mouse States"
  54.  
  55.     Enum MouseState As Byte
  56.         None = 0
  57.         Over = 1
  58.         Down = 2
  59.         Block = 3
  60.     End Enum
  61.  
  62. #End Region
  63.  
  64. End Module
  65.  
  66. Public Class FormUI : Inherits ContainerControl
  67.  
  68. #Region "Variables"
  69.  
  70.     Private x As Integer
  71.     Private State As MouseState = MouseState.None
  72.     Private MousePoint As New Point(0, 0)
  73.     Private MoveHeight As Integer = 50
  74.     Private Cap As Boolean = False
  75.  
  76. #End Region
  77.  
  78. #Region "Mouse States"
  79.  
  80.     Protected Overrides Sub OnMouseEnter(e As EventArgs)
  81.         MyBase.OnMouseEnter(e)
  82.         State = MouseState.Over : Invalidate()
  83.     End Sub
  84.  
  85.     Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
  86.         MyBase.OnMouseDown(e)
  87.         If e.Button = MouseButtons.Left And New Rectangle(0, 0, Width, MoveHeight).Contains(e.Location) Then
  88.             If Movable Then
  89.                 Cap = True
  90.                 MousePoint = e.Location
  91.             End If
  92.         End If
  93.     End Sub
  94.  
  95.     Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
  96.         MyBase.OnMouseUp(e) : Cap = False
  97.     End Sub
  98.  
  99.     Protected Overrides Sub OnMouseLeave(e As EventArgs)
  100.         MyBase.OnMouseLeave(e)
  101.         State = MouseState.None : Invalidate()
  102.     End Sub
  103.  
  104.     Protected Overrides Sub OnMouseMove(e As MouseEventArgs)
  105.         MyBase.OnMouseMove(e)
  106.         If Cap Then
  107.             Parent.Location = MousePosition - CType(MousePoint, Size)
  108.         End If
  109.         x = e.X : Invalidate()
  110.     End Sub
  111.  
  112. #End Region
  113.  
  114. #Region "Properties"
  115.  
  116.     <Flags()>
  117.     Enum HTP
  118.         Left
  119.         Center
  120.         Right
  121.     End Enum
  122.  
  123.     <Flags()>
  124.     Enum BTP
  125.         Left
  126.         Center
  127.         Right
  128.     End Enum
  129.  
  130.     <Flags()>
  131.     Enum LS
  132.         Normal
  133.         ColorBlend
  134.     End Enum
  135.  
  136.     Private _LineStyle As LS = LS.Normal
  137.     <Category("Properties")>
  138.     Public Property LineStyle As LS
  139.         Get
  140.             Return _LineStyle
  141.         End Get
  142.         Set(value As LS)
  143.             _LineStyle = value
  144.             Invalidate()
  145.         End Set
  146.     End Property
  147.  
  148.     Private _ShowIcon As Boolean = True
  149.     <Category("Properties")>
  150.     Public Property ShowIcon As Boolean
  151.         Get
  152.             Return _ShowIcon
  153.         End Get
  154.         Set(value As Boolean)
  155.             _ShowIcon = value
  156.             Invalidate()
  157.         End Set
  158.     End Property
  159.  
  160.     Private _HeaderTextPosition As HTP = HTP.Left
  161.     <Category("Properties")>
  162.     Public Property HeaderTextPosition As HTP
  163.         Get
  164.             Return _HeaderTextPosition
  165.         End Get
  166.         Set(value As HTP)
  167.             _HeaderTextPosition = value
  168.             Invalidate()
  169.         End Set
  170.     End Property
  171.  
  172.     Private _BottomTextPosition As BTP = BTP.Center
  173.     <Category("Properties")>
  174.     Public Property BottomTextPosition As BTP
  175.         Get
  176.             Return _BottomTextPosition
  177.         End Get
  178.         Set(value As BTP)
  179.             _BottomTextPosition = value
  180.             Invalidate()
  181.         End Set
  182.     End Property
  183.  
  184.     Private _ShowVersion As Boolean = False
  185.     <Category("Properties")>
  186.     Public Property ShowVersion As Boolean
  187.         Get
  188.             Return _ShowVersion
  189.         End Get
  190.         Set(value As Boolean)
  191.             _ShowVersion = value
  192.             Invalidate()
  193.         End Set
  194.     End Property
  195.  
  196.     Private _Version As String
  197.     <Category("Properties")>
  198.     Public Property Version As String
  199.         Get
  200.             Return _Version
  201.         End Get
  202.         Set(value As String)
  203.             _Version = value
  204.             Invalidate()
  205.         End Set
  206.     End Property
  207.  
  208.     Private _Border As Boolean = True
  209.     <Category("Properties")>
  210.     Public Property Border As Boolean
  211.         Get
  212.             Return _Border
  213.         End Get
  214.         Set(value As Boolean)
  215.             _Border = value
  216.             Invalidate()
  217.         End Set
  218.     End Property
  219.  
  220.     Private _BorderColorIntensity As Integer = 255
  221.     <Category("Properties")>
  222.     Public Property BorderColorIntensity As Integer
  223.         Get
  224.             Return _BorderColorIntensity
  225.         End Get
  226.         Set(value As Integer)
  227.             _BorderColorIntensity = value
  228.             Invalidate()
  229.         End Set
  230.     End Property
  231.  
  232.     Private _Header As Boolean = True
  233.     <Category("Properties")>
  234.     Public Property Header As Boolean
  235.         Get
  236.             Return _Header
  237.         End Get
  238.         Set(value As Boolean)
  239.             _Header = value
  240.             Invalidate()
  241.         End Set
  242.     End Property
  243.  
  244.     Private _ShinyHeader As Boolean = False
  245.     <Category("Properties")>
  246.     Public Property ShinyHeader As Boolean
  247.         Get
  248.             Return _ShinyHeader
  249.         End Get
  250.         Set(value As Boolean)
  251.             _ShinyHeader = value
  252.             Invalidate()
  253.         End Set
  254.     End Property
  255.  
  256.     Private _ShinyIntensity As Integer = 15
  257.     <Category("Properties")>
  258.     Public Property ShinyIntensity As Integer
  259.         Get
  260.             Return _ShinyIntensity
  261.         End Get
  262.         Set(value As Integer)
  263.             _ShinyIntensity = value
  264.             Invalidate()
  265.         End Set
  266.     End Property
  267.  
  268.     Private _TopLine As Boolean = False
  269.     <Category("Properties")>
  270.     Public Property TopLine As Boolean
  271.         Get
  272.             Return _TopLine
  273.         End Get
  274.         Set(value As Boolean)
  275.             _TopLine = value
  276.             Invalidate()
  277.         End Set
  278.     End Property
  279.  
  280.     Private _BottomBar As Boolean = True
  281.     <Category("Properties")>
  282.     Public Property BottomBar As Boolean
  283.         Get
  284.             Return _BottomBar
  285.         End Get
  286.         Set(value As Boolean)
  287.             _BottomBar = value
  288.             Invalidate()
  289.         End Set
  290.     End Property
  291.  
  292.     Private _BottomText As String
  293.     <Category("Properties")>
  294.     Public Property BottomText As String
  295.         Get
  296.             Return _BottomText
  297.         End Get
  298.         Set(value As String)
  299.             _BottomText = value
  300.             Invalidate()
  301.         End Set
  302.     End Property
  303.  
  304.     Private _BottomLine As Boolean = False
  305.     <Category("Properties")>
  306.     Public Property BottomLine As Boolean
  307.         Get
  308.             Return _BottomLine
  309.         End Get
  310.         Set(value As Boolean)
  311.             _BottomLine = value
  312.             Invalidate()
  313.         End Set
  314.     End Property
  315.  
  316.     Private _Movable As Boolean = True
  317.     <Category("Properties")>
  318.     Public Property Movable As Boolean
  319.         Get
  320.             Return _Movable
  321.         End Get
  322.         Set(value As Boolean)
  323.             _Movable = value
  324.         End Set
  325.     End Property
  326.  
  327.     Protected Overrides Sub OnTextChanged(e As EventArgs)
  328.         MyBase.OnTextChanged(e) : Invalidate()
  329.     End Sub
  330.  
  331.     Protected Overrides Sub OnCreateControl()
  332.         MyBase.OnCreateControl()
  333.         ParentForm.FormBorderStyle = FormBorderStyle.None
  334.         ParentForm.AllowTransparency = True
  335.         ParentForm.TransparencyKey = Color.Fuchsia
  336.         ParentForm.FindForm.StartPosition = FormStartPosition.CenterScreen
  337.         Dock = DockStyle.Fill
  338.         Invalidate()
  339.     End Sub
  340.  
  341. #End Region
  342.  
  343. #Region "Color Properties"
  344.  
  345.     <Category("Color Properties")>
  346.     Public Property BaseColor As Color
  347.         Get
  348.             Return _BaseColor
  349.         End Get
  350.         Set(value As Color)
  351.             _BaseColor = value
  352.             Invalidate()
  353.         End Set
  354.     End Property
  355.  
  356.     <Category("Color Properties")>
  357.     Public Property HeaderColor As Color
  358.         Get
  359.             Return _HeaderColor
  360.         End Get
  361.         Set(value As Color)
  362.             _HeaderColor = value
  363.             Invalidate()
  364.         End Set
  365.     End Property
  366.  
  367.     <Category("Color Properties")>
  368.     Public Property BottomBarColor As Color
  369.         Get
  370.             Return _BottomBarColor
  371.         End Get
  372.         Set(value As Color)
  373.             _BottomBarColor = value
  374.             Invalidate()
  375.         End Set
  376.     End Property
  377.  
  378.     <Category("Color Properties")>
  379.     Public Property BorderColor As Color
  380.         Get
  381.             Return _BorderColor
  382.         End Get
  383.         Set(value As Color)
  384.             _BorderColor = value
  385.             Invalidate()
  386.         End Set
  387.     End Property
  388.  
  389.     <Category("Color Properties")>
  390.     Public Property ShinyColor As Color
  391.         Get
  392.             Return _ShinyColor
  393.         End Get
  394.         Set(value As Color)
  395.             _ShinyColor = value
  396.             Invalidate()
  397.         End Set
  398.     End Property
  399.  
  400.     <Category("Color Properties")>
  401.     Public Property LineColor As Color
  402.         Get
  403.             Return _LineColor
  404.         End Get
  405.         Set(value As Color)
  406.             _LineColor = value
  407.             Invalidate()
  408.         End Set
  409.     End Property
  410.  
  411.     <Category("Color Properties")>
  412.     Public Property ColorBlend1 As Color
  413.         Get
  414.             Return _ColorBlend1
  415.         End Get
  416.         Set(value As Color)
  417.             _ColorBlend1 = value
  418.             Invalidate()
  419.         End Set
  420.     End Property
  421.  
  422.     <Category("Color Properties")>
  423.     Public Property ColorBlend2 As Color
  424.         Get
  425.             Return _ColorBlend2
  426.         End Get
  427.         Set(value As Color)
  428.             _ColorBlend2 = value
  429.             Invalidate()
  430.         End Set
  431.     End Property
  432.  
  433.     <Category("Color Properties")>
  434.     Public Property ColorBlend3 As Color
  435.         Get
  436.             Return _ColorBlend3
  437.         End Get
  438.         Set(value As Color)
  439.             _ColorBlend3 = value
  440.             Invalidate()
  441.         End Set
  442.     End Property
  443.  
  444.     <Category("Color Properties")>
  445.     Public Property ColorBlend4 As Color
  446.         Get
  447.             Return _ColorBlend4
  448.         End Get
  449.         Set(value As Color)
  450.             _ColorBlend4 = value
  451.             Invalidate()
  452.         End Set
  453.     End Property
  454.  
  455.     <Category("Color Properties")>
  456.     Public Property TextColor As Color
  457.         Get
  458.             Return _TextColor
  459.         End Get
  460.         Set(value As Color)
  461.             _TextColor = value
  462.             Invalidate()
  463.         End Set
  464.     End Property
  465.  
  466. #End Region
  467.  
  468. #Region "Colors"
  469.  
  470.     Private _BaseColor As Color = Gray
  471.     Private _HeaderColor As Color = Black
  472.     Private _BottomBarColor As Color = Black
  473.     Private _BorderColor As Color = White
  474.     Private _ShinyColor As Color = White
  475.     Private _LineColor As Color = White
  476.     Private _ColorBlend1 As Color = Orange
  477.     Private _ColorBlend2 As Color = Red
  478.     Private _ColorBlend3 As Color = Green
  479.     Private _ColorBlend4 As Color = Blue
  480.     Private _TextColor As Color = White
  481.  
  482. #End Region
  483.  
  484.     Sub New()
  485.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or
  486.                  ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer, True)
  487.         DoubleBuffered = True
  488.         BackColor = Gray
  489.         Font = New Font("Segoe UI", 12)
  490.     End Sub
  491.  
  492.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  493.         B = New Bitmap(Width, Height) : G = Graphics.FromImage(B)
  494.         Dim GP As New GraphicsPath
  495.         Dim Base As New Rectangle(0, 0, Width, Height)
  496.         Dim LineColorBlend As New ColorBlend(4), LineBrush As New LinearGradientBrush(Base, Color.Black, Color.Black, 0.0F)
  497.         With G
  498.             .SmoothingMode = SmoothingMode.HighQuality
  499.             .PixelOffsetMode = PixelOffsetMode.HighQuality
  500.             .TextRenderingHint = TextRenderingHint.ClearTypeGridFit
  501.             .Clear(BackColor)
  502.             'Base
  503.             .FillRectangle(New SolidBrush(BaseColor), Base)
  504.             'Header
  505.             If Header Then
  506.                 .FillRectangle(New SolidBrush(HeaderColor), New Rectangle(0, 0, Width, 50))
  507.                 'ShinyHeader
  508.                 If ShinyHeader Then
  509.                     .FillRectangle(New SolidBrush(Color.FromArgb(ShinyIntensity, ShinyColor)), New Rectangle(0, 0, Width, CInt(50 / 2)))
  510.                 End If
  511.             End If
  512.             'BottomBar
  513.             If BottomBar Then
  514.                 .FillRectangle(New SolidBrush(BottomBarColor), New Rectangle(0, Height - 50, Width, 50))
  515.             End If
  516.             If Header Then
  517.                 'Text & Icon
  518.                 Select Case HeaderTextPosition
  519.                     Case HTP.Left
  520.                         If ShowVersion Then
  521.                             If ShowIcon Then
  522.                                 .DrawIcon(FindForm.Icon, New Rectangle(14, 15, 22, 22))
  523.                                 .DrawString(Text, Font, New SolidBrush(TextColor), New Rectangle(48, 6, Width, Height), Near)
  524.                                 .DrawString(Version, New Font("Segoe UI", 10), New SolidBrush(TextColor), New Rectangle(48, 26, Width, Height), Near)
  525.                             Else
  526.                                 .DrawString(Text, Font, New SolidBrush(TextColor), New Rectangle(14, 6, Width, Height), Near)
  527.                                 .DrawString(Version, New Font("Segoe UI", 10), New SolidBrush(TextColor), New Rectangle(14, 26, Width, Height), Near)
  528.                             End If
  529.                         Else
  530.                             If ShowIcon Then
  531.                                 .DrawIcon(FindForm.Icon, New Rectangle(14, 15, 22, 22))
  532.                                 .DrawString(Text, Font, New SolidBrush(TextColor), New Rectangle(48, 14, Width, Height), Near)
  533.                             Else
  534.                                 .DrawString(Text, Font, New SolidBrush(TextColor), New Rectangle(14, 14, Width, Height), Near)
  535.                             End If
  536.                         End If
  537.                     Case HTP.Center
  538.                         If ShowVersion Then
  539.                             If ShowIcon Then
  540.                                 .DrawIcon(FindForm.Icon, New Rectangle(14, 15, 22, 22))
  541.                                 .DrawString(Text, Font, New SolidBrush(TextColor), New Rectangle(25, -8, Width, 53), Center)
  542.                                 .DrawString(Version, New Font("Segoe UI", 10), New SolidBrush(TextColor), New Rectangle(25, 10, Width, 53), Center)
  543.                             Else
  544.                                 .DrawString(Text, Font, New SolidBrush(TextColor), New Rectangle(25, -8, Width, 53), Center)
  545.                                 .DrawString(Version, New Font("Segoe UI", 10), New SolidBrush(TextColor), New Rectangle(25, 10, Width, 53), Center)
  546.                             End If
  547.                         Else
  548.                             If ShowIcon Then
  549.                                 .DrawIcon(FindForm.Icon, New Rectangle(14, 15, 22, 22))
  550.                                 .DrawString(Text, Font, New SolidBrush(TextColor), New Rectangle(25, 0, Width, 53), Center)
  551.                             Else
  552.                                 .DrawString(Text, Font, New SolidBrush(TextColor), New Rectangle(0, 0, Width, 53), Center)
  553.                             End If
  554.                         End If
  555.                     Case HTP.Right
  556.                         If ShowVersion Then
  557.                             If ShowIcon Then
  558.                                 .DrawIcon(FindForm.Icon, New Rectangle(14, 15, 22, 22))
  559.                                 .DrawString(Text, Font, New SolidBrush(TextColor), New Rectangle(-13, -8, Width, 38), Far)
  560.                                 .DrawString(Version, New Font("Segoe UI", 10), New SolidBrush(TextColor), New Rectangle(-13, 8, Width, 38), Far)
  561.                             Else
  562.                                 .DrawString(Text, Font, New SolidBrush(TextColor), New Rectangle(-13, -8, Width, 38), Far)
  563.                                 .DrawString(Version, New Font("Segoe UI", 10), New SolidBrush(TextColor), New Rectangle(-13, 8, Width, 38), Far)
  564.                             End If
  565.                         Else
  566.                             If ShowIcon Then
  567.                                 .DrawIcon(FindForm.Icon, New Rectangle(14, 15, 22, 22))
  568.                                 .DrawString(Text, Font, New SolidBrush(TextColor), New Rectangle(-13, 0, Width, 38), Far)
  569.                             Else
  570.                                 .DrawString(Text, Font, New SolidBrush(TextColor), New Rectangle(-13, 0, Width, 38), Far)
  571.                             End If
  572.                         End If
  573.                 End Select
  574.                 'Bottom Text
  575.                 Select Case BottomTextPosition
  576.                     Case BTP.Left
  577.                         .DrawString(BottomText, Font, New SolidBrush(TextColor), New Rectangle(6, 0, Width, Height + Height - 50), New StringFormat() With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Center})
  578.                     Case BTP.Center
  579.                         .DrawString(BottomText, Font, New SolidBrush(TextColor), New Rectangle(0, 0, Width, Height + Height - 50), Center)
  580.                     Case BTP.Right
  581.                         .DrawString(BottomText, Font, New SolidBrush(TextColor), New Rectangle(0, 0, Width - 6, Height + Height - 50), New StringFormat() With {.Alignment = StringAlignment.Far, .LineAlignment = StringAlignment.Center})
  582.                 End Select
  583.             End If
  584.             'Border
  585.             If Border Then
  586.                 .DrawRectangle(New Pen(Color.FromArgb(BorderColorIntensity, BorderColor)), Base)
  587.             End If
  588.             Dim Colors() As Color = {ColorBlend1, ColorBlend2, ColorBlend3, ColorBlend4}
  589.             LineColorBlend.Colors = Colors
  590.             LineColorBlend.Positions = ColorBlendPositions
  591.             LineBrush.InterpolationColors = LineColorBlend
  592.             If Header Then
  593.                 'TopLine
  594.                 If TopLine Then
  595.                     Select Case LineStyle
  596.                         Case LS.Normal
  597.                             If Border Then
  598.                                 .DrawLine(New Pen(LineColor), 1, 50, Width - 1, 50)
  599.                             Else
  600.                                 .DrawLine(New Pen(LineColor), 0, 50, Width, 50)
  601.                             End If
  602.                         Case LS.ColorBlend
  603.                             .DrawLine(New Pen(LineBrush), 0, 50, Width, 50)
  604.                     End Select
  605.                 End If
  606.             End If
  607.             If BottomBar Then
  608.                 'BottomLine
  609.                 If BottomLine Then
  610.                     Select Case LineStyle
  611.                         Case LS.Normal
  612.                             If Border Then
  613.                                 .DrawLine(New Pen(LineColor), 1, Height - 50, Width - 1, Height - 50)
  614.                             Else
  615.                                 .DrawLine(New Pen(LineColor), 0, Height - 50, Width, Height - 50)
  616.                             End If
  617.                         Case LS.ColorBlend
  618.                             .DrawLine(New Pen(LineBrush), 0, Height - 50, Width, Height - 50)
  619.                     End Select
  620.                 End If
  621.             End If
  622.         End With
  623.         MyBase.OnPaint(e)
  624.         G.Dispose()
  625.         e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic
  626.         e.Graphics.DrawImageUnscaled(B, 0, 0)
  627.         B.Dispose()
  628.     End Sub
  629.  
  630. End Class
  631.  
  632. Public Class CloseButton : Inherits Control
  633.  
  634. #Region "Variables"
  635.  
  636.     Private x As Integer
  637.     Private State As MouseState = MouseState.None
  638.  
  639. #End Region
  640.  
  641. #Region "Mouse States"
  642.  
  643.     Protected Overrides Sub OnMouseEnter(e As EventArgs)
  644.         MyBase.OnMouseEnter(e)
  645.         State = MouseState.Over : Invalidate()
  646.     End Sub
  647.  
  648.     Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
  649.         MyBase.OnMouseDown(e)
  650.         State = MouseState.Down : Invalidate()
  651.     End Sub
  652.  
  653.     Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
  654.         MyBase.OnMouseUp(e)
  655.         State = MouseState.Over : Invalidate()
  656.     End Sub
  657.  
  658.     Protected Overrides Sub OnMouseLeave(e As EventArgs)
  659.         MyBase.OnMouseLeave(e)
  660.         State = MouseState.None : Invalidate()
  661.     End Sub
  662.  
  663.     Protected Overrides Sub OnMouseMove(e As MouseEventArgs)
  664.         MyBase.OnMouseMove(e)
  665.         x = e.X : Invalidate()
  666.     End Sub
  667.  
  668.     Protected Overrides Sub OnClick(e As EventArgs)
  669.         MyBase.OnClick(e)
  670.         If CloseChoice = CC.Form Then
  671.             Parent.FindForm.Close()
  672.         Else
  673.             Environment.Exit(0)
  674.         End If
  675.     End Sub
  676.  
  677. #End Region
  678.  
  679. #Region "Properties"
  680.  
  681.     Enum CC
  682.         Form
  683.         Application
  684.     End Enum
  685.  
  686.     Private _CloseChoice As CC = CC.Form
  687.     <Category("Properties")>
  688.     Public Property CloseChoice As CC
  689.         Get
  690.             Return _CloseChoice
  691.         End Get
  692.         Set(value As CC)
  693.             _CloseChoice = value
  694.         End Set
  695.     End Property
  696.  
  697.     Protected Overrides Sub OnResize(e As EventArgs)
  698.         MyBase.OnResize(e)
  699.         Size = New Size(18, 18)
  700.     End Sub
  701.  
  702. #End Region
  703.  
  704. #Region "Color Properties"
  705.  
  706.     <Category("Color Properties")>
  707.     Public Property BaseColor As Color
  708.         Get
  709.             Return _BaseColor
  710.         End Get
  711.         Set(value As Color)
  712.             _BaseColor = value
  713.             Invalidate()
  714.         End Set
  715.     End Property
  716.  
  717.     <Category("Color Properties")>
  718.     Public Property TextColor As Color
  719.         Get
  720.             Return _TextColor
  721.         End Get
  722.         Set(value As Color)
  723.             _TextColor = value
  724.             Invalidate()
  725.         End Set
  726.     End Property
  727.  
  728.     <Category("Color Properties")>
  729.     Public Property HoverColor As Color
  730.         Get
  731.             Return _HoverColor
  732.         End Get
  733.         Set(value As Color)
  734.             _HoverColor = value
  735.             Invalidate()
  736.         End Set
  737.     End Property
  738.  
  739. #End Region
  740.  
  741. #Region "Colors"
  742.  
  743.     Private _BaseColor As Color = Color.Transparent
  744.     Private _TextColor As Color = White
  745.     Private _HoverColor As Color = Red
  746.  
  747. #End Region
  748.  
  749.     Sub New()
  750.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or
  751.                  ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer Or
  752.                  ControlStyles.SupportsTransparentBackColor, True)
  753.         DoubleBuffered = True
  754.         BackColor = Color.Transparent
  755.         Size = New Size(18, 18)
  756.         Margin = New Padding(3, 7, 3, 3)
  757.         Font = New Font("Marlett", 12)
  758.         Cursor = Cursors.Hand
  759.     End Sub
  760.  
  761.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  762.         Dim B As New Bitmap(Width, Height) : G = Graphics.FromImage(B)
  763.         Dim Base As New Rectangle(0, 0, Width, Height)
  764.         With G
  765.             .SmoothingMode = SmoothingMode.HighQuality
  766.             .PixelOffsetMode = PixelOffsetMode.HighQuality
  767.             .TextRenderingHint = TextRenderingHint.ClearTypeGridFit
  768.             .Clear(BackColor)
  769.             'Base
  770.             .FillRectangle(New SolidBrush(BaseColor), Base)
  771.             'Text
  772.             .DrawString("r", Font, New SolidBrush(TextColor), New Rectangle(1, 1, Width, 19), Center)
  773.             'Hover
  774.             Select Case State
  775.                 Case MouseState.Over
  776.                     .DrawString("r", Font, New SolidBrush(HoverColor), New Rectangle(1, 1, Width, 19), Center)
  777.                 Case MouseState.Down
  778.                     .DrawString("r", Font, New SolidBrush(HoverColor), New Rectangle(1, 1, Width, 19), Center)
  779.             End Select
  780.         End With
  781.         MyBase.OnPaint(e)
  782.         G.Dispose()
  783.         e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic
  784.         e.Graphics.DrawImageUnscaled(B, 0, 0)
  785.         B.Dispose()
  786.     End Sub
  787.  
  788. End Class
  789.  
  790. Public Class MaximizeButton : Inherits Control
  791.  
  792. #Region "Variables"
  793.  
  794.     Private x As Integer
  795.     Private State As MouseState = MouseState.None
  796.  
  797. #End Region
  798.  
  799. #Region "Mouse States"
  800.  
  801.     Protected Overrides Sub OnMouseEnter(e As EventArgs)
  802.         MyBase.OnMouseEnter(e)
  803.         State = MouseState.Over : Invalidate()
  804.     End Sub
  805.  
  806.     Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
  807.         MyBase.OnMouseDown(e)
  808.         State = MouseState.Down : Invalidate()
  809.     End Sub
  810.  
  811.     Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
  812.         MyBase.OnMouseUp(e)
  813.         State = MouseState.Over : Invalidate()
  814.     End Sub
  815.  
  816.     Protected Overrides Sub OnMouseLeave(e As EventArgs)
  817.         MyBase.OnMouseLeave(e)
  818.         State = MouseState.None : Invalidate()
  819.     End Sub
  820.  
  821.     Protected Overrides Sub OnMouseMove(e As MouseEventArgs)
  822.         MyBase.OnMouseMove(e)
  823.         x = e.X : Invalidate()
  824.     End Sub
  825.  
  826.     Protected Overrides Sub OnClick(e As EventArgs)
  827.         MyBase.OnClick(e)
  828.         Select Case FindForm.WindowState
  829.             Case FormWindowState.Maximized
  830.                 FindForm.WindowState = FormWindowState.Normal
  831.             Case FormWindowState.Normal
  832.                 FindForm.WindowState = FormWindowState.Maximized
  833.         End Select
  834.     End Sub
  835.  
  836. #End Region
  837.  
  838. #Region "Properties"
  839.  
  840.     Protected Overrides Sub OnResize(e As EventArgs)
  841.         MyBase.OnResize(e)
  842.         Size = New Size(18, 18)
  843.     End Sub
  844.  
  845. #End Region
  846.  
  847. #Region "Color Properties"
  848.  
  849.     <Category("Color Properties")>
  850.     Public Property BaseColor As Color
  851.         Get
  852.             Return _BaseColor
  853.         End Get
  854.         Set(value As Color)
  855.             _BaseColor = value
  856.             Invalidate()
  857.         End Set
  858.     End Property
  859.  
  860.     <Category("Color Properties")>
  861.     Public Property TextColor As Color
  862.         Get
  863.             Return _TextColor
  864.         End Get
  865.         Set(value As Color)
  866.             _TextColor = value
  867.             Invalidate()
  868.         End Set
  869.     End Property
  870.  
  871.     <Category("Color Properties")>
  872.     Public Property HoverColor As Color
  873.         Get
  874.             Return _HoverColor
  875.         End Get
  876.         Set(value As Color)
  877.             _HoverColor = value
  878.             Invalidate()
  879.         End Set
  880.     End Property
  881.  
  882. #End Region
  883.  
  884. #Region "Colors"
  885.  
  886.     Private _BaseColor As Color = Color.Transparent
  887.     Private _TextColor As Color = White
  888.     Private _HoverColor As Color = Green
  889.  
  890. #End Region
  891.  
  892.     Sub New()
  893.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or
  894.                  ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer Or
  895.                  ControlStyles.SupportsTransparentBackColor, True)
  896.         DoubleBuffered = True
  897.         BackColor = Color.Transparent
  898.         Size = New Size(18, 18)
  899.         Margin = New Padding(3, 7, 3, 3)
  900.         Font = New Font("Marlett", 12)
  901.         Cursor = Cursors.Hand
  902.     End Sub
  903.  
  904.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  905.         Dim B As New Bitmap(Width, Height) : G = Graphics.FromImage(B)
  906.         Dim Base As New Rectangle(0, 0, Width, Height)
  907.         With G
  908.             .SmoothingMode = SmoothingMode.HighQuality
  909.             .PixelOffsetMode = PixelOffsetMode.HighQuality
  910.             .TextRenderingHint = TextRenderingHint.ClearTypeGridFit
  911.             .Clear(BackColor)
  912.             'Base
  913.             .FillRectangle(New SolidBrush(BaseColor), Base)
  914.             'Text
  915.             If FindForm.WindowState = FormWindowState.Maximized Then
  916.                 .DrawString("2", Font, New SolidBrush(TextColor), New Rectangle(1, 1, Width, Height), Center)
  917.             ElseIf FindForm.WindowState = FormWindowState.Normal Then
  918.                 .DrawString("1", Font, New SolidBrush(TextColor), New Rectangle(1, 1, Width, Height), Center)
  919.             End If
  920.             'Hover
  921.             Select Case State
  922.                 Case MouseState.Over
  923.                     If FindForm.WindowState = FormWindowState.Maximized Then
  924.                         .DrawString("2", Font, New SolidBrush(HoverColor), New Rectangle(1, 1, Width, Height), Center)
  925.                     ElseIf FindForm.WindowState = FormWindowState.Normal Then
  926.                         .DrawString("1", Font, New SolidBrush(HoverColor), New Rectangle(1, 1, Width, Height), Center)
  927.                     End If
  928.                 Case MouseState.Down
  929.                     If FindForm.WindowState = FormWindowState.Maximized Then
  930.                         .DrawString("2", Font, New SolidBrush(HoverColor), New Rectangle(1, 1, Width, Height), Center)
  931.                     ElseIf FindForm.WindowState = FormWindowState.Normal Then
  932.                         .DrawString("1", Font, New SolidBrush(HoverColor), New Rectangle(1, 1, Width, Height), Center)
  933.                     End If
  934.             End Select
  935.         End With
  936.         MyBase.OnPaint(e)
  937.         G.Dispose()
  938.         e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic
  939.         e.Graphics.DrawImageUnscaled(B, 0, 0)
  940.         B.Dispose()
  941.     End Sub
  942.  
  943. End Class
  944.  
  945. Public Class MinimizeButton : Inherits Control
  946.  
  947. #Region "Variables"
  948.  
  949.     Private x As Integer
  950.     Private State As MouseState = MouseState.None
  951.  
  952. #End Region
  953.  
  954. #Region "Mouse States"
  955.  
  956.     Protected Overrides Sub OnMouseEnter(e As EventArgs)
  957.         MyBase.OnMouseEnter(e)
  958.         State = MouseState.Over : Invalidate()
  959.     End Sub
  960.  
  961.     Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
  962.         MyBase.OnMouseDown(e)
  963.         State = MouseState.Down : Invalidate()
  964.     End Sub
  965.  
  966.     Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
  967.         MyBase.OnMouseUp(e)
  968.         State = MouseState.Over : Invalidate()
  969.     End Sub
  970.  
  971.     Protected Overrides Sub OnMouseLeave(e As EventArgs)
  972.         MyBase.OnMouseLeave(e)
  973.         State = MouseState.None : Invalidate()
  974.     End Sub
  975.  
  976.     Protected Overrides Sub OnMouseMove(e As MouseEventArgs)
  977.         MyBase.OnMouseMove(e)
  978.         x = e.X : Invalidate()
  979.     End Sub
  980.  
  981.     Protected Overrides Sub OnClick(e As EventArgs)
  982.         MyBase.OnClick(e)
  983.         Select Case FindForm.WindowState
  984.             Case FormWindowState.Normal
  985.                 FindForm.WindowState = FormWindowState.Minimized
  986.         End Select
  987.     End Sub
  988.  
  989. #End Region
  990.  
  991. #Region "Properties"
  992.  
  993.     Protected Overrides Sub OnResize(e As EventArgs)
  994.         MyBase.OnResize(e)
  995.         Size = New Size(18, 18)
  996.     End Sub
  997.  
  998. #End Region
  999.  
  1000. #Region "Color Properties"
  1001.  
  1002.     <Category("Color Properties")>
  1003.     Public Property BaseColor As Color
  1004.         Get
  1005.             Return _BaseColor
  1006.         End Get
  1007.         Set(value As Color)
  1008.             _BaseColor = value
  1009.             Invalidate()
  1010.         End Set
  1011.     End Property
  1012.  
  1013.     <Category("Color Properties")>
  1014.     Public Property TextColor As Color
  1015.         Get
  1016.             Return _TextColor
  1017.         End Get
  1018.         Set(value As Color)
  1019.             _TextColor = value
  1020.             Invalidate()
  1021.         End Set
  1022.     End Property
  1023.  
  1024.     <Category("Color Properties")>
  1025.     Public Property HoverColor As Color
  1026.         Get
  1027.             Return _HoverColor
  1028.         End Get
  1029.         Set(value As Color)
  1030.             _HoverColor = value
  1031.             Invalidate()
  1032.         End Set
  1033.     End Property
  1034.  
  1035. #End Region
  1036.  
  1037. #Region "Colors"
  1038.  
  1039.     Private _BaseColor As Color = Color.Transparent
  1040.     Private _TextColor As Color = White
  1041.     Private _HoverColor As Color = Green
  1042.  
  1043. #End Region
  1044.  
  1045.     Sub New()
  1046.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or
  1047.                  ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer Or
  1048.                  ControlStyles.SupportsTransparentBackColor, True)
  1049.         DoubleBuffered = True
  1050.         BackColor = Color.Transparent
  1051.         Size = New Size(18, 18)
  1052.         Margin = New Padding(3, 7, 3, 3)
  1053.         Font = New Font("Marlett", 12)
  1054.         Cursor = Cursors.Hand
  1055.     End Sub
  1056.  
  1057.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  1058.         Dim B As New Bitmap(Width, Height) : G = Graphics.FromImage(B)
  1059.         Dim Base As New Rectangle(0, 0, Width, Height)
  1060.         With G
  1061.             .SmoothingMode = SmoothingMode.HighQuality
  1062.             .PixelOffsetMode = PixelOffsetMode.HighQuality
  1063.             .TextRenderingHint = TextRenderingHint.ClearTypeGridFit
  1064.             .Clear(BackColor)
  1065.             'Base
  1066.             .FillRectangle(New SolidBrush(BaseColor), Base)
  1067.             'Text
  1068.             .DrawString("0", Font, New SolidBrush(TextColor), New Rectangle(2, 1, Width, Height), Center)
  1069.             'Hover
  1070.             Select Case State
  1071.                 Case MouseState.Over
  1072.                     .DrawString("0", Font, New SolidBrush(HoverColor), New Rectangle(2, 1, Width, Height), Center)
  1073.                 Case MouseState.Down
  1074.                     .DrawString("0", Font, New SolidBrush(HoverColor), New Rectangle(2, 1, Width, Height), Center)
  1075.             End Select
  1076.         End With
  1077.         MyBase.OnPaint(e)
  1078.         G.Dispose()
  1079.         e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic
  1080.         e.Graphics.DrawImageUnscaled(B, 0, 0)
  1081.         B.Dispose()
  1082.     End Sub
  1083.  
  1084. End Class
  1085.  
  1086. Public Class Button : Inherits Control
  1087.  
  1088. #Region "Variables"
  1089.  
  1090.     Private State As MouseState = MouseState.None
  1091.  
  1092. #End Region
  1093.  
  1094. #Region "Mouse States"
  1095.  
  1096.     Protected Overrides Sub OnMouseEnter(e As EventArgs)
  1097.         MyBase.OnMouseEnter(e)
  1098.         State = MouseState.Over : Invalidate()
  1099.     End Sub
  1100.  
  1101.     Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
  1102.         MyBase.OnMouseDown(e)
  1103.         State = MouseState.Down : Invalidate()
  1104.     End Sub
  1105.  
  1106.     Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
  1107.         MyBase.OnMouseUp(e)
  1108.         State = MouseState.Over : Invalidate()
  1109.     End Sub
  1110.  
  1111.     Protected Overrides Sub OnMouseLeave(e As EventArgs)
  1112.         MyBase.OnMouseLeave(e)
  1113.         State = MouseState.None : Invalidate()
  1114.     End Sub
  1115.  
  1116. #End Region
  1117.  
  1118. #Region "Properties"
  1119.  
  1120.     <Flags()>
  1121.     Enum BS
  1122.         Normal
  1123.         ColorBlend
  1124.     End Enum
  1125.  
  1126.     Private _BorderStyle As BS = BS.Normal
  1127.     <Category("Properties")>
  1128.     Public Property BorderStyle As BS
  1129.         Get
  1130.             Return _BorderStyle
  1131.         End Get
  1132.         Set(value As BS)
  1133.             _BorderStyle = value
  1134.             Invalidate()
  1135.         End Set
  1136.     End Property
  1137.  
  1138.     Private _Rounded As Boolean = False
  1139.     <Category("Properties")>
  1140.     Public Property Rounded As Boolean
  1141.         Get
  1142.             Return _Rounded
  1143.         End Get
  1144.         Set(value As Boolean)
  1145.             _Rounded = value
  1146.             Invalidate()
  1147.         End Set
  1148.     End Property
  1149.  
  1150.     Private _Rounding As Integer = 8
  1151.     <Category("Properties")>
  1152.     Public Property Rounding As Integer
  1153.         Get
  1154.             Return _Rounding
  1155.         End Get
  1156.         Set(value As Integer)
  1157.             _Rounding = value
  1158.             Invalidate()
  1159.         End Set
  1160.     End Property
  1161.  
  1162.     Private _HoverColorIntensity As Integer = 15
  1163.     <Category("Properties")>
  1164.     Public Property HoverColorIntensity As Integer
  1165.         Get
  1166.             Return _HoverColorIntensity
  1167.         End Get
  1168.         Set(value As Integer)
  1169.             _HoverColorIntensity = value
  1170.         End Set
  1171.     End Property
  1172.  
  1173.     Private _DownColorIntensity As Integer = 30
  1174.     <Category("Properties")>
  1175.     Public Property DownColorIntensity As Integer
  1176.         Get
  1177.             Return _DownColorIntensity
  1178.         End Get
  1179.         Set(value As Integer)
  1180.             _DownColorIntensity = value
  1181.         End Set
  1182.     End Property
  1183.  
  1184.     Private _Border As Boolean = True
  1185.     <Category("Properties")>
  1186.     Public Property Border As Boolean
  1187.         Get
  1188.             Return _Border
  1189.         End Get
  1190.         Set(value As Boolean)
  1191.             _Border = value
  1192.             Invalidate()
  1193.         End Set
  1194.     End Property
  1195.  
  1196.     Private _BorderColorIntensity As Integer = 255
  1197.     <Category("Properties")>
  1198.     Public Property BorderColorIntensity As Integer
  1199.         Get
  1200.             Return _BorderColorIntensity
  1201.         End Get
  1202.         Set(value As Integer)
  1203.             _BorderColorIntensity = value
  1204.             Invalidate()
  1205.         End Set
  1206.     End Property
  1207.  
  1208.     Private _Shiny As Boolean = False
  1209.     <Category("Properties")>
  1210.     Public Property Shiny As Boolean
  1211.         Get
  1212.             Return _Shiny
  1213.         End Get
  1214.         Set(value As Boolean)
  1215.             _Shiny = value
  1216.             Invalidate()
  1217.         End Set
  1218.     End Property
  1219.  
  1220.     Private _ShinyIntensity As Integer = 15
  1221.     <Category("Properties")>
  1222.     Public Property ShinyIntensity As Integer
  1223.         Get
  1224.             Return _ShinyIntensity
  1225.         End Get
  1226.         Set(value As Integer)
  1227.             _ShinyIntensity = value
  1228.             Invalidate()
  1229.         End Set
  1230.     End Property
  1231.  
  1232.     Private _ShinyRounding As Integer = 8
  1233.     <Category("Properties")>
  1234.     Public Property ShinyRounding As Integer
  1235.         Get
  1236.             Return _ShinyRounding
  1237.         End Get
  1238.         Set(value As Integer)
  1239.             _ShinyRounding = value
  1240.         End Set
  1241.     End Property
  1242.  
  1243.     Private _ShowImage As Boolean = False
  1244.     <Category("Properties")>
  1245.     Public Property ShowImage As Boolean
  1246.         Get
  1247.             Return _ShowImage
  1248.         End Get
  1249.         Set(value As Boolean)
  1250.             _ShowImage = value
  1251.             Invalidate()
  1252.         End Set
  1253.     End Property
  1254.  
  1255.     Protected Overrides Sub OnTextChanged(e As EventArgs)
  1256.         MyBase.OnTextChanged(e) : Invalidate()
  1257.     End Sub
  1258.  
  1259. #End Region
  1260.  
  1261. #Region "Color Properties"
  1262.  
  1263.     <Category("Color Properties")>
  1264.     Public Property BaseColor As Color
  1265.         Get
  1266.             Return _BaseColor
  1267.         End Get
  1268.         Set(value As Color)
  1269.             _BaseColor = value
  1270.             Invalidate()
  1271.         End Set
  1272.     End Property
  1273.  
  1274.     <Category("Color Properties")>
  1275.     Public Property HoverColor As Color
  1276.         Get
  1277.             Return _HoverColor
  1278.         End Get
  1279.         Set(value As Color)
  1280.             _HoverColor = value
  1281.             Invalidate()
  1282.         End Set
  1283.     End Property
  1284.  
  1285.     <Category("Color Properties")>
  1286.     Public Property DownColor As Color
  1287.         Get
  1288.             Return _DownColor
  1289.         End Get
  1290.         Set(value As Color)
  1291.             _DownColor = value
  1292.             Invalidate()
  1293.         End Set
  1294.     End Property
  1295.  
  1296.     <Category("Color Properties")>
  1297.     Public Property HoverBorderColor As Color
  1298.         Get
  1299.             Return _HoverBorderColor
  1300.         End Get
  1301.         Set(value As Color)
  1302.             _HoverBorderColor = value
  1303.             Invalidate()
  1304.         End Set
  1305.     End Property
  1306.  
  1307.     <Category("Color Properties")>
  1308.     Public Property DownBorderColor As Color
  1309.         Get
  1310.             Return _DownBorderColor
  1311.         End Get
  1312.         Set(value As Color)
  1313.             _DownBorderColor = value
  1314.             Invalidate()
  1315.         End Set
  1316.     End Property
  1317.  
  1318.     <Category("Color Properties")>
  1319.     Public Property BorderColor As Color
  1320.         Get
  1321.             Return _BorderColor
  1322.         End Get
  1323.         Set(value As Color)
  1324.             _BorderColor = value
  1325.             Invalidate()
  1326.         End Set
  1327.     End Property
  1328.  
  1329.     <Category("Color Properties")>
  1330.     Public Property ColorBlend1 As Color
  1331.         Get
  1332.             Return _ColorBlend1
  1333.         End Get
  1334.         Set(value As Color)
  1335.             _ColorBlend1 = value
  1336.             Invalidate()
  1337.         End Set
  1338.     End Property
  1339.  
  1340.     <Category("Color Properties")>
  1341.     Public Property ColorBlend2 As Color
  1342.         Get
  1343.             Return _ColorBlend2
  1344.         End Get
  1345.         Set(value As Color)
  1346.             _ColorBlend2 = value
  1347.             Invalidate()
  1348.         End Set
  1349.     End Property
  1350.  
  1351.     <Category("Color Properties")>
  1352.     Public Property ColorBlend3 As Color
  1353.         Get
  1354.             Return _ColorBlend3
  1355.         End Get
  1356.         Set(value As Color)
  1357.             _ColorBlend3 = value
  1358.             Invalidate()
  1359.         End Set
  1360.     End Property
  1361.  
  1362.     <Category("Color Properties")>
  1363.     Public Property ColorBlend4 As Color
  1364.         Get
  1365.             Return _ColorBlend4
  1366.         End Get
  1367.         Set(value As Color)
  1368.             _ColorBlend4 = value
  1369.             Invalidate()
  1370.         End Set
  1371.     End Property
  1372.  
  1373.     <Category("Color Properties")>
  1374.     Public Property ShinyColor As Color
  1375.         Get
  1376.             Return _ShinyColor
  1377.         End Get
  1378.         Set(value As Color)
  1379.             _ShinyColor = value
  1380.             Invalidate()
  1381.         End Set
  1382.     End Property
  1383.  
  1384.     <Category("Color Properties")>
  1385.     Public Property TextColor As Color
  1386.         Get
  1387.             Return _TextColor
  1388.         End Get
  1389.         Set(value As Color)
  1390.             _TextColor = value
  1391.             Invalidate()
  1392.         End Set
  1393.     End Property
  1394.  
  1395. #End Region
  1396.  
  1397. #Region "Colors"
  1398.  
  1399.     Private _BaseColor As Color = Black
  1400.     Private _HoverColor As Color = White
  1401.     Private _DownColor As Color = Color.Black
  1402.     Private _HoverBorderColor As Color = White
  1403.     Private _DownBorderColor As Color = White
  1404.     Private _BorderColor As Color = White
  1405.     Private _ColorBlend1 As Color = Orange
  1406.     Private _ColorBlend2 As Color = Red
  1407.     Private _ColorBlend3 As Color = Green
  1408.     Private _ColorBlend4 As Color = Blue
  1409.     Private _ShinyColor As Color = White
  1410.     Private _TextColor As Color = White
  1411.  
  1412. #End Region
  1413.  
  1414.     Sub New()
  1415.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or
  1416.                  ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer Or
  1417.                  ControlStyles.SupportsTransparentBackColor, True)
  1418.         DoubleBuffered = True
  1419.         BackColor = Color.Transparent
  1420.         Size = New Size(128, 32)
  1421.         Font = New Font("Segoe UI", 12)
  1422.         Cursor = Cursors.Hand
  1423.     End Sub
  1424.  
  1425.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  1426.         B = New Bitmap(Width, Height) : G = Graphics.FromImage(B)
  1427.         Dim Base As New Rectangle(0, 0, Width, Height)
  1428.         Dim BorderColorBlend As New ColorBlend(4), BorderBrush As New LinearGradientBrush(Base, Color.Black, Color.Black, 0.0F)
  1429.         With G
  1430.             .SmoothingMode = SmoothingMode.HighQuality
  1431.             .PixelOffsetMode = PixelOffsetMode.HighQuality
  1432.             .TextRenderingHint = TextRenderingHint.ClearTypeGridFit
  1433.             .Clear(BackColor)
  1434.             If Rounded Then
  1435.                 'Base
  1436.                 .FillPath(New SolidBrush(BaseColor), Support.rRectangle(Base, Rounding))
  1437.                 Select Case State
  1438.                     Case MouseState.Over
  1439.                         .FillPath(New SolidBrush(Color.FromArgb(HoverColorIntensity, HoverColor)), Support.rRectangle(Base, Rounding))
  1440.                     Case MouseState.Down
  1441.                         .FillPath(New SolidBrush(Color.FromArgb(DownColorIntensity, DownColor)), Support.rRectangle(Base, Rounding))
  1442.                 End Select
  1443.                 'Shiny
  1444.                 If Shiny Then
  1445.                     .FillPath(New SolidBrush(Color.FromArgb(ShinyIntensity, ShinyColor)), Support.rRectangle(New Rectangle(0, 0, Width, CInt(Height / 2)), ShinyRounding))
  1446.                 End If
  1447.             Else
  1448.                 'Base
  1449.                 .FillRectangle(New SolidBrush(BaseColor), Base)
  1450.                 Select Case State
  1451.                     Case MouseState.Over
  1452.                         .FillRectangle(New SolidBrush(Color.FromArgb(HoverColorIntensity, HoverColor)), Base)
  1453.                     Case MouseState.Down
  1454.                         .FillRectangle(New SolidBrush(Color.FromArgb(DownColorIntensity, DownColor)), Base)
  1455.                 End Select
  1456.                 'Shiny
  1457.                 If Shiny Then
  1458.                     .FillRectangle(New SolidBrush(Color.FromArgb(ShinyIntensity, ShinyColor)), New Rectangle(0, 0, Width, CInt(Height / 2)))
  1459.                 End If
  1460.             End If
  1461.             'Text
  1462.             .DrawString(Text, Font, New SolidBrush(TextColor), Base, Center)
  1463.             'Border
  1464.             If Rounded Then : Else
  1465.                 If Border Then
  1466.                     Select Case BorderStyle
  1467.                         Case BS.Normal
  1468.                             .DrawRectangle(New Pen(Color.FromArgb(BorderColorIntensity, BorderColor)), Base)
  1469.                         Case BS.ColorBlend
  1470.                             Dim Colors() As Color = {ColorBlend1, ColorBlend2, ColorBlend3, ColorBlend4}
  1471.                             BorderColorBlend.Colors = Colors
  1472.                             BorderColorBlend.Positions = ColorBlendPositions
  1473.                             BorderBrush.InterpolationColors = BorderColorBlend
  1474.                             .DrawLine(New Pen(BorderBrush), New Point(0, 0), New Point(Width, 0))
  1475.                             .DrawLine(New Pen(BorderBrush), New Point(0, Height), New Point(Width, Height))
  1476.                             .DrawLine(New Pen(BorderBrush), New Point(0, 0), New Point(0, Height))
  1477.                             .DrawLine(New Pen(BorderBrush), New Point(Width, 0), New Point(Width, Height))
  1478.                     End Select
  1479.                 End If
  1480.             End If
  1481.         End With
  1482.         MyBase.OnPaint(e)
  1483.         G.Dispose()
  1484.         e.Graphics.DrawImage(DirectCast(B.Clone(), Image), 0, 0)
  1485.         e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic
  1486.         e.Graphics.DrawImageUnscaled(B, 0, 0)
  1487.         B.Dispose()
  1488.     End Sub
  1489.  
  1490. End Class
  1491.  
  1492. Public Class RoundedButton : Inherits Control
  1493.  
  1494. #Region "Variables"
  1495.  
  1496.     Private State As MouseState = MouseState.None
  1497.  
  1498. #End Region
  1499.  
  1500. #Region "Mouse States"
  1501.  
  1502.     Protected Overrides Sub OnMouseEnter(e As EventArgs)
  1503.         MyBase.OnMouseEnter(e)
  1504.         State = MouseState.Over : Invalidate()
  1505.     End Sub
  1506.  
  1507.     Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
  1508.         MyBase.OnMouseDown(e)
  1509.         State = MouseState.Down : Invalidate()
  1510.     End Sub
  1511.  
  1512.     Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
  1513.         MyBase.OnMouseUp(e)
  1514.         State = MouseState.Over : Invalidate()
  1515.     End Sub
  1516.  
  1517.     Protected Overrides Sub OnMouseLeave(e As EventArgs)
  1518.         MyBase.OnMouseLeave(e)
  1519.         State = MouseState.None : Invalidate()
  1520.     End Sub
  1521.  
  1522. #End Region
  1523.  
  1524. #Region "Properties"
  1525.  
  1526.     <Flags()>
  1527.     Enum BS
  1528.         Small
  1529.         Normal
  1530.         Big
  1531.     End Enum
  1532.  
  1533.     Private _ButtonSize As BS = BS.Normal
  1534.     <Category("Properties")>
  1535.     Public Property ButtonSize As BS
  1536.         Get
  1537.             Return _ButtonSize
  1538.         End Get
  1539.         Set(value As BS)
  1540.             _ButtonSize = value
  1541.             Select Case ButtonSize
  1542.                 Case BS.Small
  1543.                     Size = New Size(96, 96)
  1544.                 Case BS.Normal
  1545.                     Size = New Size(128, 128)
  1546.                 Case BS.Big
  1547.                     Size = New Size(160, 160)
  1548.             End Select
  1549.             Invalidate()
  1550.         End Set
  1551.     End Property
  1552.  
  1553.     Private _RingColorIntensity As Integer = 255
  1554.     <Category("Properties")>
  1555.     Public Property RingColorIntensity As Integer
  1556.         Get
  1557.             Return _RingColorIntensity
  1558.         End Get
  1559.         Set(value As Integer)
  1560.             _RingColorIntensity = value
  1561.             Invalidate()
  1562.         End Set
  1563.     End Property
  1564.  
  1565.     Private _HoverColorIntensity As Integer = 15
  1566.     <Category("Properties")>
  1567.     Public Property HoverColorIntensity As Integer
  1568.         Get
  1569.             Return _HoverColorIntensity
  1570.         End Get
  1571.         Set(value As Integer)
  1572.             _HoverColorIntensity = value
  1573.         End Set
  1574.     End Property
  1575.  
  1576.     Private _DownColorIntensity As Integer = 30
  1577.     <Category("Properties")>
  1578.     Public Property DownColorIntensity As Integer
  1579.         Get
  1580.             Return _DownColorIntensity
  1581.         End Get
  1582.         Set(value As Integer)
  1583.             _DownColorIntensity = value
  1584.         End Set
  1585.     End Property
  1586.  
  1587.     Private _BorderColorIntensity As Integer = 255
  1588.     <Category("Properties")>
  1589.     Public Property BorderColorIntensity As Integer
  1590.         Get
  1591.             Return _BorderColorIntensity
  1592.         End Get
  1593.         Set(value As Integer)
  1594.             _BorderColorIntensity = value
  1595.             Invalidate()
  1596.         End Set
  1597.     End Property
  1598.  
  1599.     Protected Overrides Sub OnTextChanged(e As EventArgs)
  1600.         MyBase.OnTextChanged(e) : Invalidate()
  1601.     End Sub
  1602.  
  1603.     Protected Overrides Sub OnResize(e As EventArgs)
  1604.         MyBase.OnResize(e)
  1605.         Select Case ButtonSize
  1606.             Case BS.Small
  1607.                 Width = 96
  1608.                 Height = 96
  1609.             Case BS.Normal
  1610.                 Width = 128
  1611.                 Height = 128
  1612.             Case BS.Big
  1613.                 Width = 160
  1614.                 Height = 160
  1615.         End Select
  1616.     End Sub
  1617.  
  1618. #End Region
  1619.  
  1620. #Region "Color Properties"
  1621.  
  1622.     <Category("Color Properties")>
  1623.     Public Property RingColor As Color
  1624.         Get
  1625.             Return _RingColor
  1626.         End Get
  1627.         Set(value As Color)
  1628.             _RingColor = value
  1629.             Invalidate()
  1630.         End Set
  1631.     End Property
  1632.  
  1633.     <Category("Color Properties")>
  1634.     Public Property HoverColor As Color
  1635.         Get
  1636.             Return _HoverColor
  1637.         End Get
  1638.         Set(value As Color)
  1639.             _HoverColor = value
  1640.             Invalidate()
  1641.         End Set
  1642.     End Property
  1643.  
  1644.     <Category("Color Properties")>
  1645.     Public Property DownColor As Color
  1646.         Get
  1647.             Return _DownColor
  1648.         End Get
  1649.         Set(value As Color)
  1650.             _DownColor = value
  1651.             Invalidate()
  1652.         End Set
  1653.     End Property
  1654.  
  1655.     <Category("Color Properties")>
  1656.     Public Property BorderColor As Color
  1657.         Get
  1658.             Return _BorderColor
  1659.         End Get
  1660.         Set(value As Color)
  1661.             _BorderColor = value
  1662.             Invalidate()
  1663.         End Set
  1664.     End Property
  1665.  
  1666.     <Category("Color Properties")>
  1667.     Public Property TextColor As Color
  1668.         Get
  1669.             Return _TextColor
  1670.         End Get
  1671.         Set(value As Color)
  1672.             _TextColor = value
  1673.             Invalidate()
  1674.         End Set
  1675.     End Property
  1676.  
  1677. #End Region
  1678.  
  1679. #Region "Colors"
  1680.  
  1681.     Private _RingColor As Color = Green
  1682.     Private _HoverColor As Color = White
  1683.     Private _DownColor As Color = Color.Black
  1684.     Private _BorderColor As Color = Black
  1685.     Private _TextColor As Color = White
  1686.  
  1687. #End Region
  1688.  
  1689.     Sub New()
  1690.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or
  1691.                  ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer Or
  1692.                  ControlStyles.SupportsTransparentBackColor, True)
  1693.         DoubleBuffered = True
  1694.         BackColor = Color.Transparent
  1695.         Size = New Size(128, 128)
  1696.         Font = New Font("Segoe UI", 12)
  1697.         Cursor = Cursors.Hand
  1698.     End Sub
  1699.  
  1700.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  1701.         B = New Bitmap(Width, Height) : G = Graphics.FromImage(B)
  1702.         Dim Base As New Rectangle(0, 0, Width, Height)
  1703.         Dim SideBlend As New ColorBlend(4), MiddleBlend As New ColorBlend(4),
  1704.             SideBrush As New LinearGradientBrush(New Point(0, 0), New Point(0, Height), Color.Black, Color.Black),
  1705.             MiddleBrush As New LinearGradientBrush(New Point(0, 0), New Point(45, Height), Color.Black, Color.Black)
  1706.         With G
  1707.             .SmoothingMode = SmoothingMode.HighQuality
  1708.             .PixelOffsetMode = PixelOffsetMode.HighQuality
  1709.             .TextRenderingHint = TextRenderingHint.ClearTypeGridFit
  1710.             .Clear(BackColor)
  1711.             'Border
  1712.             .FillEllipse(New SolidBrush(Color.FromArgb(BorderColorIntensity, BorderColor)), Base)
  1713.             'Side Ring
  1714.             .FillEllipse(New SolidBrush(Color.FromArgb(255, Black)), New Rectangle(1, 1, Width - 2, Height - 2))
  1715.             .FillEllipse(New SolidBrush(Color.FromArgb(10, White)), New Rectangle(1, 1, Width - 2, Height - 2))
  1716.             Select Case ButtonSize
  1717.                 Case BS.Small
  1718.                     'Second Side Ring
  1719.                     SideBlend.Colors(1) = Color.FromArgb(60, 150, 150, 150)
  1720.                     SideBlend.Colors(2) = Color.FromArgb(255, 35, 35, 35)
  1721.                     SideBlend.Positions = New Single() {0.0, 0.33, 0.66, 1.0}
  1722.                     SideBrush.InterpolationColors = SideBlend
  1723.                     .FillEllipse(SideBrush, New Rectangle(6, 6, Width - 12, Height - 12))
  1724.                     'Colored Ring
  1725.                     .FillEllipse(New SolidBrush(Color.FromArgb(RingColorIntensity, RingColor)), New Rectangle(12, 12, Width - 24, Height - 24))
  1726.                     'Middle Button
  1727.                     MiddleBlend.Colors(1) = Color.FromArgb(255, Black)
  1728.                     MiddleBlend.Colors(2) = Color.FromArgb(255, 40, 40, 40)
  1729.                     MiddleBlend.Colors(3) = Color.FromArgb(255, Gray)
  1730.                     MiddleBlend.Positions = New Single() {0.0, 0.00, 0.66, 1.0}
  1731.                     MiddleBrush.InterpolationColors = MiddleBlend
  1732.                     .FillEllipse(MiddleBrush, New Rectangle(16, 16, Width - 32, Height - 32))
  1733.                     Select Case State
  1734.                         Case MouseState.Over
  1735.                             .FillEllipse(New SolidBrush(Color.FromArgb(HoverColorIntensity, HoverColor)), New Rectangle(16, 16, Width - 32, Height - 32))
  1736.                         Case MouseState.Down
  1737.                             .FillEllipse(New SolidBrush(Color.FromArgb(DownColorIntensity, DownColor)), New Rectangle(16, 16, Width - 32, Height - 32))
  1738.                     End Select
  1739.                 Case BS.Normal
  1740.                     'Second Side Ring
  1741.                     SideBlend.Colors(1) = Color.FromArgb(60, 150, 150, 150)
  1742.                     SideBlend.Colors(2) = Color.FromArgb(255, 35, 35, 35)
  1743.                     SideBlend.Positions = New Single() {0.0, 0.33, 0.66, 1.0}
  1744.                     SideBrush.InterpolationColors = SideBlend
  1745.                     .FillEllipse(SideBrush, New Rectangle(8, 8, Width - 16, Height - 16))
  1746.                     'Colored Ring
  1747.                     .FillEllipse(New SolidBrush(Color.FromArgb(RingColorIntensity, RingColor)), New Rectangle(16, 16, Width - 32, Height - 32))
  1748.                     'Middle Button
  1749.                     MiddleBlend.Colors(1) = Color.FromArgb(255, Black)
  1750.                     MiddleBlend.Colors(2) = Color.FromArgb(255, 40, 40, 40)
  1751.                     MiddleBlend.Colors(3) = Color.FromArgb(255, Gray)
  1752.                     MiddleBlend.Positions = New Single() {0.0, 0.00, 0.66, 1.0}
  1753.                     MiddleBrush.InterpolationColors = MiddleBlend
  1754.                     .FillEllipse(MiddleBrush, New Rectangle(22, 22, Width - 44, Height - 44))
  1755.                     Select Case State
  1756.                         Case MouseState.Over
  1757.                             .FillEllipse(New SolidBrush(Color.FromArgb(HoverColorIntensity, HoverColor)), New Rectangle(22, 22, Width - 44, Height - 44))
  1758.                         Case MouseState.Down
  1759.                             .FillEllipse(New SolidBrush(Color.FromArgb(DownColorIntensity, DownColor)), New Rectangle(22, 22, Width - 44, Height - 44))
  1760.                     End Select
  1761.                 Case BS.Big
  1762.                     'Second Side Ring
  1763.                     SideBlend.Colors(1) = Color.FromArgb(60, 150, 150, 150)
  1764.                     SideBlend.Colors(2) = Color.FromArgb(255, 35, 35, 35)
  1765.                     SideBlend.Positions = New Single() {0.0, 0.33, 0.66, 1.0}
  1766.                     SideBrush.InterpolationColors = SideBlend
  1767.                     .FillEllipse(SideBrush, New Rectangle(10, 10, Width - 20, Height - 20))
  1768.                     'Colored Ring
  1769.                     .FillEllipse(New SolidBrush(Color.FromArgb(RingColorIntensity, RingColor)), New Rectangle(20, 20, Width - 40, Height - 40))
  1770.                     'Middle Button
  1771.                     MiddleBlend.Colors(1) = Color.FromArgb(255, 50, 50, 50)
  1772.                     MiddleBlend.Colors(2) = Color.FromArgb(255, 40, 40, 40)
  1773.                     MiddleBlend.Colors(3) = Color.FromArgb(255, Gray)
  1774.                     MiddleBlend.Positions = New Single() {0.0, 0.00, 0.66, 1.0}
  1775.                     MiddleBrush.InterpolationColors = MiddleBlend
  1776.                     .FillEllipse(MiddleBrush, New Rectangle(28, 28, Width - 56, Height - 56))
  1777.                     Select Case State
  1778.                         Case MouseState.Over
  1779.                             .FillEllipse(New SolidBrush(Color.FromArgb(HoverColorIntensity, HoverColor)), New Rectangle(28, 28, Width - 56, Height - 56))
  1780.                         Case MouseState.Down
  1781.                             .FillEllipse(New SolidBrush(Color.FromArgb(DownColorIntensity, DownColor)), New Rectangle(28, 28, Width - 56, Height - 56))
  1782.                     End Select
  1783.             End Select
  1784.             'Text
  1785.             .DrawString(Text, Font, New SolidBrush(TextColor), Base, Center)
  1786.         End With
  1787.         MyBase.OnPaint(e)
  1788.         G.Dispose()
  1789.         e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic
  1790.         e.Graphics.DrawImageUnscaled(B, 0, 0)
  1791.         B.Dispose()
  1792.     End Sub
  1793.  
  1794. End Class
  1795.  
  1796. Public Class Loader : Inherits Control
  1797.  
  1798. #Region "Variables"
  1799.  
  1800.     Private State As MouseState = MouseState.None
  1801.     Private WithEvents Timer As New Timer With {.Interval = 10, .Enabled = True}
  1802.     Private Maximum As Integer = 100
  1803.     Private Minimum As Integer = 0
  1804.     Private Value As Integer = 0
  1805.  
  1806. #End Region
  1807.  
  1808. #Region "Mouse States"
  1809.  
  1810.     Protected Overrides Sub OnMouseEnter(e As EventArgs)
  1811.         MyBase.OnMouseEnter(e)
  1812.         State = MouseState.Over : Invalidate()
  1813.     End Sub
  1814.  
  1815.     Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
  1816.         MyBase.OnMouseDown(e)
  1817.         State = MouseState.Down : Invalidate()
  1818.     End Sub
  1819.  
  1820.     Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
  1821.         MyBase.OnMouseUp(e)
  1822.         State = MouseState.Over : Invalidate()
  1823.     End Sub
  1824.  
  1825.     Protected Overrides Sub OnMouseLeave(e As EventArgs)
  1826.         MyBase.OnMouseLeave(e)
  1827.         State = MouseState.None : Invalidate()
  1828.     End Sub
  1829.  
  1830. #End Region
  1831.  
  1832. #Region "Properties"
  1833.  
  1834.     <Flags()>
  1835.     Enum _Style
  1836.         Style1
  1837.         Style2
  1838.     End Enum
  1839.  
  1840.     Private _ChooseStyle As _Style = _Style.Style1
  1841.     <Category("Properties")>
  1842.     Public Property Style As _Style
  1843.         Get
  1844.             Return _ChooseStyle
  1845.         End Get
  1846.         Set(value As _Style)
  1847.             _ChooseStyle = value
  1848.             Invalidate()
  1849.         End Set
  1850.     End Property
  1851.  
  1852.     Private _TimerEnabled As Boolean = True
  1853.     <Category("Properties")>
  1854.     Public Property TimerEnabled As Boolean
  1855.         Get
  1856.             Return _TimerEnabled
  1857.         End Get
  1858.         Set(value As Boolean)
  1859.             _TimerEnabled = value
  1860.             If value Then
  1861.                 Timer.Start()
  1862.             Else
  1863.                 Timer.Stop()
  1864.             End If
  1865.             Invalidate()
  1866.         End Set
  1867.     End Property
  1868.  
  1869.     Private _TimerInterval As Integer = 10
  1870.     <Category("Properties")>
  1871.     Public Property TimerInterval As Integer
  1872.         Get
  1873.             Return _TimerInterval
  1874.         End Get
  1875.         Set(value As Integer)
  1876.             _TimerInterval = value
  1877.             Timer.Interval = value
  1878.             Invalidate()
  1879.         End Set
  1880.     End Property
  1881.  
  1882.     Private _Thickness As Single = 2
  1883.     <Category("Properties")>
  1884.     Public Property Thickness As Single
  1885.         Get
  1886.             Return _Thickness
  1887.         End Get
  1888.         Set(value As Single)
  1889.             _Thickness = value
  1890.             Invalidate()
  1891.         End Set
  1892.     End Property
  1893.  
  1894.     Public Sub Increment(ByVal Amount As Integer)
  1895.         Value += Amount
  1896.     End Sub
  1897.  
  1898.     Private _StartingAngleValue As Integer = 90
  1899.     Private _StartingAngle As Integer = 90
  1900.     <Category("Properties")>
  1901.     Public Property StartingAngle As Integer
  1902.         Get
  1903.             Return _StartingAngle
  1904.         End Get
  1905.         Set(value As Integer)
  1906.             _StartingAngle = value
  1907.             _StartingAngleValue = value
  1908.         End Set
  1909.     End Property
  1910.  
  1911.     Private _RotationAngleValue As Integer = 360
  1912.     Private _RotationAngle As Integer = 360
  1913.     <Category("Properties")>
  1914.     Public Property RotationAngle As Integer
  1915.         Get
  1916.             Return _RotationAngle
  1917.         End Get
  1918.         Set(value As Integer)
  1919.             _RotationAngle = value
  1920.             _RotationAngleValue = value
  1921.         End Set
  1922.     End Property
  1923.  
  1924.     Private _Length As Integer = 25
  1925.     <Category("Properties")>
  1926.     Public Property Length As Integer
  1927.         Get
  1928.             Return _Length
  1929.         End Get
  1930.         Set(value As Integer)
  1931.             _Length = value
  1932.         End Set
  1933.     End Property
  1934.  
  1935.     Protected Overrides Sub OnResize(e As EventArgs)
  1936.         MyBase.OnResize(e)
  1937.         Height = Width
  1938.     End Sub
  1939.  
  1940. #End Region
  1941.  
  1942. #Region "Color Properties"
  1943.  
  1944.     <Category("Color Properties")>
  1945.     Public Property LoadingColor As Color
  1946.         Get
  1947.             Return _LoadingColor
  1948.         End Get
  1949.         Set(value As Color)
  1950.             _LoadingColor = value
  1951.             Invalidate()
  1952.         End Set
  1953.     End Property
  1954.  
  1955. #End Region
  1956.  
  1957. #Region "Colors"
  1958.  
  1959.     Private _BaseColor As Color = Black
  1960.     Private _LoadingColor As Color = Green
  1961.  
  1962. #End Region
  1963.  
  1964.     Sub New()
  1965.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or
  1966.                  ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer Or
  1967.                  ControlStyles.SupportsTransparentBackColor, True)
  1968.         DoubleBuffered = True
  1969.         BackColor = Color.Transparent
  1970.         Size = New Size(32, 32)
  1971.         Font = New Font("Segoe UI", 12)
  1972.     End Sub
  1973.  
  1974.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  1975.         B = New Bitmap(Width, Height) : G = Graphics.FromImage(B)
  1976.         Dim Base As New Rectangle(0, 0, Width, Height)
  1977.         With G
  1978.             .SmoothingMode = SmoothingMode.HighQuality
  1979.             .PixelOffsetMode = PixelOffsetMode.HighQuality
  1980.             .Clear(BackColor)
  1981.             .DrawArc(New Pen(New SolidBrush(LoadingColor), Thickness), CInt(3 / 2) + 1, CInt(3 / 2) + 1, Width - 7, Height - 6, _StartingAngleValue, CInt((_RotationAngleValue / Maximum) * Value))
  1982.         End With
  1983.         MyBase.OnPaint(e)
  1984.         G.Dispose()
  1985.         e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic
  1986.         e.Graphics.DrawImageUnscaled(B, 0, 0)
  1987.         B.Dispose()
  1988.     End Sub
  1989.  
  1990.     Private Sub Timer_Tick(sender As Object, e As EventArgs) Handles Timer.Tick
  1991.         Select Case Style
  1992.             Case _Style.Style1
  1993.                 If Value = Maximum Then
  1994.                     Value = Minimum
  1995.                 Else
  1996.                     Value += 1
  1997.                 End If
  1998.             Case _Style.Style2
  1999.                 Value = Length
  2000.                 _StartingAngleValue += 1
  2001.                 If _StartingAngleValue = RotationAngle + StartingAngle Then
  2002.                     _StartingAngleValue = StartingAngle
  2003.                 End If
  2004.         End Select
  2005.         Invalidate()
  2006.     End Sub
  2007.  
  2008. End Class
  2009.  
  2010. Public Class Toggle : Inherits Control
  2011.  
  2012. #Region "Variables"
  2013.  
  2014.     Private State As MouseState = MouseState.None
  2015.  
  2016. #End Region
  2017.  
  2018. #Region "Mouse States"
  2019.  
  2020.     Protected Overrides Sub OnMouseEnter(e As EventArgs)
  2021.         MyBase.OnMouseEnter(e)
  2022.         State = MouseState.Over : Invalidate()
  2023.     End Sub
  2024.  
  2025.     Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
  2026.         MyBase.OnMouseDown(e)
  2027.         State = MouseState.Down : Invalidate()
  2028.     End Sub
  2029.  
  2030.     Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
  2031.         MyBase.OnMouseUp(e)
  2032.         State = MouseState.Over : Invalidate()
  2033.     End Sub
  2034.  
  2035.     Protected Overrides Sub OnMouseLeave(e As EventArgs)
  2036.         MyBase.OnMouseLeave(e)
  2037.         State = MouseState.None : Invalidate()
  2038.     End Sub
  2039.  
  2040.     Protected Overrides Sub OnClick(e As EventArgs)
  2041.         MyBase.OnClick(e)
  2042.         _Checked = Not _Checked
  2043.         RaiseEvent CheckedChanged(Me)
  2044.     End Sub
  2045.  
  2046. #End Region
  2047.  
  2048. #Region "Properties"
  2049.  
  2050.     <Flags()>
  2051.     Enum S
  2052.         Style1
  2053.         Style2
  2054.         Style3
  2055.     End Enum
  2056.  
  2057.     Private _Style As S
  2058.     <Category("Properties")>
  2059.     Public Property Style As S
  2060.         Get
  2061.             Return _Style
  2062.         End Get
  2063.         Set(value As S)
  2064.             _Style = value
  2065.             Invalidate()
  2066.         End Set
  2067.     End Property
  2068.  
  2069.     Private _Rounded As Boolean = False
  2070.     <Category("Properties")>
  2071.     Public Property Rounded As Boolean
  2072.         Get
  2073.             Return _Rounded
  2074.         End Get
  2075.         Set(value As Boolean)
  2076.             _Rounded = value
  2077.             Invalidate()
  2078.         End Set
  2079.     End Property
  2080.  
  2081.     Private _Border As Boolean = True
  2082.     <Category("Properties")>
  2083.     Public Property Border As Boolean
  2084.         Get
  2085.             Return _Border
  2086.         End Get
  2087.         Set(value As Boolean)
  2088.             _Border = value
  2089.             Invalidate()
  2090.         End Set
  2091.     End Property
  2092.  
  2093.     Public Event CheckedChanged(ByVal sender As Object)
  2094.     Private _Checked As Boolean
  2095.     <Category("Properties")>
  2096.     Public Property Checked As Boolean
  2097.         Get
  2098.             Return _Checked
  2099.         End Get
  2100.         Set(value As Boolean)
  2101.             _Checked = value
  2102.             Invalidate()
  2103.         End Set
  2104.     End Property
  2105.  
  2106.     Protected Overrides Sub OnTextChanged(e As EventArgs)
  2107.         MyBase.OnTextChanged(e) : Invalidate()
  2108.     End Sub
  2109.  
  2110.     Protected Overrides Sub OnResize(e As EventArgs)
  2111.         MyBase.OnResize(e)
  2112.         Width = 70
  2113.         Height = 34
  2114.     End Sub
  2115.  
  2116. #End Region
  2117.  
  2118. #Region "Color Properties"
  2119.  
  2120.     <Category("Color Properties")>
  2121.     Public Property BaseColor As Color
  2122.         Get
  2123.             Return _BaseColor
  2124.         End Get
  2125.         Set(value As Color)
  2126.             _BaseColor = value
  2127.             Invalidate()
  2128.         End Set
  2129.     End Property
  2130.  
  2131.     <Category("Color Properties")>
  2132.     Public Property OnColor As Color
  2133.         Get
  2134.             Return _OnColor
  2135.         End Get
  2136.         Set(value As Color)
  2137.             _OnColor = value
  2138.             Invalidate()
  2139.         End Set
  2140.     End Property
  2141.  
  2142.     <Category("Color Properties")>
  2143.     Public Property OffColor As Color
  2144.         Get
  2145.             Return _OffColor
  2146.         End Get
  2147.         Set(value As Color)
  2148.             _OffColor = value
  2149.             Invalidate()
  2150.         End Set
  2151.     End Property
  2152.  
  2153.     <Category("Color Properties")>
  2154.     Public Property OnTextColor As Color
  2155.         Get
  2156.             Return _OnTextColor
  2157.         End Get
  2158.         Set(value As Color)
  2159.             _OnTextColor = value
  2160.             Invalidate()
  2161.         End Set
  2162.     End Property
  2163.  
  2164.     <Category("Color Properties")>
  2165.     Public Property OffTextColor As Color
  2166.         Get
  2167.             Return _OffTextColor
  2168.         End Get
  2169.         Set(value As Color)
  2170.             _OffTextColor = value
  2171.             Invalidate()
  2172.         End Set
  2173.     End Property
  2174.  
  2175.     <Category("Color Properties")>
  2176.     Public Property BorderColor As Color
  2177.         Get
  2178.             Return _BorderColor
  2179.         End Get
  2180.         Set(value As Color)
  2181.             _BorderColor = value
  2182.             Invalidate()
  2183.         End Set
  2184.     End Property
  2185.  
  2186.     <Category("Color Properties")>
  2187.     Public Property HoverBorderColor As Color
  2188.         Get
  2189.             Return _HoverBorderColor
  2190.         End Get
  2191.         Set(value As Color)
  2192.             _HoverBorderColor = value
  2193.             Invalidate()
  2194.         End Set
  2195.     End Property
  2196.  
  2197.     <Category("Color Properties")>
  2198.     Public Property DownBorderColor As Color
  2199.         Get
  2200.             Return _DownBorderColor
  2201.         End Get
  2202.         Set(value As Color)
  2203.             _DownBorderColor = value
  2204.             Invalidate()
  2205.         End Set
  2206.     End Property
  2207.  
  2208. #End Region
  2209.  
  2210. #Region "Colors"
  2211.  
  2212.     Private _BaseColor As Color = Black
  2213.     Private _OnColor As Color = Green
  2214.     Private _OffColor As Color = Red
  2215.     Private _OnTextColor As Color = White
  2216.     Private _OffTextColor As Color = White
  2217.     Private _BorderColor As Color = White
  2218.     Private _HoverBorderColor As Color = White
  2219.     Private _DownBorderColor As Color = White
  2220.  
  2221. #End Region
  2222.  
  2223.     Sub New()
  2224.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or
  2225.                  ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer, True)
  2226.         DoubleBuffered = True
  2227.         BackColor = Gray
  2228.         Size = New Size(70, 30)
  2229.         Font = New Font("Segoe UI", 10)
  2230.         Cursor = Cursors.Hand
  2231.     End Sub
  2232.  
  2233.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  2234.         B = New Bitmap(Width, Height) : G = Graphics.FromImage(B)
  2235.         Dim GP, GP1 As New GraphicsPath
  2236.         Dim Base As New Rectangle(0, 0, Width, Height), Toggle As New Rectangle(CInt(Height \ 2), 0, 38, Height), Dot As New Rectangle(6, 6, Height - 12, Height - 12)
  2237.         With G
  2238.             .SmoothingMode = SmoothingMode.HighQuality
  2239.             .PixelOffsetMode = PixelOffsetMode.HighQuality
  2240.             .TextRenderingHint = TextRenderingHint.ClearTypeGridFit
  2241.             .Clear(BackColor)
  2242.             Select Case Style
  2243.                 Case S.Style1
  2244.                     If Checked Then
  2245.                         If Rounded Then
  2246.                             'Base
  2247.                             GP = Support.rRectangle(Base, 9)
  2248.                             GP1 = Support.rRectangle(New Rectangle(CInt(Width \ 2 + 5), 0, 30, Height), 9)
  2249.                             .FillPath(New SolidBrush(BaseColor), GP)
  2250.                             .FillPath(New SolidBrush(OnColor), GP1)
  2251.                             'Text
  2252.                             .DrawString("ON", Font, New SolidBrush(OnTextColor), New Rectangle(8, 8, Width, Height), Near)
  2253.                         Else
  2254.                             'Base
  2255.                             .FillRectangle(New SolidBrush(BaseColor), Base)
  2256.                             .FillRectangle(New SolidBrush(OnColor), New Rectangle(CInt(Width \ 2 + 4), 1, 30, Height - 2))
  2257.                             'Text
  2258.                             .DrawString("ON", Font, New SolidBrush(OnTextColor), New Rectangle(8, 8, Width, Height), Near)
  2259.                             'Border
  2260.                             If Border Then
  2261.                                 Select Case State
  2262.                                     Case MouseState.None
  2263.                                         .DrawRectangle(New Pen(BorderColor), Base)
  2264.                                     Case MouseState.Over
  2265.                                         .DrawRectangle(New Pen(HoverBorderColor), Base)
  2266.                                     Case MouseState.Down
  2267.                                         .DrawRectangle(New Pen(DownBorderColor), Base)
  2268.                                 End Select
  2269.                             End If
  2270.                         End If
  2271.                     Else
  2272.                         If Rounded Then
  2273.                             'Base
  2274.                             GP = Support.rRectangle(Base, 9)
  2275.                             GP1 = Support.rRectangle(New Rectangle(0, 0, 30, Height), 9)
  2276.                             .FillPath(New SolidBrush(BaseColor), GP)
  2277.                             .FillPath(New SolidBrush(OffColor), GP1)
  2278.                             'Text
  2279.                             .DrawString("OFF", Font, New SolidBrush(OffTextColor), New Rectangle(14, 1, Width, Height), Center)
  2280.                         Else
  2281.                             'Base
  2282.                             .FillRectangle(New SolidBrush(BaseColor), Base)
  2283.                             .FillRectangle(New SolidBrush(OffColor), New Rectangle(1, 1, 30, Height - 2))
  2284.                             'Text
  2285.                             .DrawString("OFF", Font, New SolidBrush(OffTextColor), New Rectangle(13, 1, Width, Height), Center)
  2286.                             'Border
  2287.                             If Border Then
  2288.                                 Select Case State
  2289.                                     Case MouseState.None
  2290.                                         .DrawRectangle(New Pen(BorderColor), Base)
  2291.                                     Case MouseState.Over
  2292.                                         .DrawRectangle(New Pen(HoverBorderColor), Base)
  2293.                                     Case MouseState.Down
  2294.                                         .DrawRectangle(New Pen(DownBorderColor), Base)
  2295.                                 End Select
  2296.                             End If
  2297.                         End If
  2298.                     End If
  2299.                 Case S.Style2
  2300.                     If Checked Then
  2301.                         If Rounded Then
  2302.                             'Base
  2303.                             GP = Support.rRectangle(Base, 6)
  2304.                             Toggle = New Rectangle(CInt(Width \ 2) - 5, 4, 36, Height - 8)
  2305.                             GP1 = Support.rRectangle(Toggle, 4)
  2306.                             .FillPath(New SolidBrush(BaseColor), GP)
  2307.                             .FillPath(New SolidBrush(OnColor), GP1)
  2308.                             'Text
  2309.                             .DrawString("ü", New Font("Wingdings", 14), New SolidBrush(OnTextColor), New Rectangle(4, 8, Width, Height), Near)
  2310.                         Else
  2311.                             'Base
  2312.                             Toggle = New Rectangle(CInt(Width \ 2) - 5, 4, 36, Height - 8)
  2313.                             .FillRectangle(New SolidBrush(BaseColor), Base)
  2314.                             .FillRectangle(New SolidBrush(OnColor), Toggle)
  2315.                             'Text
  2316.                             .DrawString("ü", New Font("Wingdings", 14), New SolidBrush(OnTextColor), New Rectangle(4, 8, Width, Height), Near)
  2317.                             'Border
  2318.                             If Border Then
  2319.                                 Select Case State
  2320.                                     Case MouseState.None
  2321.                                         .DrawRectangle(New Pen(BorderColor), Base)
  2322.                                     Case MouseState.Over
  2323.                                         .DrawRectangle(New Pen(HoverBorderColor), Base)
  2324.                                     Case MouseState.Down
  2325.                                         .DrawRectangle(New Pen(DownBorderColor), Base)
  2326.                                 End Select
  2327.                             End If
  2328.                         End If
  2329.                     Else
  2330.                         If Rounded Then
  2331.                             'Base
  2332.                             GP = Support.rRectangle(Base, 6)
  2333.                             Toggle = New Rectangle(4, 4, 36, Height - 8)
  2334.                             GP1 = Support.rRectangle(Toggle, 4)
  2335.                             .FillPath(New SolidBrush(BaseColor), GP)
  2336.                             .FillPath(New SolidBrush(OffColor), GP1)
  2337.                             'Text
  2338.                             .DrawString("r", New Font("Marlett", 8), New SolidBrush(OffTextColor), New Rectangle(20, 1, Width, Height), Center)
  2339.                         Else
  2340.                             'Base
  2341.                             Toggle = New Rectangle(4, 4, 36, Height - 8)
  2342.                             .FillRectangle(New SolidBrush(BaseColor), Base)
  2343.                             .FillRectangle(New SolidBrush(OffColor), Toggle)
  2344.                             'Text
  2345.                             .DrawString("r", New Font("Marlett", 8), New SolidBrush(OffTextColor), New Rectangle(20, 1, Width, Height), Center)
  2346.                             'Border
  2347.                             If Border Then
  2348.                                 Select Case State
  2349.                                     Case MouseState.None
  2350.                                         .DrawRectangle(New Pen(BorderColor), Base)
  2351.                                     Case MouseState.Over
  2352.                                         .DrawRectangle(New Pen(HoverBorderColor), Base)
  2353.                                     Case MouseState.Down
  2354.                                         .DrawRectangle(New Pen(DownBorderColor), Base)
  2355.                                 End Select
  2356.                             End If
  2357.                         End If
  2358.                     End If
  2359.                 Case S.Style3
  2360.                     If Checked Then
  2361.                         If Rounded Then
  2362.                             'Base
  2363.                             GP = Support.rRectangle(Base, 16)
  2364.                             Dot = New Rectangle(Width - 28, 6, Height - 12, Height - 12)
  2365.                             GP1.AddEllipse(Dot)
  2366.                             .FillPath(New SolidBrush(BaseColor), GP)
  2367.                             .FillPath(New SolidBrush(OnColor), GP1)
  2368.                             'Text
  2369.                             .DrawString("ON", Font, New SolidBrush(OnTextColor), New Rectangle(-12, 1, Width, Height), Center)
  2370.                         Else
  2371.                             'Base
  2372.                             Toggle = New Rectangle(Width - 26, 4, 22, Height - 8)
  2373.                             .FillRectangle(New SolidBrush(BaseColor), Base)
  2374.                             .FillRectangle(New SolidBrush(OnColor), Toggle)
  2375.                             'Text
  2376.                             .DrawString("ON", Font, New SolidBrush(OnTextColor), New Rectangle(-13, 1, Width, Height), Center)
  2377.                             'Border
  2378.                             If Border Then
  2379.                                 Select Case State
  2380.                                     Case MouseState.None
  2381.                                         .DrawRectangle(New Pen(BorderColor), Base)
  2382.                                     Case MouseState.Over
  2383.                                         .DrawRectangle(New Pen(HoverBorderColor), Base)
  2384.                                     Case MouseState.Down
  2385.                                         .DrawRectangle(New Pen(DownBorderColor), Base)
  2386.                                 End Select
  2387.                             End If
  2388.                         End If
  2389.                     Else
  2390.                         If Rounded Then
  2391.                             'Base
  2392.                             GP = Support.rRectangle(Base, 16)
  2393.                             GP1.AddEllipse(Dot)
  2394.                             .FillPath(New SolidBrush(BaseColor), GP)
  2395.                             .FillPath(New SolidBrush(OffColor), GP1)
  2396.                             'Text
  2397.                             .DrawString("OFF", Font, New SolidBrush(OffTextColor), New Rectangle(12, 1, Width, Height), Center)
  2398.                         Else
  2399.                             'Base
  2400.                             Toggle = New Rectangle(4, 4, 22, Height - 8)
  2401.                             .FillRectangle(New SolidBrush(BaseColor), Base)
  2402.                             .FillRectangle(New SolidBrush(OffColor), Toggle)
  2403.                             'Text
  2404.                             .DrawString("OFF", Font, New SolidBrush(OffTextColor), New Rectangle(11, 1, Width, Height), Center)
  2405.                             'Border
  2406.                             If Border Then
  2407.                                 Select Case State
  2408.                                     Case MouseState.None
  2409.                                         .DrawRectangle(New Pen(BorderColor), Base)
  2410.                                     Case MouseState.Over
  2411.                                         .DrawRectangle(New Pen(HoverBorderColor), Base)
  2412.                                     Case MouseState.Down
  2413.                                         .DrawRectangle(New Pen(DownBorderColor), Base)
  2414.                                 End Select
  2415.                             End If
  2416.                         End If
  2417.                     End If
  2418.             End Select
  2419.         End With
  2420.         MyBase.OnPaint(e)
  2421.         G.Dispose()
  2422.         e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic
  2423.         e.Graphics.DrawImageUnscaled(B, 0, 0)
  2424.         B.Dispose()
  2425.     End Sub
  2426.  
  2427. End Class
  2428.  
  2429. Public Class RadioButton : Inherits Control
  2430.  
  2431. #Region "Variables"
  2432.  
  2433.     Private State As MouseState = MouseState.None
  2434.  
  2435. #End Region
  2436.  
  2437. #Region "Mouse States"
  2438.  
  2439.     Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
  2440.         MyBase.OnMouseDown(e)
  2441.         State = MouseState.Down : Invalidate()
  2442.     End Sub
  2443.  
  2444.     Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
  2445.         MyBase.OnMouseUp(e)
  2446.         State = MouseState.Over : Invalidate()
  2447.     End Sub
  2448.  
  2449.     Protected Overrides Sub OnMouseEnter(e As EventArgs)
  2450.         MyBase.OnMouseEnter(e)
  2451.         State = MouseState.Over : Invalidate()
  2452.     End Sub
  2453.  
  2454.     Protected Overrides Sub OnMouseLeave(e As EventArgs)
  2455.         MyBase.OnMouseLeave(e)
  2456.         State = MouseState.None : Invalidate()
  2457.     End Sub
  2458.  
  2459. #End Region
  2460.  
  2461. #Region "Properties"
  2462.  
  2463.     <Flags()>
  2464.     Enum HS
  2465.         None
  2466.         Border
  2467.         PopUp
  2468.     End Enum
  2469.  
  2470.     Private _HoverStyle As HS
  2471.     <Category("Properties")>
  2472.     Public Property HoverStyle As HS
  2473.         Get
  2474.             Return _HoverStyle
  2475.         End Get
  2476.         Set(value As HS)
  2477.             _HoverStyle = value
  2478.         End Set
  2479.     End Property
  2480.  
  2481.     Private _BorderColorIntensity As Integer = 150
  2482.     <Category("Properties")>
  2483.     Public Property BorderColorIntensity As Integer
  2484.         Get
  2485.             Return _BorderColorIntensity
  2486.         End Get
  2487.         Set(value As Integer)
  2488.             _BorderColorIntensity = value
  2489.         End Set
  2490.     End Property
  2491.  
  2492.     Event CheckedChanged(ByVal sender As Object)
  2493.     Private _Checked As Boolean
  2494.     <Category("Properties")>
  2495.     Property Checked As Boolean
  2496.         Get
  2497.             Return _Checked
  2498.         End Get
  2499.         Set(value As Boolean)
  2500.             _Checked = value
  2501.             InvalidateControls()
  2502.             RaiseEvent CheckedChanged(Me)
  2503.             Invalidate()
  2504.         End Set
  2505.     End Property
  2506.  
  2507.     Private _HoverDotIntensity As Integer = 30
  2508.     <Category("Properties")>
  2509.     Public Property HoverDotIntensity As Integer
  2510.         Get
  2511.             Return _HoverDotIntensity
  2512.         End Get
  2513.         Set(value As Integer)
  2514.             _HoverDotIntensity = value
  2515.         End Set
  2516.     End Property
  2517.  
  2518.     Private _DownDotIntensity As Integer = 50
  2519.     <Category("Properties")>
  2520.     Public Property DownDotIntensity As Integer
  2521.         Get
  2522.             Return _DownDotIntensity
  2523.         End Get
  2524.         Set(value As Integer)
  2525.             _DownDotIntensity = value
  2526.         End Set
  2527.     End Property
  2528.  
  2529.     Private _Hover As Boolean = True
  2530.     <Category("Properties")>
  2531.     Property Hover As Boolean
  2532.         Get
  2533.             Return _Hover
  2534.         End Get
  2535.         Set(ByVal value As Boolean)
  2536.             _Hover = value
  2537.             Invalidate()
  2538.         End Set
  2539.     End Property
  2540.  
  2541.     Protected Overrides Sub OnClick(e As EventArgs)
  2542.         If Not Checked Then Checked = True
  2543.         MyBase.OnClick(e)
  2544.     End Sub
  2545.  
  2546.     Private Sub InvalidateControls()
  2547.         If Not IsHandleCreated OrElse Not _Checked Then Return
  2548.         For Each CTRL As Control In Parent.Controls
  2549.             If CTRL IsNot Me AndAlso TypeOf CTRL Is RadioButton Then
  2550.                 DirectCast(CTRL, RadioButton).Checked = False
  2551.                 Invalidate()
  2552.             End If
  2553.         Next
  2554.     End Sub
  2555.  
  2556.     Protected Overrides Sub OnResize(e As EventArgs)
  2557.         MyBase.OnResize(e)
  2558.         Height = 22
  2559.     End Sub
  2560.  
  2561. #End Region
  2562.  
  2563. #Region "Color Properties"
  2564.  
  2565.     <Category("Color Properties")>
  2566.     Public Property BaseColor As Color
  2567.         Get
  2568.             Return _BaseColor
  2569.         End Get
  2570.         Set(value As Color)
  2571.             _BaseColor = value
  2572.             Invalidate()
  2573.         End Set
  2574.     End Property
  2575.  
  2576.     <Category("Color Properties")>
  2577.     Public Property DotColor As Color
  2578.         Get
  2579.             Return _DotColor
  2580.         End Get
  2581.         Set(value As Color)
  2582.             _DotColor = value
  2583.             Invalidate()
  2584.         End Set
  2585.     End Property
  2586.  
  2587.     <Category("Color Properties")>
  2588.     Public Property BorderColor As Color
  2589.         Get
  2590.             Return _BorderColor
  2591.         End Get
  2592.         Set(value As Color)
  2593.             _BorderColor = value
  2594.             Invalidate()
  2595.         End Set
  2596.     End Property
  2597.  
  2598.     <Category("Color Properties")>
  2599.     Public Property TextColor As Color
  2600.         Get
  2601.             Return _TextColor
  2602.         End Get
  2603.         Set(value As Color)
  2604.             _TextColor = value
  2605.             Invalidate()
  2606.         End Set
  2607.     End Property
  2608.  
  2609.     <Category("Color Properties")>
  2610.     Property HoverTextColor As Color
  2611.         Get
  2612.             Return _HoverTextColor
  2613.         End Get
  2614.         Set(value As Color)
  2615.             _HoverTextColor = value
  2616.             Invalidate()
  2617.         End Set
  2618.     End Property
  2619.  
  2620.     <Category("Color Properties")>
  2621.     Property DownTextColor As Color
  2622.         Get
  2623.             Return _DownTextColor
  2624.         End Get
  2625.         Set(value As Color)
  2626.             _DownTextColor = value
  2627.             Invalidate()
  2628.         End Set
  2629.     End Property
  2630.  
  2631. #End Region
  2632.  
  2633. #Region "Colors"
  2634.  
  2635.     Private _BaseColor As Color = Black
  2636.     Private _DotColor As Color = White
  2637.     Private _BorderColor As Color = White
  2638.     Private _TextColor As Color = White
  2639.     Private _HoverTextColor As Color = White
  2640.     Private _DownTextColor As Color = White
  2641.  
  2642. #End Region
  2643.  
  2644.     Sub New()
  2645.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or
  2646.                  ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer, True)
  2647.         DoubleBuffered = True
  2648.         BackColor = Gray
  2649.         Size = New Size(128, 22)
  2650.         Font = New Font("Segoe UI", 10)
  2651.         Cursor = Cursors.Hand
  2652.     End Sub
  2653.  
  2654.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  2655.         B = New Bitmap(Width, Height) : G = Graphics.FromImage(B)
  2656.         Dim Base As New Rectangle(1, 2, Height - 5, Height - 5), Dot As New Rectangle(5, 6, Height - 13, Height - 13)
  2657.         With G
  2658.             .SmoothingMode = SmoothingMode.HighQuality
  2659.             .PixelOffsetMode = PixelOffsetMode.HighSpeed
  2660.             .TextRenderingHint = TextRenderingHint.ClearTypeGridFit
  2661.             .Clear(BackColor)
  2662.             'Base
  2663.             .FillEllipse(New SolidBrush(BaseColor), Base)
  2664.             Select Case HoverStyle
  2665.                 Case HS.Border
  2666.                     'Border
  2667.                     Select Case State
  2668.                         Case MouseState.Over
  2669.                             .DrawEllipse(New Pen(Color.FromArgb(BorderColorIntensity, BorderColor)), Base)
  2670.                         Case MouseState.Down
  2671.                             .DrawEllipse(New Pen(Color.FromArgb(BorderColorIntensity, BorderColor)), Base)
  2672.                     End Select
  2673.                 Case HS.PopUp
  2674.                     'PopUp
  2675.                     Select Case State
  2676.                         Case MouseState.Over
  2677.                             .FillEllipse(New SolidBrush(BaseColor), New Rectangle(0, 1, Height - 3, Height - 3))
  2678.                         Case MouseState.Down
  2679.                             .FillEllipse(New SolidBrush(BaseColor), New Rectangle(0, 1, Height - 3, Height - 3))
  2680.                     End Select
  2681.             End Select
  2682.             'If Checked
  2683.             If Checked Then
  2684.                 .FillEllipse(New SolidBrush(DotColor), Dot)
  2685.             Else
  2686.                 If Hover Then
  2687.                     Select Case State
  2688.                         Case MouseState.Over
  2689.                             .FillEllipse(New SolidBrush(Color.FromArgb(HoverDotIntensity, DotColor)), Dot)
  2690.                         Case MouseState.Down
  2691.                             .FillEllipse(New SolidBrush(Color.FromArgb(DownDotIntensity, DotColor)), Dot)
  2692.                     End Select
  2693.                 End If
  2694.             End If
  2695.             'Text
  2696.             If Hover Then
  2697.                 Select Case State
  2698.                     Case MouseState.None
  2699.                         .DrawString(Text, Font, New SolidBrush(TextColor), New Rectangle(20, 2, Width - 1, Height - 1), Near)
  2700.                     Case MouseState.Over
  2701.                         .DrawString(Text, Font, New SolidBrush(HoverTextColor), New Rectangle(20, 2, Width - 1, Height - 1), Near)
  2702.                     Case MouseState.Down
  2703.                         .DrawString(Text, Font, New SolidBrush(DownTextColor), New Rectangle(20, 2, Width - 1, Height - 1), Near)
  2704.                 End Select
  2705.             Else
  2706.                 .DrawString(Text, Font, New SolidBrush(TextColor), New Rectangle(20, 2, Width - 1, Height - 1), Near)
  2707.             End If
  2708.         End With
  2709.         MyBase.OnPaint(e)
  2710.         G.Dispose()
  2711.         e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic
  2712.         e.Graphics.DrawImageUnscaled(B, 0, 0)
  2713.         B.Dispose()
  2714.     End Sub
  2715.  
  2716. End Class
  2717.  
  2718. Public Class CheckBox : Inherits Control
  2719.  
  2720. #Region "Variables"
  2721.  
  2722.     Private State As MouseState = MouseState.None
  2723.  
  2724. #End Region
  2725.  
  2726. #Region "Mouse States"
  2727.  
  2728.     Protected Overrides Sub OnMouseEnter(e As EventArgs)
  2729.         MyBase.OnMouseEnter(e)
  2730.         State = MouseState.Over : Invalidate()
  2731.     End Sub
  2732.  
  2733.     Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
  2734.         MyBase.OnMouseDown(e)
  2735.         State = MouseState.Down : Invalidate()
  2736.     End Sub
  2737.  
  2738.     Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
  2739.         MyBase.OnMouseUp(e)
  2740.         State = MouseState.Over : Invalidate()
  2741.     End Sub
  2742.  
  2743.     Protected Overrides Sub OnMouseLeave(e As EventArgs)
  2744.         MyBase.OnMouseLeave(e)
  2745.         State = MouseState.None : Invalidate()
  2746.     End Sub
  2747.  
  2748. #End Region
  2749.  
  2750. #Region "Properties"
  2751.  
  2752.     <Flags()>
  2753.     Enum S
  2754.         Hook
  2755.         Cross
  2756.         Rectangle
  2757.     End Enum
  2758.  
  2759.     Private _Style As S
  2760.     <Category("Properties")>
  2761.     Public Property Style As S
  2762.         Get
  2763.             Return _Style
  2764.         End Get
  2765.         Set(value As S)
  2766.             _Style = value
  2767.             Invalidate()
  2768.         End Set
  2769.     End Property
  2770.  
  2771.     Private _Checked As Boolean
  2772.     <Category("Properties")>
  2773.     Property Checked As Boolean
  2774.         Get
  2775.             Return _Checked
  2776.         End Get
  2777.         Set(ByVal value As Boolean)
  2778.             _Checked = value
  2779.             Invalidate()
  2780.         End Set
  2781.     End Property
  2782.  
  2783.     Private _HoverStyleIntensity As Integer = 30
  2784.     <Category("Properties")>
  2785.     Public Property HoverStyleIntensity As Integer
  2786.         Get
  2787.             Return _HoverStyleIntensity
  2788.         End Get
  2789.         Set(value As Integer)
  2790.             _HoverStyleIntensity = value
  2791.         End Set
  2792.     End Property
  2793.  
  2794.     Private _DownStyleIntensity As Integer = 50
  2795.     <Category("Properties")>
  2796.     Public Property DownStyleIntensity As Integer
  2797.         Get
  2798.             Return _DownStyleIntensity
  2799.         End Get
  2800.         Set(value As Integer)
  2801.             _DownStyleIntensity = value
  2802.         End Set
  2803.     End Property
  2804.  
  2805.     Private _Hover As Boolean = True
  2806.     <Category("Properties")>
  2807.     Property Hover As Boolean
  2808.         Get
  2809.             Return _Hover
  2810.         End Get
  2811.         Set(ByVal value As Boolean)
  2812.             _Hover = value
  2813.             Invalidate()
  2814.         End Set
  2815.     End Property
  2816.  
  2817.     Event CheckedChanged(ByVal sender As Object)
  2818.     Protected Overrides Sub OnClick(ByVal e As EventArgs)
  2819.         Checked = Not Checked
  2820.         RaiseEvent CheckedChanged(Me)
  2821.         MyBase.OnClick(e)
  2822.     End Sub
  2823.  
  2824.     Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
  2825.         MyBase.OnTextChanged(e)
  2826.         Invalidate()
  2827.     End Sub
  2828.  
  2829.     Protected Overrides Sub OnResize(e As EventArgs)
  2830.         MyBase.OnResize(e)
  2831.         Height = 22
  2832.     End Sub
  2833.  
  2834. #End Region
  2835.  
  2836. #Region "Color Properties"
  2837.  
  2838.     <Category("Color Properties")>
  2839.     Public Property BaseColor As Color
  2840.         Get
  2841.             Return _BaseColor
  2842.         End Get
  2843.         Set(value As Color)
  2844.             _BaseColor = value
  2845.             Invalidate()
  2846.         End Set
  2847.     End Property
  2848.  
  2849.     <Category("Color Properties")>
  2850.     Public Property CheckedColor As Color
  2851.         Get
  2852.             Return _CheckedColor
  2853.         End Get
  2854.         Set(value As Color)
  2855.             _CheckedColor = value
  2856.             Invalidate()
  2857.         End Set
  2858.     End Property
  2859.  
  2860.     <Category("Color Properties")>
  2861.     Public Property TextColor As Color
  2862.         Get
  2863.             Return _TextColor
  2864.         End Get
  2865.         Set(value As Color)
  2866.             _TextColor = value
  2867.             Invalidate()
  2868.         End Set
  2869.     End Property
  2870.  
  2871.     <Category("Color Properties")>
  2872.     Property HoverTextColor As Color
  2873.         Get
  2874.             Return _HoverTextColor
  2875.         End Get
  2876.         Set(value As Color)
  2877.             _HoverTextColor = value
  2878.             Invalidate()
  2879.         End Set
  2880.     End Property
  2881.  
  2882.     <Category("Color Properties")>
  2883.     Property DownTextColor As Color
  2884.         Get
  2885.             Return _DownTextColor
  2886.         End Get
  2887.         Set(value As Color)
  2888.             _DownTextColor = value
  2889.             Invalidate()
  2890.         End Set
  2891.     End Property
  2892.  
  2893. #End Region
  2894.  
  2895. #Region "Colors"
  2896.  
  2897.     Private _BaseColor As Color = Black
  2898.     Private _CheckedColor As Color = White
  2899.     Private _TextColor As Color = White
  2900.     Private _HoverTextColor As Color = White
  2901.     Private _DownTextColor As Color = White
  2902.  
  2903. #End Region
  2904.  
  2905.     Sub New()
  2906.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or
  2907.                  ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer, True)
  2908.         DoubleBuffered = True
  2909.         BackColor = Gray
  2910.         Size = New Size(128, 22)
  2911.         Font = New Font("Segoe UI", 10)
  2912.         Cursor = Cursors.Hand
  2913.     End Sub
  2914.  
  2915.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  2916.         B = New Bitmap(Width, Height) : G = Graphics.FromImage(B)
  2917.         With G
  2918.             .SmoothingMode = SmoothingMode.HighQuality
  2919.             .PixelOffsetMode = PixelOffsetMode.HighQuality
  2920.             .TextRenderingHint = TextRenderingHint.ClearTypeGridFit
  2921.             .Clear(BackColor)
  2922.             'Base
  2923.             If Style = S.Cross Then
  2924.                 .FillRectangle(New SolidBrush(BaseColor), New Rectangle(0, 2, Height - 6, Height - 5))
  2925.             Else
  2926.                 .FillRectangle(New SolidBrush(BaseColor), New Rectangle(0, 2, Height - 5, Height - 5))
  2927.             End If
  2928.             'If Checked
  2929.             Select Case Style
  2930.                 Case S.Hook
  2931.                     If Checked Then
  2932.                         Dim Polygon() As Point = {New Point(2, 12), New Point(4, 9), New Point(7, 13), New Point(13, 4), New Point(15, 7), New Point(7, 17)}
  2933.                         .FillPolygon(New SolidBrush(CheckedColor), Polygon)
  2934.                     Else
  2935.                         If Hover Then
  2936.                             Select Case State
  2937.                                 Case MouseState.Over
  2938.                                     Dim Polygon() As Point = {New Point(2, 12), New Point(4, 9), New Point(7, 13), New Point(13, 4), New Point(15, 7), New Point(7, 17)}
  2939.                                     .FillPolygon(New SolidBrush(Color.FromArgb(HoverStyleIntensity, CheckedColor)), Polygon)
  2940.                                 Case MouseState.Down
  2941.                                     Dim Polygon() As Point = {New Point(2, 12), New Point(4, 9), New Point(7, 13), New Point(13, 4), New Point(15, 7), New Point(7, 17)}
  2942.                                     .FillPolygon(New SolidBrush(Color.FromArgb(DownStyleIntensity, CheckedColor)), Polygon)
  2943.                             End Select
  2944.                         End If
  2945.                     End If
  2946.                 Case S.Cross
  2947.                     If Checked Then
  2948.                         .DrawString("r", New Font("Webdings", 12), New SolidBrush(CheckedColor), New Rectangle(-2, 0, Height, Height))
  2949.                     Else
  2950.                         If Hover Then
  2951.                             Select Case State
  2952.                                 Case MouseState.Over
  2953.                                     .DrawString("r", New Font("Webdings", 12), New SolidBrush(Color.FromArgb(HoverStyleIntensity, CheckedColor)), New Rectangle(-2, 0, Height, Height))
  2954.                                 Case MouseState.Down
  2955.                                     .DrawString("r", New Font("Webdings", 12), New SolidBrush(Color.FromArgb(DownStyleIntensity, CheckedColor)), New Rectangle(-2, 0, Height, Height))
  2956.                             End Select
  2957.                         End If
  2958.                     End If
  2959.                 Case S.Rectangle
  2960.                     If Checked Then
  2961.                         .FillRectangle(New SolidBrush(CheckedColor), New Rectangle(3, 5, Height - 11, Height - 11))
  2962.                     Else
  2963.                         If Hover Then
  2964.                             Select Case State
  2965.                                 Case MouseState.Over
  2966.                                     .FillRectangle(New SolidBrush(Color.FromArgb(HoverStyleIntensity, CheckedColor)), New Rectangle(3, 5, Height - 11, Height - 11))
  2967.                                 Case MouseState.Down
  2968.                                     .FillRectangle(New SolidBrush(Color.FromArgb(DownStyleIntensity, CheckedColor)), New Rectangle(3, 5, Height - 11, Height - 11))
  2969.                             End Select
  2970.                         End If
  2971.                     End If
  2972.             End Select
  2973.             'Text
  2974.             If Style = S.Cross Then
  2975.                 .DrawString(Text, Font, New SolidBrush(TextColor), New Rectangle(18, 1, Width, Height), Near)
  2976.             Else
  2977.                 .DrawString(Text, Font, New SolidBrush(TextColor), New Rectangle(19, 1, Width, Height), Near)
  2978.             End If
  2979.         End With
  2980.         MyBase.OnPaint(e)
  2981.         G.Dispose()
  2982.         e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic
  2983.         e.Graphics.DrawImageUnscaled(B, 0, 0)
  2984.         B.Dispose()
  2985.     End Sub
  2986.  
  2987. End Class
  2988.  
  2989. Public Class TextBox : Inherits Control
  2990.  
  2991. #Region "Variables"
  2992.  
  2993.     Private State As MouseState = MouseState.None
  2994.     Private WithEvents CTRL As Windows.Forms.TextBox
  2995.  
  2996. #End Region
  2997.  
  2998. #Region "Mouse States"
  2999.  
  3000.     Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
  3001.         MyBase.OnMouseDown(e)
  3002.         State = MouseState.Down : Invalidate()
  3003.     End Sub
  3004.  
  3005.     Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
  3006.         MyBase.OnMouseUp(e)
  3007.         State = MouseState.Over : Invalidate()
  3008.     End Sub
  3009.  
  3010.     Protected Overrides Sub OnMouseLeave(e As EventArgs)
  3011.         MyBase.OnMouseLeave(e)
  3012.         State = MouseState.None : Invalidate()
  3013.     End Sub
  3014.  
  3015. #End Region
  3016.  
  3017. #Region "Properties"
  3018.  
  3019.     Private _TextAlignment As HorizontalAlignment = HorizontalAlignment.Left
  3020.     <Category("Properties")>
  3021.     Property TextAlignment As HorizontalAlignment
  3022.         Get
  3023.             Return _TextAlignment
  3024.         End Get
  3025.         Set(ByVal value As HorizontalAlignment)
  3026.             _TextAlignment = value
  3027.             If CTRL IsNot Nothing Then
  3028.                 CTRL.TextAlign = value
  3029.             End If
  3030.             Invalidate()
  3031.         End Set
  3032.     End Property
  3033.  
  3034.     Private _Rounded As Boolean = False
  3035.     <Category("Properties")>
  3036.     Public Property Rounded As Boolean
  3037.         Get
  3038.             Return _Rounded
  3039.         End Get
  3040.         Set(value As Boolean)
  3041.             _Rounded = value
  3042.             Invalidate()
  3043.         End Set
  3044.     End Property
  3045.  
  3046.     Private _Rounding As Integer = 14
  3047.     <Category("Properties")>
  3048.     Public Property Rounding As Integer
  3049.         Get
  3050.             Return _Rounding
  3051.         End Get
  3052.         Set(value As Integer)
  3053.             _Rounding = value
  3054.             Invalidate()
  3055.         End Set
  3056.     End Property
  3057.  
  3058.     Private _Border As Boolean = True
  3059.     <Category("Properties")>
  3060.     Public Property Border As Boolean
  3061.         Get
  3062.             Return _Border
  3063.         End Get
  3064.         Set(value As Boolean)
  3065.             _Border = value
  3066.             Invalidate()
  3067.         End Set
  3068.     End Property
  3069.  
  3070.     Private _MaxLength As Integer = 32767
  3071.     <Category("Properties")>
  3072.     Property MaxLength As Integer
  3073.         Get
  3074.             Return _MaxLength
  3075.         End Get
  3076.         Set(ByVal value As Integer)
  3077.             _MaxLength = value
  3078.             If CTRL IsNot Nothing Then
  3079.                 CTRL.MaxLength = value
  3080.             End If
  3081.             Invalidate()
  3082.         End Set
  3083.     End Property
  3084.  
  3085.     Private _ReadOnly As Boolean
  3086.     <Category("Properties")>
  3087.     Property [ReadOnly] As Boolean
  3088.         Get
  3089.             Return _ReadOnly
  3090.         End Get
  3091.         Set(ByVal value As Boolean)
  3092.             _ReadOnly = value
  3093.             If CTRL IsNot Nothing Then
  3094.                 CTRL.ReadOnly = value
  3095.             End If
  3096.             Invalidate()
  3097.         End Set
  3098.     End Property
  3099.  
  3100.     Private _UseSystemPasswordChar As Boolean
  3101.     <Category("Properties")>
  3102.     Property UseSystemPasswordChar As Boolean
  3103.         Get
  3104.             Return _UseSystemPasswordChar
  3105.         End Get
  3106.         Set(ByVal value As Boolean)
  3107.             _UseSystemPasswordChar = value
  3108.             If CTRL IsNot Nothing Then
  3109.                 CTRL.UseSystemPasswordChar = value
  3110.             End If
  3111.             Invalidate()
  3112.         End Set
  3113.     End Property
  3114.  
  3115.     Private _Multiline As Boolean
  3116.     <Category("Properties")>
  3117.     Property Multiline As Boolean
  3118.         Get
  3119.             Return _Multiline
  3120.         End Get
  3121.         Set(ByVal value As Boolean)
  3122.             _Multiline = value
  3123.             If CTRL IsNot Nothing Then
  3124.                 CTRL.Multiline = value
  3125.                 If value Then
  3126.                     CTRL.Height = Height - 14
  3127.                 Else
  3128.                     Height = CTRL.Height + 14
  3129.                 End If
  3130.             End If
  3131.             Invalidate()
  3132.         End Set
  3133.     End Property
  3134.  
  3135.     <Category("Properties")>
  3136.     Overrides Property Text As String
  3137.         Get
  3138.             Return MyBase.Text
  3139.         End Get
  3140.         Set(ByVal value As String)
  3141.             MyBase.Text = value
  3142.             If CTRL IsNot Nothing Then
  3143.                 CTRL.Text = value
  3144.             End If
  3145.             Invalidate()
  3146.         End Set
  3147.     End Property
  3148.  
  3149.     <Category("Properties")>
  3150.     Overrides Property Font As Font
  3151.         Get
  3152.             Return MyBase.Font
  3153.         End Get
  3154.         Set(ByVal value As Font)
  3155.             MyBase.Font = value
  3156.             If CTRL IsNot Nothing Then
  3157.                 CTRL.Font = value
  3158.                 CTRL.Location = New Point(3, 5)
  3159.                 CTRL.Width = Width - 6
  3160.                 If Not _Multiline Then
  3161.                     Height = CTRL.Height + 14
  3162.                 End If
  3163.             End If
  3164.             Invalidate()
  3165.         End Set
  3166.     End Property
  3167.  
  3168.     Protected Overrides Sub OnCreateControl()
  3169.         MyBase.OnCreateControl()
  3170.         If Not Controls.Contains(CTRL) Then
  3171.             Controls.Add(CTRL)
  3172.         End If
  3173.     End Sub
  3174.  
  3175.     Private Sub OnBaseTextChanged(ByVal s As Object, ByVal e As EventArgs)
  3176.         Text = CTRL.Text
  3177.     End Sub
  3178.  
  3179.     Private Sub OnBaseKeyDown(ByVal s As Object, ByVal e As KeyEventArgs)
  3180.         If e.Control AndAlso e.KeyCode = Keys.A Then
  3181.             CTRL.SelectAll()
  3182.             e.SuppressKeyPress = True
  3183.         End If
  3184.         If e.Control AndAlso e.KeyCode = Keys.C Then
  3185.             CTRL.Copy()
  3186.             e.SuppressKeyPress = True
  3187.         End If
  3188.     End Sub
  3189.  
  3190.     Protected Overrides Sub OnResize(ByVal e As EventArgs)
  3191.         CTRL.Location = New Point(7, 7)
  3192.         CTRL.Width = Width - 15
  3193.         If _Multiline Then
  3194.             CTRL.Height = Height - 14
  3195.         Else
  3196.             Height = CTRL.Height + 14
  3197.         End If
  3198.         MyBase.OnResize(e)
  3199.     End Sub
  3200.  
  3201. #End Region
  3202.  
  3203. #Region "Color Properties"
  3204.  
  3205.     <Category("Color Properties")>
  3206.     Public Property BaseColor As Color
  3207.         Get
  3208.             Return _BaseColor
  3209.         End Get
  3210.         Set(value As Color)
  3211.             _BaseColor = value
  3212.             Invalidate()
  3213.         End Set
  3214.     End Property
  3215.  
  3216.     <Category("Color Properties")>
  3217.     Public Property BorderColor() As Color
  3218.         Get
  3219.             Return _BorderColor
  3220.         End Get
  3221.         Set(value As Color)
  3222.             _BorderColor = value
  3223.             Invalidate()
  3224.         End Set
  3225.     End Property
  3226.  
  3227.     <Category("Color Properties")>
  3228.     Public Property TextColor As Color
  3229.         Get
  3230.             Return _TextColor
  3231.         End Get
  3232.         Set(value As Color)
  3233.             _TextColor = value
  3234.             Invalidate()
  3235.         End Set
  3236.     End Property
  3237.  
  3238. #End Region
  3239.  
  3240. #Region "Colors"
  3241.  
  3242.     Private _BaseColor As Color = Black
  3243.     Private _BorderColor As Color = White
  3244.     Private _TextColor As Color = White
  3245.  
  3246. #End Region
  3247.  
  3248.     Sub New()
  3249.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or
  3250.                  ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer, True)
  3251.         DoubleBuffered = True
  3252.         BackColor = Gray
  3253.         CTRL = New System.Windows.Forms.TextBox
  3254.         CTRL.Font = New Font("Segoe UI", 10)
  3255.         CTRL.Cursor = Cursors.IBeam
  3256.         CTRL.BorderStyle = BorderStyle.None
  3257.         CTRL.Text = Text
  3258.         CTRL.MaxLength = _MaxLength
  3259.         CTRL.Multiline = _Multiline
  3260.         CTRL.ReadOnly = _ReadOnly
  3261.         CTRL.UseSystemPasswordChar = _UseSystemPasswordChar
  3262.         AddHandler CTRL.TextChanged, AddressOf OnBaseTextChanged
  3263.         AddHandler CTRL.KeyDown, AddressOf OnBaseKeyDown
  3264.     End Sub
  3265.  
  3266.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  3267.         B = New Bitmap(Width, Height) : G = Graphics.FromImage(B)
  3268.         Dim Base As New Rectangle(0, 0, Width, Height)
  3269.         With G
  3270.             .SmoothingMode = SmoothingMode.HighQuality
  3271.             .PixelOffsetMode = PixelOffsetMode.HighQuality
  3272.             .TextRenderingHint = TextRenderingHint.ClearTypeGridFit
  3273.             .Clear(BackColor)
  3274.             'Base
  3275.             If Rounded Then
  3276.                 .FillPath(New SolidBrush(BaseColor), Support.rRectangle(Base, Rounding))
  3277.             Else
  3278.                 .FillRectangle(New SolidBrush(BaseColor), Base)
  3279.             End If
  3280.             CTRL.BackColor = BaseColor
  3281.             'Text Color
  3282.             CTRL.ForeColor = TextColor
  3283.             'Border
  3284.             If Rounded Then : Else
  3285.                 If Border Then
  3286.                     .DrawRectangle(New Pen(BorderColor), Base)
  3287.                 End If
  3288.             End If
  3289.         End With
  3290.         MyBase.OnPaint(e)
  3291.         G.Dispose()
  3292.         e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic
  3293.         e.Graphics.DrawImageUnscaled(B, 0, 0)
  3294.         B.Dispose()
  3295.     End Sub
  3296.  
  3297. End Class
  3298.  
  3299. Public Class TabControl : Inherits Windows.Forms.TabControl
  3300.  
  3301. #Region "Properties"
  3302.  
  3303.     <Flags()>
  3304.     Enum S
  3305.         ActiveLine
  3306.         Normal
  3307.         Shiny
  3308.     End Enum
  3309.  
  3310.     Private _ActiveStyle As S
  3311.     <Category("Properties")>
  3312.     Public Property ActiveStyle As S
  3313.         Get
  3314.             Return _ActiveStyle
  3315.         End Get
  3316.         Set(value As S)
  3317.             _ActiveStyle = value
  3318.             Invalidate()
  3319.         End Set
  3320.     End Property
  3321.  
  3322.     Private _ActiveLineThickness As Single = 4
  3323.     <Category("Properties")>
  3324.     Public Property ActiveLineThickness As Single
  3325.         Get
  3326.             Return _ActiveLineThickness
  3327.         End Get
  3328.         Set(value As Single)
  3329.             _ActiveLineThickness = value
  3330.             Invalidate()
  3331.         End Set
  3332.     End Property
  3333.  
  3334.     Private _ShinyIntensity As Integer = 15
  3335.     <Category("Properties")>
  3336.     Public Property ShinyIntensity As Integer
  3337.         Get
  3338.             Return _ShinyIntensity
  3339.         End Get
  3340.         Set(value As Integer)
  3341.             _ShinyIntensity = value
  3342.             Invalidate()
  3343.         End Set
  3344.     End Property
  3345.  
  3346.     Protected Overrides Sub CreateHandle()
  3347.         MyBase.CreateHandle()
  3348.         Alignment = TabAlignment.Top
  3349.     End Sub
  3350.  
  3351. #End Region
  3352.  
  3353. #Region "Color Properties"
  3354.  
  3355.     <Category("Color Properties")>
  3356.     Public Property BackgroundColor As Color
  3357.         Get
  3358.             Return _BackgroundColor
  3359.         End Get
  3360.         Set(value As Color)
  3361.             _BackgroundColor = value
  3362.             Invalidate()
  3363.         End Set
  3364.     End Property
  3365.  
  3366.     <Category("Color Properties")>
  3367.     Public Property BaseColor As Color
  3368.         Get
  3369.             Return _BaseColor
  3370.         End Get
  3371.         Set(value As Color)
  3372.             _BaseColor = value
  3373.             Invalidate()
  3374.         End Set
  3375.     End Property
  3376.  
  3377.     <Category("Color Properties")>
  3378.     Public Property ActiveColor As Color
  3379.         Get
  3380.             Return _ActiveColor
  3381.         End Get
  3382.         Set(value As Color)
  3383.             _ActiveColor = value
  3384.             Invalidate()
  3385.         End Set
  3386.     End Property
  3387.  
  3388.     <Category("Color Properties")>
  3389.     Public Property ActiveLineColor As Color
  3390.         Get
  3391.             Return _ActiveLineColor
  3392.         End Get
  3393.         Set(value As Color)
  3394.             _ActiveLineColor = value
  3395.             Invalidate()
  3396.         End Set
  3397.     End Property
  3398.  
  3399.     <Category("Color Properties")>
  3400.     Public Property TextColor As Color
  3401.         Get
  3402.             Return _TextColor
  3403.         End Get
  3404.         Set(value As Color)
  3405.             _TextColor = value
  3406.             Invalidate()
  3407.         End Set
  3408.     End Property
  3409.  
  3410.     <Category("Color Properties")>
  3411.     Public Property ShinyColor As Color
  3412.         Get
  3413.             Return _ShinyColor
  3414.         End Get
  3415.         Set(value As Color)
  3416.             _ShinyColor = value
  3417.             Invalidate()
  3418.         End Set
  3419.     End Property
  3420.  
  3421. #End Region
  3422.  
  3423. #Region "Colors"
  3424.  
  3425.     Private _BaseColor As Color = Black
  3426.     Private _BackgroundColor As Color = Gray
  3427.     Private _ActiveColor As Color = Black
  3428.     Private _ActiveLineColor As Color = White
  3429.     Private _TextColor As Color = White
  3430.     Private _ShinyColor As Color = White
  3431.  
  3432. #End Region
  3433.  
  3434.     Sub New()
  3435.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or
  3436.                  ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer, True)
  3437.         DoubleBuffered = True
  3438.         BackColor = Gray
  3439.         Font = New Font("Segoe UI", 10)
  3440.         SizeMode = TabSizeMode.Fixed
  3441.         ItemSize = New Size(120, 40)
  3442.         Size = New Size(512, 256)
  3443.     End Sub
  3444.  
  3445.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  3446.         B = New Bitmap(Width, Height) : G = Graphics.FromImage(B)
  3447.         With G
  3448.             .SmoothingMode = SmoothingMode.HighQuality
  3449.             .PixelOffsetMode = PixelOffsetMode.HighQuality
  3450.             .TextRenderingHint = TextRenderingHint.ClearTypeGridFit
  3451.             .Clear(BaseColor)
  3452.             Try : SelectedTab.BackColor = BackgroundColor : Catch : End Try
  3453.             For i = 0 To TabCount - 1
  3454.                 Dim Base As New Rectangle(New Point(GetTabRect(i).Location.X + 2, GetTabRect(i).Location.Y - 2), New Size(GetTabRect(i).Width, GetTabRect(i).Height + 4))
  3455.                 Dim Base1 As New Rectangle(New Point(GetTabRect(i).Location.X + 2, CInt(GetTabRect(i).Location.Y - ActiveLineThickness)), New Size(GetTabRect(i).Width, GetTabRect(i).Height + 4))
  3456.                 Dim BaseSize As New Rectangle(Base.Location, New Size(Base.Width, Base.Height))
  3457.                 Dim BaseSize1 As New Rectangle(Base1.Location, New Size(Base1.Width, Base1.Height))
  3458.                 If i = SelectedIndex Then
  3459.                     'Base
  3460.                     .FillRectangle(New SolidBrush(BaseColor), BaseSize)
  3461.                     Select Case ActiveStyle
  3462.                         Case S.ActiveLine
  3463.                             'Active Line
  3464.                             .FillRectangle(New SolidBrush(ActiveLineColor), BaseSize)
  3465.                             'TabRectangle
  3466.                             .FillRectangle(New SolidBrush(ActiveColor), BaseSize1)
  3467.                         Case Else
  3468.                             'TabRectangle
  3469.                             .FillRectangle(New SolidBrush(ActiveColor), BaseSize)
  3470.                     End Select
  3471.                     Select Case ActiveStyle
  3472.                         Case S.Shiny
  3473.                             .FillRectangle(New SolidBrush(Color.FromArgb(ShinyIntensity, ShinyColor)), New Rectangle(Base.Location, New Size(Base.Width, CInt(Base.Height / 2))))
  3474.                     End Select
  3475.                     'ImageList
  3476.                     If ImageList IsNot Nothing Then
  3477.                         Try
  3478.                             If ImageList.Images(TabPages(i).ImageIndex) IsNot Nothing Then
  3479.                                 'Image
  3480.                                 .DrawImage(ImageList.Images(TabPages(i).ImageIndex), New Point(BaseSize.Location.X + 8, BaseSize.Location.Y + 6))
  3481.                                 'Text
  3482.                                 .DrawString("      " & TabPages(i).Text, Font, New SolidBrush(TextColor), BaseSize, Center)
  3483.                             Else
  3484.                                 'Text
  3485.                                 Select Case ActiveStyle
  3486.                                     Case S.ActiveLine
  3487.                                         .DrawString(TabPages(i).Text, Font, New SolidBrush(TextColor), BaseSize1, Center)
  3488.                                     Case Else
  3489.                                         .DrawString(TabPages(i).Text, Font, New SolidBrush(TextColor), BaseSize, Center)
  3490.                                 End Select
  3491.                             End If
  3492.                         Catch ex As Exception
  3493.                             Throw New Exception(ex.Message)
  3494.                         End Try
  3495.                     Else
  3496.                         'Text
  3497.                         Select Case ActiveStyle
  3498.                             Case S.ActiveLine
  3499.                                 .DrawString(TabPages(i).Text, Font, New SolidBrush(TextColor), BaseSize1, Center)
  3500.                             Case Else
  3501.                                 .DrawString(TabPages(i).Text, Font, New SolidBrush(TextColor), BaseSize, Center)
  3502.                         End Select
  3503.                     End If
  3504.                 Else
  3505.                     'Base
  3506.                     .FillRectangle(New SolidBrush(BaseColor), BaseSize)
  3507.                     'ImageList
  3508.                     If ImageList IsNot Nothing Then
  3509.                         Try
  3510.                             If ImageList.Images(TabPages(i).ImageIndex) IsNot Nothing Then
  3511.                                 'Image
  3512.                                 .DrawImage(ImageList.Images(TabPages(i).ImageIndex), New Point(BaseSize.Location.X + 8, BaseSize.Location.Y + 6))
  3513.                                 'Text
  3514.                                 .DrawString("      " & TabPages(i).Text, Font, New SolidBrush(TextColor), BaseSize, New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
  3515.                             Else
  3516.                                 'Text
  3517.                                 Select Case ActiveStyle
  3518.                                     Case S.ActiveLine
  3519.                                         .DrawString(TabPages(i).Text, Font, New SolidBrush(TextColor), BaseSize1, New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
  3520.                                     Case Else
  3521.                                         .DrawString(TabPages(i).Text, Font, New SolidBrush(TextColor), BaseSize, New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
  3522.                                 End Select
  3523.                             End If
  3524.                         Catch ex As Exception
  3525.                             Throw New Exception(ex.Message)
  3526.                         End Try
  3527.                     Else
  3528.                         'Text
  3529.                         Select Case ActiveStyle
  3530.                             Case S.ActiveLine
  3531.                                 .DrawString(TabPages(i).Text, Font, New SolidBrush(TextColor), BaseSize1, New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
  3532.                             Case Else
  3533.                                 .DrawString(TabPages(i).Text, Font, New SolidBrush(TextColor), BaseSize, New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
  3534.                         End Select
  3535.                     End If
  3536.                 End If
  3537.             Next
  3538.         End With
  3539.         MyBase.OnPaint(e)
  3540.         G.Dispose()
  3541.         e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic
  3542.         e.Graphics.DrawImageUnscaled(B, 0, 0)
  3543.         B.Dispose()
  3544.     End Sub
  3545.  
  3546. End Class
  3547.  
  3548. Public Class ProgressBar : Inherits Control
  3549.  
  3550. #Region "Properties"
  3551.  
  3552.     <Flags()>
  3553.     Enum VTP
  3554.         Left
  3555.         Center
  3556.         Right
  3557.     End Enum
  3558.  
  3559.     <Flags()>
  3560.     Enum SVT
  3561.         Value
  3562.         Text
  3563.     End Enum
  3564.  
  3565.     <Flags()>
  3566.     Enum S
  3567.         Normal
  3568.         ColorBlend
  3569.     End Enum
  3570.  
  3571.     Private _ValueTextPosition As VTP
  3572.     <Category("Properties")>
  3573.     Public Property ValueTextPosition As VTP
  3574.         Get
  3575.             Return _ValueTextPosition
  3576.         End Get
  3577.         Set(value As VTP)
  3578.             _ValueTextPosition = value
  3579.             Invalidate()
  3580.         End Set
  3581.     End Property
  3582.  
  3583.     Private _ShowValueOrText As SVT
  3584.     <Category("Properties")>
  3585.     Public Property ShowValueOrText As SVT
  3586.         Get
  3587.             Return _ShowValueOrText
  3588.         End Get
  3589.         Set(value As SVT)
  3590.             _ShowValueOrText = value
  3591.             Invalidate()
  3592.         End Set
  3593.     End Property
  3594.  
  3595.     Private _Style As S
  3596.     <Category("Properties")>
  3597.     Public Property Style As S
  3598.         Get
  3599.             Return _Style
  3600.         End Get
  3601.         Set(value As S)
  3602.             _Style = value
  3603.             Invalidate()
  3604.         End Set
  3605.     End Property
  3606.  
  3607.     Private _ShowValuePercent As Boolean = True
  3608.     <Category("Properties")>
  3609.     Public Property ShowValuePercent As Boolean
  3610.         Get
  3611.             Return _ShowValuePercent
  3612.         End Get
  3613.         Set(value As Boolean)
  3614.             _ShowValuePercent = value
  3615.             Invalidate()
  3616.         End Set
  3617.     End Property
  3618.  
  3619.     Private _Maximum As Integer = 100
  3620.     <Category("Properties")>
  3621.     Public Property Maximum As Integer
  3622.         Get
  3623.             Return _Maximum
  3624.         End Get
  3625.         Set(v As Integer)
  3626.             Select Case v
  3627.                 Case Is < _Value
  3628.                     _Value = v
  3629.             End Select
  3630.             _Maximum = v
  3631.             Invalidate()
  3632.         End Set
  3633.     End Property
  3634.  
  3635.     Private _Value As Integer = 0
  3636.     <Category("Properties")>
  3637.     Public Property Value As Integer
  3638.         Get
  3639.             Select Case _Value
  3640.                 Case 0
  3641.                     Return 0
  3642.                     Invalidate()
  3643.                 Case Else
  3644.                     Return _Value
  3645.                     Invalidate()
  3646.             End Select
  3647.         End Get
  3648.         Set(v As Integer)
  3649.             Select Case v
  3650.                 Case Is > _Maximum
  3651.                     v = _Maximum
  3652.                     Invalidate()
  3653.             End Select
  3654.             _Value = v
  3655.             Invalidate()
  3656.         End Set
  3657.     End Property
  3658.  
  3659.     Public Sub Increment(ByVal Amount As Integer)
  3660.         Value += Amount
  3661.     End Sub
  3662.  
  3663.     Private _Border As Boolean = True
  3664.     <Category("Properties")>
  3665.     Public Property Border As Boolean
  3666.         Get
  3667.             Return _Border
  3668.         End Get
  3669.         Set(value As Boolean)
  3670.             _Border = value
  3671.             Invalidate()
  3672.         End Set
  3673.     End Property
  3674.  
  3675.     Private _Shiny As Boolean = True
  3676.     <Category("Properties")>
  3677.     Public Property Shiny As Boolean
  3678.         Get
  3679.             Return _Shiny
  3680.         End Get
  3681.         Set(value As Boolean)
  3682.             _Shiny = value
  3683.             Invalidate()
  3684.         End Set
  3685.     End Property
  3686.  
  3687.     Private _ShinyIntensity As Integer = 30
  3688.     <Category("Properties")>
  3689.     Public Property ShinyIntensity As Integer
  3690.         Get
  3691.             Return _ShinyIntensity
  3692.         End Get
  3693.         Set(value As Integer)
  3694.             _ShinyIntensity = value
  3695.             Invalidate()
  3696.         End Set
  3697.     End Property
  3698.  
  3699. #End Region
  3700.  
  3701. #Region "Color Properties"
  3702.  
  3703.     <Category("Color Properties")>
  3704.     Public Property BaseColor As Color
  3705.         Get
  3706.             Return _BaseColor
  3707.         End Get
  3708.         Set(value As Color)
  3709.             _BaseColor = value
  3710.             Invalidate()
  3711.         End Set
  3712.     End Property
  3713.  
  3714.     <Category("Color Properties")>
  3715.     Public Property ProgressColor As Color
  3716.         Get
  3717.             Return _ProgressColor
  3718.         End Get
  3719.         Set(value As Color)
  3720.             _ProgressColor = value
  3721.             Invalidate()
  3722.         End Set
  3723.     End Property
  3724.  
  3725.     <Category("Color Properties")>
  3726.     Public Property ColorBlend1 As Color
  3727.         Get
  3728.             Return _ColorBlend1
  3729.         End Get
  3730.         Set(value As Color)
  3731.             _ColorBlend1 = value
  3732.             Invalidate()
  3733.         End Set
  3734.     End Property
  3735.  
  3736.     <Category("Color Properties")>
  3737.     Public Property ColorBlend2 As Color
  3738.         Get
  3739.             Return _ColorBlend2
  3740.         End Get
  3741.         Set(value As Color)
  3742.             _ColorBlend2 = value
  3743.             Invalidate()
  3744.         End Set
  3745.     End Property
  3746.  
  3747.     <Category("Color Properties")>
  3748.     Public Property ColorBlend3 As Color
  3749.         Get
  3750.             Return _ColorBlend3
  3751.         End Get
  3752.         Set(value As Color)
  3753.             _ColorBlend3 = value
  3754.             Invalidate()
  3755.         End Set
  3756.     End Property
  3757.  
  3758.     <Category("Color Properties")>
  3759.     Public Property ColorBlend4 As Color
  3760.         Get
  3761.             Return _ColorBlend4
  3762.         End Get
  3763.         Set(value As Color)
  3764.             _ColorBlend4 = value
  3765.             Invalidate()
  3766.         End Set
  3767.     End Property
  3768.  
  3769.     <Category("Color Properties")>
  3770.     Public Property ValueTextColor As Color
  3771.         Get
  3772.             Return _ValueTextColor
  3773.         End Get
  3774.         Set(value As Color)
  3775.             _ValueTextColor = value
  3776.             Invalidate()
  3777.         End Set
  3778.     End Property
  3779.  
  3780.     <Category("Color Properties")>
  3781.     Public Property BorderColor As Color
  3782.         Get
  3783.             Return _BorderColor
  3784.         End Get
  3785.         Set(value As Color)
  3786.             _BorderColor = value
  3787.             Invalidate()
  3788.         End Set
  3789.     End Property
  3790.  
  3791.     <Category("Color Properties")>
  3792.     Public Property ShinyColor As Color
  3793.         Get
  3794.             Return _ShinyColor
  3795.         End Get
  3796.         Set(value As Color)
  3797.             _ShinyColor = value
  3798.             Invalidate()
  3799.         End Set
  3800.     End Property
  3801.  
  3802. #End Region
  3803.  
  3804. #Region "Colors"
  3805.  
  3806.     Private _BaseColor As Color = Black
  3807.     Private _ProgressColor As Color = Green
  3808.     Private _ColorBlend1 As Color = Orange
  3809.     Private _ColorBlend2 As Color = Red
  3810.     Private _ColorBlend3 As Color = Green
  3811.     Private _ColorBlend4 As Color = Blue
  3812.     Private _ValueTextColor As Color = White
  3813.     Private _BorderColor As Color = Black
  3814.     Private _ShinyColor As Color = White
  3815.  
  3816. #End Region
  3817.  
  3818.     Sub New()
  3819.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or
  3820.                  ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer, True)
  3821.         DoubleBuffered = True
  3822.         BackColor = Gray
  3823.         Size = New Size(256, 28)
  3824.     End Sub
  3825.  
  3826.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  3827.         B = New Bitmap(Width, Height) : G = Graphics.FromImage(B)
  3828.         Dim Base As New Rectangle(0, 0, Width, Height)
  3829.         Dim ProgressColorBlend As New ColorBlend(4), ProgressBrush As New LinearGradientBrush(Base, Color.Black, Color.Black, 0.0F)
  3830.         With G
  3831.             .SmoothingMode = SmoothingMode.HighQuality
  3832.             .PixelOffsetMode = PixelOffsetMode.HighQuality
  3833.             .TextRenderingHint = TextRenderingHint.ClearTypeGridFit
  3834.             .Clear(BackColor)
  3835.             'Progress Value
  3836.             Dim cValue As Double = Value / Maximum * Width
  3837.             'ColorBlend
  3838.             If Style = S.ColorBlend Then
  3839.                 Dim Colors() As Color = {ColorBlend1, ColorBlend2, ColorBlend3, ColorBlend4}
  3840.                 ProgressColorBlend.Colors = Colors
  3841.                 ProgressColorBlend.Positions = ColorBlendPositions
  3842.                 ProgressBrush.InterpolationColors = ProgressColorBlend
  3843.             End If
  3844.             'Base
  3845.             .FillRectangle(New SolidBrush(BaseColor), Base)
  3846.             Select Case Value
  3847.                 Case 100
  3848.                     'Progress
  3849.                     Select Case Style
  3850.                         Case S.Normal
  3851.                             If Border Then
  3852.                                 .FillRectangle(New SolidBrush(ProgressColor), New Rectangle(1, 1, CInt(cValue - 2), Height - 2))
  3853.                             Else
  3854.                                 .FillRectangle(New SolidBrush(ProgressColor), New Rectangle(0, 0, CInt(cValue), Height))
  3855.                             End If
  3856.                         Case S.ColorBlend
  3857.                             If Border Then
  3858.                                 .FillRectangle(ProgressBrush, New Rectangle(1, 1, CInt(cValue - 2), Height - 2))
  3859.                             Else
  3860.                                 .FillRectangle(ProgressBrush, New Rectangle(0, 0, CInt(cValue), Height))
  3861.                             End If
  3862.                     End Select
  3863.                     If Shiny Then
  3864.                         'Shiny
  3865.                         .FillRectangle(New SolidBrush(Color.FromArgb(ShinyIntensity, ShinyColor)), New Rectangle(1, 1, CInt(cValue - 2), CInt(Height / 2 - 1)))
  3866.                     End If
  3867.                 Case Else
  3868.                     'Progress
  3869.                     Select Case Style
  3870.                         Case S.Normal
  3871.                             If Border Then
  3872.                                 .FillRectangle(New SolidBrush(ProgressColor), New Rectangle(1, 1, CInt(cValue - 2), Height - 2))
  3873.                             Else
  3874.                                 .FillRectangle(New SolidBrush(ProgressColor), New Rectangle(0, 0, CInt(cValue), Height))
  3875.                             End If
  3876.                         Case S.ColorBlend
  3877.                             If Border Then
  3878.                                 .FillRectangle(ProgressBrush, New Rectangle(1, 1, CInt(cValue - 2), Height - 2))
  3879.                             Else
  3880.                                 .FillRectangle(ProgressBrush, New Rectangle(0, 0, CInt(cValue), Height))
  3881.                             End If
  3882.                     End Select
  3883.                     If Shiny Then
  3884.                         'Shiny
  3885.                         .FillRectangle(New SolidBrush(Color.FromArgb(ShinyIntensity, ShinyColor)), New Rectangle(1, 1, CInt(cValue - 2), CInt(Height / 2 - 1)))
  3886.                     End If
  3887.                     'Value & Percent
  3888.                     Select Case _ShowValueOrText
  3889.                         Case SVT.Value
  3890.                             If ShowValuePercent Then
  3891.                                 Select Case ValueTextPosition
  3892.                                     Case VTP.Left
  3893.                                         .DrawString(Value & "%", New Font("Segoe UI", 10), New SolidBrush(ValueTextColor), New Rectangle(2, 5, Width, Height), Near)
  3894.                                     Case VTP.Center
  3895.                                         .DrawString(Value & "%", New Font("Segoe UI", 10), New SolidBrush(ValueTextColor), New Rectangle(0, 1, Width, Height), Center)
  3896.                                     Case VTP.Right
  3897.                                         .DrawString(Value & "%", New Font("Segoe UI", 10), New SolidBrush(ValueTextColor), New Rectangle(0, -3, Width, Height), Far)
  3898.                                 End Select
  3899.                             Else
  3900.                                 Select Case ValueTextPosition
  3901.                                     Case VTP.Left
  3902.                                         .DrawString(Value & "", New Font("Segoe UI", 10), New SolidBrush(ValueTextColor), New Rectangle(2, 5, Width, Height), Near)
  3903.                                     Case VTP.Center
  3904.                                         .DrawString(Value & "", New Font("Segoe UI", 10), New SolidBrush(ValueTextColor), New Rectangle(0, 1, Width, Height), Center)
  3905.                                     Case VTP.Right
  3906.                                         .DrawString(Value & "", New Font("Segoe UI", 10), New SolidBrush(ValueTextColor), New Rectangle(0, -3, Width, Height), Far)
  3907.                                 End Select
  3908.                             End If
  3909.                     End Select
  3910.             End Select
  3911.             'Text
  3912.             Select Case _ShowValueOrText
  3913.                 Case SVT.Text
  3914.                     Select Case ValueTextPosition
  3915.                         Case VTP.Left
  3916.                             .DrawString(Text, New Font("Segoe UI", 10), New SolidBrush(ValueTextColor), New Rectangle(2, 5, Width, Height), Near)
  3917.                         Case VTP.Center
  3918.                             .DrawString(Text, New Font("Segoe UI", 10), New SolidBrush(ValueTextColor), New Rectangle(0, 1, Width, Height), Center)
  3919.                         Case VTP.Right
  3920.                             .DrawString(Text, New Font("Segoe UI", 10), New SolidBrush(ValueTextColor), New Rectangle(0, -3, Width, Height), Far)
  3921.                     End Select
  3922.             End Select
  3923.             'Border
  3924.             If Border Then
  3925.                 .DrawRectangle(New Pen(BorderColor), Base)
  3926.             End If
  3927.         End With
  3928.         MyBase.OnPaint(e)
  3929.         G.Dispose()
  3930.         e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic
  3931.         e.Graphics.DrawImageUnscaled(B, 0, 0)
  3932.         B.Dispose()
  3933.     End Sub
  3934.  
  3935. End Class
  3936.  
  3937. Public Class RoundedProgressBar : Inherits Control
  3938.  
  3939. #Region "Properties"
  3940.  
  3941.     <Flags()>
  3942.     Enum S
  3943.         Normal
  3944.         ColorBlend
  3945.     End Enum
  3946.  
  3947.     <Flags()>
  3948.     Enum SVT
  3949.         Value
  3950.         Text
  3951.     End Enum
  3952.  
  3953.     Private _Style As S = S.Normal
  3954.     <Category("Properties")>
  3955.     Public Property Style As S
  3956.         Get
  3957.             Return _Style
  3958.         End Get
  3959.         Set(value As S)
  3960.             _Style = value
  3961.             Invalidate()
  3962.         End Set
  3963.     End Property
  3964.  
  3965.     Private _ShowValueOrText As SVT
  3966.     <Category("Properties")>
  3967.     Public Property ShowValueOrText As SVT
  3968.         Get
  3969.             Return _ShowValueOrText
  3970.         End Get
  3971.         Set(value As SVT)
  3972.             _ShowValueOrText = value
  3973.             Invalidate()
  3974.         End Set
  3975.     End Property
  3976.  
  3977.     Private _Border As Boolean = True
  3978.     <Category("Properties")>
  3979.     Public Property Border As Boolean
  3980.         Get
  3981.             Return _Border
  3982.         End Get
  3983.         Set(value As Boolean)
  3984.             _Border = value
  3985.             Invalidate()
  3986.         End Set
  3987.     End Property
  3988.  
  3989.     Private _ShowValuePercent As Boolean = True
  3990.     <Category("Properties")>
  3991.     Public Property ShowValuePercent As Boolean
  3992.         Get
  3993.             Return _ShowValuePercent
  3994.         End Get
  3995.         Set(value As Boolean)
  3996.             _ShowValuePercent = value
  3997.             Invalidate()
  3998.         End Set
  3999.     End Property
  4000.  
  4001.     Private _Maximum As Integer = 100
  4002.     <Category("Properties")>
  4003.     Public Property Maximum As Integer
  4004.         Get
  4005.             Return _Maximum
  4006.         End Get
  4007.         Set(v As Integer)
  4008.             Select Case v
  4009.                 Case Is < _Value
  4010.                     _Value = v
  4011.             End Select
  4012.             _Maximum = v
  4013.             Invalidate()
  4014.         End Set
  4015.     End Property
  4016.  
  4017.     Private _Value As Integer = 0
  4018.     <Category("Properties")>
  4019.     Public Property Value As Integer
  4020.         Get
  4021.             Select Case _Value
  4022.                 Case 0
  4023.                     Return 0
  4024.                     Invalidate()
  4025.                 Case Else
  4026.                     Return _Value
  4027.                     Invalidate()
  4028.             End Select
  4029.         End Get
  4030.         Set(v As Integer)
  4031.             Select Case v
  4032.                 Case Is > _Maximum
  4033.                     v = _Maximum
  4034.             End Select
  4035.             _Value = v
  4036.             Invalidate()
  4037.         End Set
  4038.     End Property
  4039.  
  4040.     Public Sub Increment(ByVal Amount As Integer)
  4041.         Value += Amount
  4042.     End Sub
  4043.  
  4044.     Private _StartingAngle As Integer = 90
  4045.     <Category("Properties")>
  4046.     Public Property StartingAngle As Integer
  4047.         Get
  4048.             Return _StartingAngle
  4049.         End Get
  4050.         Set(value As Integer)
  4051.             _StartingAngle = value
  4052.         End Set
  4053.     End Property
  4054.  
  4055.     Private _RotationAngle As Integer = 360
  4056.     <Category("Properties")>
  4057.     Public Property RotationAngle As Integer
  4058.         Get
  4059.             Return _RotationAngle
  4060.         End Get
  4061.         Set(value As Integer)
  4062.             _RotationAngle = value
  4063.         End Set
  4064.     End Property
  4065.  
  4066.     Protected Overrides Sub OnResize(e As EventArgs)
  4067.         MyBase.OnResize(e)
  4068.         Height = Width
  4069.     End Sub
  4070.  
  4071.     Protected Overrides Sub OnTextChanged(e As EventArgs)
  4072.         MyBase.OnTextChanged(e)
  4073.         Invalidate()
  4074.     End Sub
  4075.  
  4076. #End Region
  4077.  
  4078. #Region "Color Properties"
  4079.  
  4080.     <Category("Color Properties")>
  4081.     Public Property BaseColor As Color
  4082.         Get
  4083.             Return _BaseColor
  4084.         End Get
  4085.         Set(value As Color)
  4086.             _BaseColor = value
  4087.             Invalidate()
  4088.         End Set
  4089.     End Property
  4090.  
  4091.     <Category("Color Properties")>
  4092.     Public Property ProgressColor As Color
  4093.         Get
  4094.             Return _ProgressColor
  4095.         End Get
  4096.         Set(value As Color)
  4097.             _ProgressColor = value
  4098.             Invalidate()
  4099.         End Set
  4100.     End Property
  4101.  
  4102.     <Category("Color Properties")>
  4103.     Public Property ColorBlend1 As Color
  4104.         Get
  4105.             Return _ColorBlend1
  4106.         End Get
  4107.         Set(value As Color)
  4108.             _ColorBlend1 = value
  4109.             Invalidate()
  4110.         End Set
  4111.     End Property
  4112.  
  4113.     <Category("Color Properties")>
  4114.     Public Property ColorBlend2 As Color
  4115.         Get
  4116.             Return _ColorBlend2
  4117.         End Get
  4118.         Set(value As Color)
  4119.             _ColorBlend2 = value
  4120.             Invalidate()
  4121.         End Set
  4122.     End Property
  4123.  
  4124.     <Category("Color Properties")>
  4125.     Public Property ColorBlend3 As Color
  4126.         Get
  4127.             Return _ColorBlend3
  4128.         End Get
  4129.         Set(value As Color)
  4130.             _ColorBlend3 = value
  4131.             Invalidate()
  4132.         End Set
  4133.     End Property
  4134.  
  4135.     <Category("Color Properties")>
  4136.     Public Property ColorBlend4 As Color
  4137.         Get
  4138.             Return _ColorBlend4
  4139.         End Get
  4140.         Set(value As Color)
  4141.             _ColorBlend4 = value
  4142.             Invalidate()
  4143.         End Set
  4144.     End Property
  4145.  
  4146.     <Category("Properties")>
  4147.     Public Property ValueTextColor As Color
  4148.         Get
  4149.             Return _ValueTextColor
  4150.         End Get
  4151.         Set(value As Color)
  4152.             _ValueTextColor = value
  4153.             Invalidate()
  4154.         End Set
  4155.     End Property
  4156.  
  4157.     <Category("Color Properties")>
  4158.     Public Property BorderColor As Color
  4159.         Get
  4160.             Return _BorderColor
  4161.         End Get
  4162.         Set(value As Color)
  4163.             _BorderColor = value
  4164.             Invalidate()
  4165.         End Set
  4166.     End Property
  4167.  
  4168. #End Region
  4169.  
  4170. #Region "Colors"
  4171.  
  4172.     Private _BaseColor As Color = Black
  4173.     Private _ProgressColor As Color = Green
  4174.     Private _ColorBlend1 As Color = Orange
  4175.     Private _ColorBlend2 As Color = Red
  4176.     Private _ColorBlend3 As Color = Green
  4177.     Private _ColorBlend4 As Color = Blue
  4178.     Private _BorderColor As Color = Black
  4179.     Private _ValueTextColor As Color = White
  4180.  
  4181. #End Region
  4182.  
  4183.     Sub New()
  4184.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or
  4185.                  ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer, True)
  4186.         DoubleBuffered = True
  4187.         BackColor = Gray
  4188.         Size = New Size(128, 128)
  4189.     End Sub
  4190.  
  4191.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  4192.         Dim G = e.Graphics
  4193.         Dim BorderColorBlend As New ColorBlend(4), ProgressBrush As New LinearGradientBrush(New Rectangle(0, 0, Width, Height), Color.Black, Color.Black, 0.0F)
  4194.         With G
  4195.             .SmoothingMode = SmoothingMode.HighQuality
  4196.             .PixelOffsetMode = PixelOffsetMode.HighQuality
  4197.             .TextRenderingHint = TextRenderingHint.ClearTypeGridFit
  4198.             .Clear(BackColor)
  4199.             Dim Colors() As Color = {ColorBlend1, ColorBlend2, ColorBlend3, ColorBlend4}
  4200.             BorderColorBlend.Colors = Colors
  4201.             BorderColorBlend.Positions = ColorBlendPositions
  4202.             ProgressBrush.InterpolationColors = BorderColorBlend
  4203.             If Border Then
  4204.                 .DrawArc(New Pen(New SolidBrush(BorderColor), 6), CInt(3 / 2) + 1, CInt(3 / 2) + 1, Width - 7, Height - 6, StartingAngle - 3, RotationAngle + 5)
  4205.             End If
  4206.             Select Case Value
  4207.                 Case Maximum
  4208.                     Select Case Style
  4209.                         Case S.Normal
  4210.                             .DrawArc(New Pen(New SolidBrush(ProgressColor), 4), CInt(3 / 2) + 1, CInt(3 / 2) + 1, Width - 7, Height - 6, StartingAngle, CInt((RotationAngle / Maximum) * Value))
  4211.                         Case S.ColorBlend
  4212.                             .DrawArc(New Pen(ProgressBrush, 4), CInt(3 / 2) + 1, CInt(3 / 2) + 1, Width - 7, Height - 6, StartingAngle, RotationAngle)
  4213.                     End Select
  4214.                 Case Else
  4215.                     Select Case Style
  4216.                         Case S.Normal
  4217.                             .DrawArc(New Pen(New SolidBrush(ProgressColor), 4), CInt(3 / 2) + 1, CInt(3 / 2) + 1, Width - 7, Height - 6, StartingAngle, CInt((RotationAngle / Maximum) * Value))
  4218.                         Case S.ColorBlend
  4219.                             .DrawArc(New Pen(ProgressBrush, 4), CInt(3 / 2) + 1, CInt(3 / 2) + 1, Width - 7, Height - 6, StartingAngle, CInt((RotationAngle / Maximum) * Value))
  4220.                     End Select
  4221.                     'Value & Percent/Text
  4222.                     Select Case ShowValueOrText
  4223.                         Case SVT.Value
  4224.                             If ShowValuePercent Then
  4225.                                 .DrawString(Value & "%", Font, New SolidBrush(ValueTextColor), New Point(CInt(Width / 2), CInt(Height / 2)), Center)
  4226.                             Else
  4227.                                 .DrawString(Value & "", Font, New SolidBrush(ValueTextColor), New Point(CInt(Width / 2), CInt(Height / 2)), Center)
  4228.                             End If
  4229.                         Case SVT.Text
  4230.                             .DrawString(Text, Font, New SolidBrush(ValueTextColor), New Point(CInt(Width / 2), CInt(Height / 2)), Center)
  4231.                     End Select
  4232.             End Select
  4233.             e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic
  4234.         End With
  4235.     End Sub
  4236.  
  4237. End Class
  4238.  
  4239. Public Class ComboBox : Inherits Windows.Forms.ComboBox
  4240.  
  4241. #Region "Variables"
  4242.  
  4243.     Private x As Integer
  4244.     Private State As MouseState = MouseState.None
  4245.  
  4246. #End Region
  4247.  
  4248. #Region "Mouse States"
  4249.  
  4250.     Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
  4251.         MyBase.OnMouseDown(e)
  4252.         State = MouseState.Down : Invalidate()
  4253.     End Sub
  4254.  
  4255.     Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
  4256.         MyBase.OnMouseUp(e)
  4257.         State = MouseState.Over : Invalidate()
  4258.     End Sub
  4259.  
  4260.     Protected Overrides Sub OnMouseEnter(e As EventArgs)
  4261.         MyBase.OnMouseEnter(e)
  4262.         State = MouseState.Over : Invalidate()
  4263.     End Sub
  4264.  
  4265.     Protected Overrides Sub OnMouseLeave(e As EventArgs)
  4266.         MyBase.OnMouseLeave(e)
  4267.         State = MouseState.None : Invalidate()
  4268.     End Sub
  4269.  
  4270.     Protected Overrides Sub OnMouseMove(e As MouseEventArgs)
  4271.         MyBase.OnMouseMove(e)
  4272.         x = e.Location.X
  4273.         If e.X < Width - 40 Then
  4274.             Cursor = Cursors.Default
  4275.         Else
  4276.             Cursor = Cursors.Hand
  4277.         End If
  4278.         Invalidate()
  4279.     End Sub
  4280.  
  4281.     Protected Overrides Sub OnDrawItem(e As DrawItemEventArgs)
  4282.         MyBase.OnDrawItem(e) : Invalidate()
  4283.         If (e.State And DrawItemState.Selected) = DrawItemState.Selected Then
  4284.             Invalidate()
  4285.         End If
  4286.     End Sub
  4287.  
  4288.     Protected Overrides Sub OnClick(e As EventArgs)
  4289.         MyBase.OnClick(e) : Invalidate()
  4290.     End Sub
  4291.  
  4292. #End Region
  4293.  
  4294. #Region "Properties"
  4295.  
  4296.     <Flags()>
  4297.     Enum BS
  4298.         Normal
  4299.         Complete
  4300.     End Enum
  4301.  
  4302.     Private _BorderStyle As BS = BS.Complete
  4303.     <Category("Properties")>
  4304.     Public Property BorderStyle As BS
  4305.         Get
  4306.             Return _BorderStyle
  4307.         End Get
  4308.         Set(value As BS)
  4309.             _BorderStyle = value
  4310.             Invalidate()
  4311.         End Set
  4312.     End Property
  4313.  
  4314.     Private _Border As Boolean = True
  4315.     <Category("Properties")>
  4316.     Public Property Border As Boolean
  4317.         Get
  4318.             Return _Border
  4319.         End Get
  4320.         Set(value As Boolean)
  4321.             _Border = value
  4322.             Invalidate()
  4323.         End Set
  4324.     End Property
  4325.  
  4326.     Private _StartIndex As Integer = 0
  4327.     Private Property StartIndex As Integer
  4328.         Get
  4329.             Return _StartIndex
  4330.         End Get
  4331.         Set(ByVal value As Integer)
  4332.             _StartIndex = value
  4333.             Try
  4334.                 SelectedIndex = value
  4335.             Catch
  4336.             End Try
  4337.             Invalidate()
  4338.         End Set
  4339.     End Property
  4340.  
  4341.     Sub _DrawItem(ByVal sender As Object, ByVal e As DrawItemEventArgs) Handles Me.DrawItem
  4342.         If e.Index < 0 Then Exit Sub
  4343.         e.DrawBackground()
  4344.         e.DrawFocusRectangle()
  4345.         With G
  4346.             .SmoothingMode = SmoothingMode.HighQuality
  4347.             .PixelOffsetMode = PixelOffsetMode.HighQuality
  4348.             .TextRenderingHint = TextRenderingHint.ClearTypeGridFit
  4349.             .InterpolationMode = InterpolationMode.HighQualityBicubic
  4350.         End With
  4351.         If (e.State And DrawItemState.Selected) = DrawItemState.Selected Then
  4352.             'Selected item
  4353.             e.Graphics.FillRectangle(New SolidBrush(SelectedHoverColor), e.Bounds)
  4354.         Else
  4355.             'Not Selected
  4356.             e.Graphics.FillRectangle(New SolidBrush(BackgroundColor), e.Bounds)
  4357.         End If
  4358.         'Text
  4359.         e.Graphics.DrawString(GetItemText(Items(e.Index)), New Font("Segoe UI", 8),
  4360.         Brushes.White, New Rectangle(e.Bounds.X + 2, e.Bounds.Y + 2, e.Bounds.Width, e.Bounds.Height))
  4361.         e.Graphics.Dispose()
  4362.     End Sub
  4363.  
  4364.     Protected Overrides Sub OnResize(e As EventArgs)
  4365.         MyBase.OnResize(e)
  4366.         Height = 18
  4367.     End Sub
  4368.  
  4369. #End Region
  4370.  
  4371. #Region "Color Properties"
  4372.  
  4373.     <Category("Color Properties")>
  4374.     Public Property ButtonColor As Color
  4375.         Get
  4376.             Return _ButtonColor
  4377.         End Get
  4378.         Set(value As Color)
  4379.             _ButtonColor = value
  4380.             Invalidate()
  4381.         End Set
  4382.     End Property
  4383.  
  4384.     <Category("Color Properties")>
  4385.     Public Property BackgroundColor As Color
  4386.         Get
  4387.             Return _BackgroundColor
  4388.         End Get
  4389.         Set(value As Color)
  4390.             _BackgroundColor = value
  4391.             Invalidate()
  4392.         End Set
  4393.     End Property
  4394.  
  4395.     <Category("Color Properties")>
  4396.     Public Property ButtonLinesColor As Color
  4397.         Get
  4398.             Return _ButtonLinesColor
  4399.         End Get
  4400.         Set(value As Color)
  4401.             _ButtonLinesColor = value
  4402.             Invalidate()
  4403.         End Set
  4404.     End Property
  4405.  
  4406.     <Category("Color Properties")>
  4407.     Public Property BorderColor As Color
  4408.         Get
  4409.             Return _BorderColor
  4410.         End Get
  4411.         Set(value As Color)
  4412.             _BorderColor = value
  4413.             Invalidate()
  4414.         End Set
  4415.     End Property
  4416.  
  4417.     <Category("Color Properties")>
  4418.     Public Property SelectedHoverColor As Color
  4419.         Get
  4420.             Return _SelectedHoverColor
  4421.         End Get
  4422.         Set(value As Color)
  4423.             _SelectedHoverColor = value
  4424.             Invalidate()
  4425.         End Set
  4426.     End Property
  4427.  
  4428. #End Region
  4429.  
  4430. #Region "Colors"
  4431.  
  4432.     Private _ButtonColor As Color = Color.FromArgb(30, 30, 30)
  4433.     Private _BackgroundColor As Color = Black
  4434.     Private _ButtonLinesColor As Color = White
  4435.     Private _BorderColor As Color = White
  4436.     Private _SelectedHoverColor As Color = Gray
  4437.  
  4438. #End Region
  4439.  
  4440.     Sub New()
  4441.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or
  4442.                  ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer, True)
  4443.         DoubleBuffered = True
  4444.         BackColor = Black
  4445.         Font = New Font("Segoe UI", 8)
  4446.         Cursor = Cursors.Hand
  4447.         ForeColor = Color.White
  4448.         DrawMode = DrawMode.OwnerDrawFixed
  4449.         DropDownStyle = ComboBoxStyle.DropDownList
  4450.         StartIndex = 0
  4451.         ItemHeight = 18
  4452.     End Sub
  4453.  
  4454.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  4455.         B = New Bitmap(Width, Height) : G = Graphics.FromImage(B)
  4456.         Dim Base As New Rectangle(0, 0, Width, Height)
  4457.         Dim Button As New Rectangle(Width - 40, 0, Width, Height)
  4458.         With G
  4459.             .SmoothingMode = SmoothingMode.HighQuality
  4460.             .PixelOffsetMode = PixelOffsetMode.HighQuality
  4461.             .TextRenderingHint = TextRenderingHint.ClearTypeGridFit
  4462.             .Clear(BackColor)
  4463.             'Base
  4464.             .FillRectangle(New SolidBrush(BackgroundColor), Base)
  4465.             'Button
  4466.             .FillRectangle(New SolidBrush(ButtonColor), Button)
  4467.             'Lines
  4468.             .DrawLine(New Pen(New SolidBrush(ButtonLinesColor)), Width - 12, 6, Width - 28, 6)
  4469.             .DrawLine(New Pen(New SolidBrush(ButtonLinesColor)), Width - 12, 12, Width - 28, 12)
  4470.             .DrawLine(New Pen(New SolidBrush(ButtonLinesColor)), Width - 12, 18, Width - 28, 18)
  4471.             'Text
  4472.             .DrawString(Text, Font, Brushes.White, New Point(4, 5), Near)
  4473.             'Border
  4474.             If Border Then
  4475.                 .DrawRectangle(New Pen(BorderColor), Base)
  4476.                 Select Case BorderStyle
  4477.                     Case BS.Complete
  4478.                         .DrawLine(New Pen(BorderColor), Width - 40, 1, Width - 40, 23)
  4479.                 End Select
  4480.             End If
  4481.         End With
  4482.         G.Dispose()
  4483.         e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic
  4484.         e.Graphics.DrawImageUnscaled(B, 0, 0)
  4485.         B.Dispose()
  4486.     End Sub
  4487.  
  4488. End Class
  4489.  
  4490. Public Class ListBox : Inherits Control
  4491.  
  4492. #Region "Variables"
  4493.  
  4494.     Private WithEvents LB As New Windows.Forms.ListBox
  4495.  
  4496. #End Region
  4497.  
  4498. #Region "Properties"
  4499.  
  4500.     Private _Border As Boolean = True
  4501.     <Category("Properties")>
  4502.     Public Property Border As Boolean
  4503.         Get
  4504.             Return _Border
  4505.         End Get
  4506.         Set(value As Boolean)
  4507.             _Border = value
  4508.             Invalidate()
  4509.         End Set
  4510.     End Property
  4511.  
  4512.     Private _Items As String() = {""}
  4513.     <Category("Properties")>
  4514.     Public Property Items As String()
  4515.         Get
  4516.             Return _Items
  4517.         End Get
  4518.         Set(value As String())
  4519.             _Items = value
  4520.             LB.Items.Clear()
  4521.             LB.Items.AddRange(value)
  4522.             Invalidate()
  4523.         End Set
  4524.     End Property
  4525.  
  4526.     Sub AddItem(ByVal Item As Object)
  4527.         LB.Items.Remove("")
  4528.         LB.Items.Add(Item)
  4529.     End Sub
  4530.  
  4531.     Sub AddRange(ByVal Items As Object())
  4532.         LB.Items.Remove("")
  4533.         LB.Items.AddRange(Items)
  4534.     End Sub
  4535.  
  4536.     Public ReadOnly Property SelectedItem() As String
  4537.         Get
  4538.             Return CType(LB.SelectedItem, String)
  4539.         End Get
  4540.     End Property
  4541.  
  4542.     Public ReadOnly Property SelectedIndex() As Integer
  4543.         Get
  4544.             Return LB.SelectedIndex
  4545.             If LB.SelectedIndex < 0 Then Exit Property
  4546.         End Get
  4547.     End Property
  4548.  
  4549.     Public ReadOnly Property GetSelectedText() As String
  4550.         Get
  4551.             Return LB.Text
  4552.         End Get
  4553.     End Property
  4554.  
  4555.     Public Sub Clear()
  4556.         LB.Items.Clear()
  4557.     End Sub
  4558.  
  4559.     Public Sub ClearSelected()
  4560.         For i As Integer = (LB.SelectedItems.Count - 1) To 0 Step -1
  4561.             LB.Items.Remove(LB.SelectedItems(i))
  4562.         Next
  4563.     End Sub
  4564.  
  4565.     Sub Drawitem(ByVal sender As Object, ByVal e As DrawItemEventArgs) Handles LB.DrawItem
  4566.         If e.Index < 0 Then Exit Sub
  4567.         e.DrawBackground()
  4568.         e.DrawFocusRectangle()
  4569.         With G
  4570.             .SmoothingMode = SmoothingMode.HighQuality
  4571.             .PixelOffsetMode = PixelOffsetMode.HighQuality
  4572.             .TextRenderingHint = TextRenderingHint.ClearTypeGridFit
  4573.             .InterpolationMode = InterpolationMode.HighQualityBicubic
  4574.         End With
  4575.         'If Selected
  4576.         If InStr(e.State.ToString, "Selected,") > 0 Then
  4577.             'Base
  4578.             e.Graphics.FillRectangle(New SolidBrush(SelectedColor), New Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height))
  4579.             'Text
  4580.             e.Graphics.DrawString(" " & LB.Items(e.Index).ToString(), New Font("Segoe UI", 8), Brushes.White, e.Bounds.X, e.Bounds.Y + 4)
  4581.         Else
  4582.             'Base
  4583.             e.Graphics.FillRectangle(New SolidBrush(UnselectedColor), New Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height))
  4584.             'Text
  4585.             e.Graphics.DrawString(" " & LB.Items(e.Index).ToString(), New Font("Segoe UI", 8), Brushes.White, e.Bounds.X, e.Bounds.Y + 4)
  4586.         End If
  4587.         e.Graphics.Dispose()
  4588.     End Sub
  4589.  
  4590.     Protected Overrides Sub OnCreateControl()
  4591.         MyBase.OnCreateControl()
  4592.         If Not Controls.Contains(LB) Then
  4593.             Controls.Add(LB)
  4594.         End If
  4595.     End Sub
  4596.  
  4597. #End Region
  4598.  
  4599. #Region "Color Properties"
  4600.  
  4601.     <Category("Color Properties")>
  4602.     Public Property BaseColor As Color
  4603.         Get
  4604.             Return _BaseColor
  4605.         End Get
  4606.         Set(value As Color)
  4607.             _BaseColor = value
  4608.             Invalidate()
  4609.         End Set
  4610.     End Property
  4611.  
  4612.     <Category("Color Properties")>
  4613.     Public Property BorderColor As Color
  4614.         Get
  4615.             Return _BorderColor
  4616.         End Get
  4617.         Set(value As Color)
  4618.             _BorderColor = value
  4619.             Invalidate()
  4620.         End Set
  4621.     End Property
  4622.  
  4623.     <Category("Color Properties")>
  4624.     Public Property SelectedColor As Color
  4625.         Get
  4626.             Return _SelectedColor
  4627.         End Get
  4628.         Set(value As Color)
  4629.             _SelectedColor = value
  4630.             Invalidate()
  4631.         End Set
  4632.     End Property
  4633.  
  4634.     <Category("Color Properties")>
  4635.     Public Property UnselectedColor As Color
  4636.         Get
  4637.             Return _UnselectedColor
  4638.         End Get
  4639.         Set(value As Color)
  4640.             _UnselectedColor = value
  4641.             Invalidate()
  4642.         End Set
  4643.     End Property
  4644.  
  4645. #End Region
  4646.  
  4647. #Region "Colors"
  4648.  
  4649.     Private _BaseColor As Color = Black
  4650.     Private _BorderColor As Color = White
  4651.     Private _SelectedColor As Color = Gray
  4652.     Private _UnselectedColor As Color = Black
  4653.  
  4654. #End Region
  4655.  
  4656.     Sub New()
  4657.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or
  4658.             ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer, True)
  4659.         DoubleBuffered = True
  4660.         LB.BackColor = Black
  4661.         LB.Font = New Font("Segoe UI", 8)
  4662.         LB.ForeColor = Color.White
  4663.         LB.Location = New Point(3, 3)
  4664.         LB.BorderStyle = BorderStyle.None
  4665.         LB.DrawMode = DrawMode.OwnerDrawFixed
  4666.         LB.ScrollAlwaysVisible = False
  4667.         LB.HorizontalScrollbar = False
  4668.         LB.ItemHeight = 21
  4669.         LB.Items.Clear()
  4670.         LB.IntegralHeight = False
  4671.         Size = New Size(256, 320)
  4672.     End Sub
  4673.  
  4674.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  4675.         B = New Bitmap(Width, Height) : G = Graphics.FromImage(B)
  4676.         Dim Base As New Rectangle(0, 0, Width, Height)
  4677.         With G
  4678.             .SmoothingMode = SmoothingMode.HighQuality
  4679.             .PixelOffsetMode = PixelOffsetMode.HighQuality
  4680.             .TextRenderingHint = TextRenderingHint.ClearTypeGridFit
  4681.             .Clear(BackColor)
  4682.             'Size
  4683.             LB.Size = New Size(Width - 6, Height - 6)
  4684.             'Base
  4685.             .FillRectangle(New SolidBrush(BaseColor), Base)
  4686.             'Border
  4687.             If Border Then
  4688.                 .DrawRectangle(New Pen(BorderColor), Base)
  4689.             End If
  4690.         End With
  4691.         MyBase.OnPaint(e)
  4692.         G.Dispose()
  4693.         e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic
  4694.         e.Graphics.DrawImageUnscaled(B, 0, 0)
  4695.         B.Dispose()
  4696.     End Sub
  4697.  
  4698. End Class
  4699.  
  4700. Public Class StatusBar : Inherits Control
  4701.  
  4702. #Region "Properties"
  4703.  
  4704.     Private _SecondText As String
  4705.     <Category("Properties")>
  4706.     Public Property SecondText As String
  4707.         Get
  4708.             Return _SecondText
  4709.         End Get
  4710.         Set(value As String)
  4711.             _SecondText = value
  4712.             Invalidate()
  4713.         End Set
  4714.     End Property
  4715.  
  4716.     Private _Border As Boolean = False
  4717.     <Category("Properties")>
  4718.     Public Property Border As Boolean
  4719.         Get
  4720.             Return _Border
  4721.         End Get
  4722.         Set(value As Boolean)
  4723.             _Border = value
  4724.             Invalidate()
  4725.         End Set
  4726.     End Property
  4727.  
  4728.     Protected Overrides Sub CreateHandle()
  4729.         MyBase.CreateHandle()
  4730.         Dock = DockStyle.Bottom
  4731.     End Sub
  4732.  
  4733.     Protected Overrides Sub OnTextChanged(e As EventArgs)
  4734.         MyBase.OnTextChanged(e) : Invalidate()
  4735.     End Sub
  4736.  
  4737. #End Region
  4738.  
  4739. #Region "Color Properties"
  4740.  
  4741.     <Category("Color Properties")>
  4742.     Public Property BaseColor As Color
  4743.         Get
  4744.             Return _BaseColor
  4745.         End Get
  4746.         Set(value As Color)
  4747.             _BaseColor = value
  4748.             Invalidate()
  4749.         End Set
  4750.     End Property
  4751.  
  4752.     <Category("Color Properties")>
  4753.     Public Property BorderColor As Color
  4754.         Get
  4755.             Return _BorderColor
  4756.         End Get
  4757.         Set(value As Color)
  4758.             _BorderColor = value
  4759.             Invalidate()
  4760.         End Set
  4761.     End Property
  4762.  
  4763.     <Category("Color Properties")>
  4764.     Public Property TextColor As Color
  4765.         Get
  4766.             Return _TextColor
  4767.         End Get
  4768.         Set(value As Color)
  4769.             _TextColor = value
  4770.             Invalidate()
  4771.         End Set
  4772.     End Property
  4773.  
  4774.     <Category("Color Properties")>
  4775.     Public Property SecondTextColor As Color
  4776.         Get
  4777.             Return _SecondTextColor
  4778.         End Get
  4779.         Set(value As Color)
  4780.             _SecondTextColor = value
  4781.             Invalidate()
  4782.         End Set
  4783.     End Property
  4784.  
  4785. #End Region
  4786.  
  4787. #Region "Colors"
  4788.  
  4789.     Private _BaseColor As Color = Black
  4790.     Private _BorderColor As Color = White
  4791.     Private _TextColor As Color = White
  4792.     Private _SecondTextColor As Color = White
  4793.  
  4794. #End Region
  4795.  
  4796.     Sub New()
  4797.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or
  4798.                  ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer, True)
  4799.         DoubleBuffered = True
  4800.         BackColor = Gray
  4801.         Font = New Font("Segoe UI", 8)
  4802.         Size = New Size(Width, 20)
  4803.         ForeColor = Color.White
  4804.     End Sub
  4805.  
  4806.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  4807.         B = New Bitmap(Width, Height) : G = Graphics.FromImage(B)
  4808.         Dim Base As New Rectangle(0, 0, Width, Height)
  4809.         With G
  4810.             .SmoothingMode = SmoothingMode.HighQuality
  4811.             .PixelOffsetMode = PixelOffsetMode.HighQuality
  4812.             .TextRenderingHint = TextRenderingHint.ClearTypeGridFit
  4813.             .Clear(BackColor)
  4814.             'Base
  4815.             .FillRectangle(New SolidBrush(BaseColor), Base)
  4816.             'Border
  4817.             If Border Then
  4818.                 .DrawLine(New Pen(BorderColor), New Point(0, Height), New Point(Width, Height))
  4819.                 .DrawLine(New Pen(BorderColor), New Point(0, 0), New Point(0, Height))
  4820.                 .DrawLine(New Pen(BorderColor), New Point(Width, 0), New Point(Width, Height))
  4821.             End If
  4822.             'Left Text
  4823.             .DrawString(Text, Font, New SolidBrush(TextColor), New Rectangle(5, 5, Width, Height), Near)
  4824.             'Right Text
  4825.             .DrawString(SecondText, Font, New SolidBrush(SecondTextColor), New Rectangle(-5, 2, Width, Height), New StringFormat() _
  4826.             With {.Alignment = StringAlignment.Far, .LineAlignment = StringAlignment.Center})
  4827.         End With
  4828.         MyBase.OnPaint(e)
  4829.         G.Dispose()
  4830.         e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic
  4831.         e.Graphics.DrawImageUnscaled(B, 0, 0)
  4832.         B.Dispose()
  4833.     End Sub
  4834.  
  4835. End Class
  4836.  
  4837. Public Class GroupBox : Inherits ContainerControl
  4838.  
  4839. #Region "Properties"
  4840.  
  4841.     <Flags()>
  4842.     Enum TP
  4843.         Left
  4844.         Center
  4845.         Right
  4846.     End Enum
  4847.  
  4848.     Private _TextPosition As TP
  4849.     <Category("Properties")>
  4850.     Public Property TextPosition As TP
  4851.         Get
  4852.             Return _TextPosition
  4853.         End Get
  4854.         Set(value As TP)
  4855.             _TextPosition = value
  4856.             Invalidate()
  4857.         End Set
  4858.     End Property
  4859.  
  4860.     Private _ShowText As Boolean = True
  4861.     <Category("Properties")>
  4862.     Public Property ShowText As Boolean
  4863.         Get
  4864.             Return _ShowText
  4865.         End Get
  4866.         Set(value As Boolean)
  4867.             _ShowText = value
  4868.             Invalidate()
  4869.         End Set
  4870.     End Property
  4871.  
  4872.     Private _Border As Boolean = True
  4873.     <Category("Properties")>
  4874.     Public Property Border As Boolean
  4875.         Get
  4876.             Return _Border
  4877.         End Get
  4878.         Set(value As Boolean)
  4879.             _Border = value
  4880.             Invalidate()
  4881.         End Set
  4882.     End Property
  4883.  
  4884. #End Region
  4885.  
  4886. #Region "Color Properties"
  4887.  
  4888.     <Category("Color Properties")>
  4889.     Public Property BaseColor As Color
  4890.         Get
  4891.             Return _BaseColor
  4892.         End Get
  4893.         Set(value As Color)
  4894.             _BaseColor = value
  4895.             Invalidate()
  4896.         End Set
  4897.     End Property
  4898.  
  4899.     <Category("Color Properties")>
  4900.     Public Property TextColor As Color
  4901.         Get
  4902.             Return _TextColor
  4903.         End Get
  4904.         Set(value As Color)
  4905.             _TextColor = value
  4906.             Invalidate()
  4907.         End Set
  4908.     End Property
  4909.  
  4910.     <Category("Color Properties")>
  4911.     Public Property BorderColor As Color
  4912.         Get
  4913.             Return _BorderColor
  4914.         End Get
  4915.         Set(value As Color)
  4916.             _BorderColor = value
  4917.             Invalidate()
  4918.         End Set
  4919.     End Property
  4920.  
  4921. #End Region
  4922.  
  4923. #Region "Colors"
  4924.  
  4925.     Private _BaseColor As Color = Black
  4926.     Private _TextColor As Color = White
  4927.     Private _BorderColor As Color = White
  4928.  
  4929. #End Region
  4930.  
  4931.     Sub New()
  4932.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or
  4933.                  ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer, True)
  4934.         DoubleBuffered = True
  4935.         BackColor = Gray
  4936.         Size = New Size(240, 180)
  4937.         Font = New Font("Segoe UI", 12)
  4938.     End Sub
  4939.  
  4940.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  4941.         B = New Bitmap(Width, Height) : G = Graphics.FromImage(B)
  4942.         Dim Base As New Rectangle(0, 24, Width, Height - 24)
  4943.         With G
  4944.             .SmoothingMode = SmoothingMode.HighQuality
  4945.             .PixelOffsetMode = PixelOffsetMode.HighQuality
  4946.             .TextRenderingHint = TextRenderingHint.ClearTypeGridFit
  4947.             .Clear(BackColor)
  4948.             If ShowText Then
  4949.                 'Text
  4950.                 Select Case TextPosition
  4951.                     Case TP.Left
  4952.                         .DrawString(Text, Font, New SolidBrush(TextColor), New Rectangle(-2, 0, Width, Height), New StringFormat() With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Near})
  4953.                     Case TP.Center
  4954.                         .DrawString(Text, Font, New SolidBrush(TextColor), New Rectangle(0, 0, Width, Height), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Near})
  4955.                     Case TP.Right
  4956.                         .DrawString(Text, Font, New SolidBrush(TextColor), New Rectangle(5, 0, Width, Height), New StringFormat() With {.Alignment = StringAlignment.Far, .LineAlignment = StringAlignment.Near})
  4957.                 End Select
  4958.             Else
  4959.                 Base = New Rectangle(0, 0, Width, Height)
  4960.             End If
  4961.             'Base
  4962.             .FillRectangle(New SolidBrush(BaseColor), Base)
  4963.             If Border Then
  4964.                 'Border
  4965.                 .DrawRectangle(New Pen(BorderColor), Base)
  4966.             End If
  4967.         End With
  4968.         MyBase.OnPaint(e)
  4969.         G.Dispose()
  4970.         e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic
  4971.         e.Graphics.DrawImageUnscaled(B, 0, 0)
  4972.         B.Dispose()
  4973.     End Sub
  4974.  
  4975. End Class
  4976.  
  4977. Public Class TrackBar : Inherits Control
  4978.  
  4979. #Region "Variables"
  4980.  
  4981.     Private v As Integer
  4982.     Private Bool As Boolean
  4983.     Private Track As Rectangle
  4984.     Private Border As Rectangle
  4985.  
  4986. #End Region
  4987.  
  4988. #Region "Mouse States"
  4989.  
  4990.     Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  4991.         MyBase.OnMouseDown(e)
  4992.         If e.Button = MouseButtons.Left Then
  4993.             Track = New Rectangle(v + 1, 1, 10, 20)
  4994.             Bool = Track.Contains(e.Location)
  4995.         End If
  4996.     End Sub
  4997.  
  4998.     Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  4999.         MyBase.OnMouseUp(e) : Bool = False
  5000.     End Sub
  5001.  
  5002.     Protected Overrides Sub OnMouseMove(ByVal e As MouseEventArgs)
  5003.         MyBase.OnMouseMove(e)
  5004.         If Bool AndAlso e.X > -1 AndAlso e.X < (Width + 1) Then
  5005.             Value = Minimum + CInt((Maximum - Minimum) * (e.X / Width))
  5006.         End If
  5007.     End Sub
  5008.  
  5009. #End Region
  5010.  
  5011. #Region "Properties"
  5012.  
  5013.     <Flags()>
  5014.     Enum S
  5015.         Normal
  5016.         ColorBlend
  5017.     End Enum
  5018.  
  5019.     <Flags()>
  5020.     Enum VP
  5021.         Left
  5022.         Center
  5023.         Right
  5024.     End Enum
  5025.  
  5026.     Private _Style As S
  5027.     <Category("Properties")>
  5028.     Public Property Style As S
  5029.         Get
  5030.             Return _Style
  5031.         End Get
  5032.         Set(value As S)
  5033.             _Style = value
  5034.             Invalidate()
  5035.         End Set
  5036.     End Property
  5037.  
  5038.     Private _ValuePosition As VP = VP.Center
  5039.     <Category("Properties")>
  5040.     Public Property ValuePosition As VP
  5041.         Get
  5042.             Return _ValuePosition
  5043.         End Get
  5044.         Set(value As VP)
  5045.             _ValuePosition = value
  5046.             Invalidate()
  5047.         End Set
  5048.     End Property
  5049.  
  5050.     Private _ShowValue As Boolean = False
  5051.     <Category("Properties")>
  5052.     Public Property ShowValue As Boolean
  5053.         Get
  5054.             Return _ShowValue
  5055.         End Get
  5056.         Set(value As Boolean)
  5057.             _ShowValue = value
  5058.             If ShowValue Then
  5059.                 Size = New Size(Width, 34)
  5060.             Else
  5061.                 Size = New Size(Width, 22)
  5062.             End If
  5063.             Invalidate()
  5064.         End Set
  5065.     End Property
  5066.  
  5067.     Private _ShowValuePercent As Boolean = False
  5068.     <Category("Properties")>
  5069.     Public Property ShowValuePercent As Boolean
  5070.         Get
  5071.             Return _ShowValuePercent
  5072.         End Get
  5073.         Set(value As Boolean)
  5074.             _ShowValuePercent = value
  5075.             Invalidate()
  5076.         End Set
  5077.     End Property
  5078.  
  5079.     <Category("Properties")>
  5080.     Event Scroll(ByVal sender As Object)
  5081.     Private _Value As Integer
  5082.     Public Property Value As Integer
  5083.         Get
  5084.             Return _Value
  5085.         End Get
  5086.         Set(value As Integer)
  5087.             If value = _Value Then Return
  5088.             If value > Maximum OrElse value < Minimum Then
  5089.             End If
  5090.             _Value = value
  5091.             Invalidate()
  5092.             RaiseEvent Scroll(Me)
  5093.         End Set
  5094.     End Property
  5095.  
  5096.     Private _Minimum As Integer = 0
  5097.     <Category("Properties")>
  5098.     Public Property Minimum As Integer
  5099.         Get
  5100.             Return _Minimum
  5101.         End Get
  5102.         Set(value As Integer)
  5103.             If value < 0 Then
  5104.             End If
  5105.             _Minimum = value
  5106.             If value > _Value Then _Value = value
  5107.             If value > Maximum Then Maximum = value
  5108.             Invalidate()
  5109.         End Set
  5110.     End Property
  5111.  
  5112.     Private _Maximum As Integer = 100
  5113.     <Category("Properties")>
  5114.     Public Property Maximum As Integer
  5115.         Get
  5116.             Return _Maximum
  5117.         End Get
  5118.         Set(value As Integer)
  5119.             If value < 0 Then
  5120.             End If
  5121.             _Maximum = value
  5122.             If value < _Value Then _Value = value
  5123.             If value < Minimum Then Minimum = value
  5124.             Invalidate()
  5125.         End Set
  5126.     End Property
  5127.  
  5128.     Protected Overrides Sub OnKeyDown(e As KeyEventArgs)
  5129.         MyBase.OnKeyDown(e)
  5130.         If CBool(CType(e.KeyCode = Keys.Subtract, Keys) Or Keys.Right) Then
  5131.             If Value = 0 Then Exit Sub
  5132.             Value -= 1
  5133.         ElseIf CBool(CType(e.KeyCode = Keys.Add, Keys) Or Keys.Left) Then
  5134.             If Value = _Maximum Then Exit Sub
  5135.             Value += 1
  5136.         End If
  5137.     End Sub
  5138.  
  5139.     Protected Overrides Sub OnTextChanged(e As EventArgs)
  5140.         MyBase.OnTextChanged(e) : Invalidate()
  5141.     End Sub
  5142.  
  5143.     Protected Overrides Sub OnResize(e As EventArgs)
  5144.         MyBase.OnResize(e)
  5145.         If ShowValue Then
  5146.             Height = 34
  5147.         Else
  5148.             Height = 22
  5149.         End If
  5150.     End Sub
  5151.  
  5152. #End Region
  5153.  
  5154. #Region "Color Properties"
  5155.  
  5156.     <Category("Color Properties")>
  5157.     Public Property BaseColor As Color
  5158.         Get
  5159.             Return _BaseColor
  5160.         End Get
  5161.         Set(value As Color)
  5162.             _BaseColor = value
  5163.             Invalidate()
  5164.         End Set
  5165.     End Property
  5166.  
  5167.     <Category("Color Properties")>
  5168.     Public Property TrackColor As Color
  5169.         Get
  5170.             Return _TrackColor
  5171.         End Get
  5172.         Set(value As Color)
  5173.             _TrackColor = value
  5174.             Invalidate()
  5175.         End Set
  5176.     End Property
  5177.  
  5178.  
  5179.     <Category("Color Properties")>
  5180.     Public Property ColorBlend1 As Color
  5181.         Get
  5182.             Return _ColorBlend1
  5183.         End Get
  5184.         Set(value As Color)
  5185.             _ColorBlend1 = value
  5186.             Invalidate()
  5187.         End Set
  5188.     End Property
  5189.  
  5190.     <Category("Color Properties")>
  5191.     Public Property ColorBlend2 As Color
  5192.         Get
  5193.             Return _ColorBlend2
  5194.         End Get
  5195.         Set(value As Color)
  5196.             _ColorBlend2 = value
  5197.             Invalidate()
  5198.         End Set
  5199.     End Property
  5200.  
  5201.     <Category("Color Properties")>
  5202.     Public Property ColorBlend3 As Color
  5203.         Get
  5204.             Return _ColorBlend3
  5205.         End Get
  5206.         Set(value As Color)
  5207.             _ColorBlend3 = value
  5208.             Invalidate()
  5209.         End Set
  5210.     End Property
  5211.  
  5212.     <Category("Color Properties")>
  5213.     Public Property ColorBlend4 As Color
  5214.         Get
  5215.             Return _ColorBlend4
  5216.         End Get
  5217.         Set(value As Color)
  5218.             _ColorBlend4 = value
  5219.             Invalidate()
  5220.         End Set
  5221.     End Property
  5222.  
  5223.     <Category("Color Properties")>
  5224.     Public Property BorderColor As Color
  5225.         Get
  5226.             Return _BorderColor
  5227.         End Get
  5228.         Set(value As Color)
  5229.             _BorderColor = value
  5230.             Invalidate()
  5231.         End Set
  5232.     End Property
  5233.  
  5234.     <Category("Color Properties")>
  5235.     Public Property SliderColor As Color
  5236.         Get
  5237.             Return _SliderColor
  5238.         End Get
  5239.         Set(value As Color)
  5240.             _SliderColor = value
  5241.             Invalidate()
  5242.         End Set
  5243.     End Property
  5244.  
  5245.     <Category("Color Properties")>
  5246.     Public Property ValueColor As Color
  5247.         Get
  5248.             Return _ValueColor
  5249.         End Get
  5250.         Set(value As Color)
  5251.             _ValueColor = value
  5252.             Invalidate()
  5253.         End Set
  5254.     End Property
  5255.  
  5256. #End Region
  5257.  
  5258. #Region "Colors"
  5259.  
  5260.     Private _BaseColor As Color = Black
  5261.     Private _TrackColor As Color = Green
  5262.     Private _ColorBlend1 As Color = Orange
  5263.     Private _ColorBlend2 As Color = Red
  5264.     Private _ColorBlend3 As Color = Green
  5265.     Private _ColorBlend4 As Color = Blue
  5266.     Private _BorderColor As Color = Color.Black
  5267.     Private _SliderColor As Color = White
  5268.     Private _ValueColor As Color = White
  5269.  
  5270. #End Region
  5271.  
  5272.     Sub New()
  5273.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or
  5274.                  ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer, True)
  5275.         DoubleBuffered = True
  5276.         BackColor = Gray
  5277.         Size = New Size(128, 22)
  5278.     End Sub
  5279.  
  5280.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  5281.         B = New Bitmap(Width, Height) : G = Graphics.FromImage(B)
  5282.         Dim TrackColorBlend As New ColorBlend(4), TrackBrush As New LinearGradientBrush(New Rectangle(0, 0, Width, Height), Color.Black, Color.Black, 0.0F)
  5283.         With G
  5284.             .SmoothingMode = SmoothingMode.HighQuality
  5285.             .PixelOffsetMode = PixelOffsetMode.HighQuality
  5286.             .TextRenderingHint = TextRenderingHint.ClearTypeGridFit
  5287.             .Clear(BackColor)
  5288.             'ColorBlend
  5289.             Dim Colors() As Color = {ColorBlend1, ColorBlend2, ColorBlend3, ColorBlend4}
  5290.             TrackColorBlend.Colors = Colors
  5291.             TrackColorBlend.Positions = ColorBlendPositions
  5292.             TrackBrush.InterpolationColors = TrackColorBlend
  5293.             'Value
  5294.             v = CInt((Value - Minimum) / (Maximum - Minimum) * (Width - 12))
  5295.             'Track
  5296.             Track = New Rectangle(v + 1, 1, 10, 20)
  5297.             'Tracker
  5298.             .FillRectangle(New SolidBrush(BaseColor), New Rectangle(0, 7, Width, 8))
  5299.             Select Case Style
  5300.                 Case S.Normal
  5301.                     .FillRectangle(New SolidBrush(TrackColor), New Rectangle(0, 7, Track.X, 8))
  5302.                 Case S.ColorBlend
  5303.                     .FillRectangle(TrackBrush, New Rectangle(0, 7, Track.X, 8))
  5304.             End Select
  5305.             'Slider
  5306.             .FillRectangle(New SolidBrush(BorderColor), v, 0, 12, 22)
  5307.             .FillRectangle(New SolidBrush(SliderColor), Track)
  5308.             'Show Value
  5309.             If ShowValue Then
  5310.                 Select Case ValuePosition
  5311.                     Case VP.Left
  5312.                         If ShowValuePercent Then
  5313.                             .DrawString(Value & "%", New Font("Segoe UI", 8), New SolidBrush(ValueColor), New Rectangle(-1, 22, 0, Height), Near)
  5314.                         Else
  5315.                             .DrawString(Value & "", New Font("Segoe UI", 8), New SolidBrush(ValueColor), New Rectangle(-1, 22, 0, Height), Near)
  5316.                         End If
  5317.                     Case VP.Center
  5318.                         If ShowValuePercent Then
  5319.                             .DrawString(Value & "%", New Font("Segoe UI", 8), New SolidBrush(ValueColor), New Rectangle(1, 13, Width, Height), Center)
  5320.                         Else
  5321.                             .DrawString(Value & "", New Font("Segoe UI", 8), New SolidBrush(ValueColor), New Rectangle(1, 13, Width, Height), Center)
  5322.                         End If
  5323.                     Case VP.Right
  5324.                         If ShowValuePercent Then
  5325.                             .DrawString(Value & "%", New Font("Segoe UI", 8), New SolidBrush(ValueColor), New Rectangle(2, 4, Width, Height), Far)
  5326.                         Else
  5327.                             .DrawString(Value & "", New Font("Segoe UI", 8), New SolidBrush(ValueColor), New Rectangle(2, 4, Width, Height), Far)
  5328.                         End If
  5329.                 End Select
  5330.             End If
  5331.         End With
  5332.         MyBase.OnPaint(e)
  5333.         G.Dispose()
  5334.         e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic
  5335.         e.Graphics.DrawImageUnscaled(B, 0, 0)
  5336.         B.Dispose()
  5337.     End Sub
  5338.  
  5339. End Class
  5340.  
  5341. Public Class Seperator : Inherits Control
  5342.  
  5343. #Region "Properties"
  5344.  
  5345.     Enum A
  5346.         Horizontal
  5347.         Vertical
  5348.     End Enum
  5349.  
  5350.     <Flags()>
  5351.     Enum S
  5352.         Normal
  5353.         ColorBlend
  5354.     End Enum
  5355.  
  5356.     Private _Alignment As A
  5357.     <Category("Properties")>
  5358.     Public Property Alignment As A
  5359.         Get
  5360.             Return _Alignment
  5361.         End Get
  5362.         Set(value As A)
  5363.             _Alignment = value
  5364.             Invalidate()
  5365.         End Set
  5366.     End Property
  5367.  
  5368.     Private _HorizontalStyle As S
  5369.     <Category("Properties")>
  5370.     Public Property HorizontalStyle As S
  5371.         Get
  5372.             Return _HorizontalStyle
  5373.         End Get
  5374.         Set(value As S)
  5375.             _HorizontalStyle = value
  5376.             Invalidate()
  5377.         End Set
  5378.     End Property
  5379.  
  5380.     Private _Thickness As Single = 2
  5381.     <Category("Properties")>
  5382.     Public Property Thickness As Single
  5383.         Get
  5384.             Return _Thickness
  5385.         End Get
  5386.         Set(value As Single)
  5387.             _Thickness = value
  5388.             Invalidate()
  5389.         End Set
  5390.     End Property
  5391.  
  5392. #End Region
  5393.  
  5394. #Region "Color Properties"
  5395.  
  5396.     <Category("Color Properties")>
  5397.     Public Property SeperatorColor As Color
  5398.         Get
  5399.             Return _SeperatorColor
  5400.         End Get
  5401.         Set(value As Color)
  5402.             _SeperatorColor = value
  5403.             Invalidate()
  5404.         End Set
  5405.     End Property
  5406.  
  5407.     <Category("Color Properties")>
  5408.     Public Property ColorBlend1 As Color
  5409.         Get
  5410.             Return _ColorBlend1
  5411.         End Get
  5412.         Set(value As Color)
  5413.             _ColorBlend1 = value
  5414.             Invalidate()
  5415.         End Set
  5416.     End Property
  5417.  
  5418.     <Category("Color Properties")>
  5419.     Public Property ColorBlend2 As Color
  5420.         Get
  5421.             Return _ColorBlend2
  5422.         End Get
  5423.         Set(value As Color)
  5424.             _ColorBlend2 = value
  5425.             Invalidate()
  5426.         End Set
  5427.     End Property
  5428.  
  5429.     <Category("Color Properties")>
  5430.     Public Property ColorBlend3 As Color
  5431.         Get
  5432.             Return _ColorBlend3
  5433.         End Get
  5434.         Set(value As Color)
  5435.             _ColorBlend3 = value
  5436.             Invalidate()
  5437.         End Set
  5438.     End Property
  5439.  
  5440.     <Category("Color Properties")>
  5441.     Public Property ColorBlend4 As Color
  5442.         Get
  5443.             Return _ColorBlend4
  5444.         End Get
  5445.         Set(value As Color)
  5446.             _ColorBlend4 = value
  5447.             Invalidate()
  5448.         End Set
  5449.     End Property
  5450.  
  5451. #End Region
  5452.  
  5453. #Region "Colors"
  5454.  
  5455.     Private _SeperatorColor As Color = Black
  5456.     Private _ColorBlend1 As Color = Orange
  5457.     Private _ColorBlend2 As Color = Red
  5458.     Private _ColorBlend3 As Color = Green
  5459.     Private _ColorBlend4 As Color = Blue
  5460.  
  5461. #End Region
  5462.  
  5463.     Sub New()
  5464.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or
  5465.                  ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer Or
  5466.                  ControlStyles.SupportsTransparentBackColor, True)
  5467.         DoubleBuffered = True
  5468.         BackColor = Color.Transparent
  5469.         Size = New Size(128, 10)
  5470.     End Sub
  5471.  
  5472.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  5473.         Dim G = e.Graphics
  5474.         Dim Base As New Rectangle(0, 0, Width, Height)
  5475.         Dim HorizontalColorBlend As New ColorBlend(4), SeperatorBrush As New LinearGradientBrush(Base, Color.Black, Color.Black, 0.0F)
  5476.         With G
  5477.             .SmoothingMode = SmoothingMode.HighQuality
  5478.             .PixelOffsetMode = PixelOffsetMode.HighQuality
  5479.             Dim Colors() As Color = {ColorBlend1, ColorBlend2, ColorBlend3, ColorBlend4}
  5480.             HorizontalColorBlend.Colors = Colors
  5481.             HorizontalColorBlend.Positions = ColorBlendPositions
  5482.             SeperatorBrush.InterpolationColors = HorizontalColorBlend
  5483.             Select Case Alignment
  5484.                 Case A.Horizontal
  5485.                     Select Case HorizontalStyle
  5486.                         Case S.Normal
  5487.                             .DrawLine(New Pen(SeperatorColor, Thickness), New Point(0, CInt(Height / 2)), New Point(Width, CInt(Height / 2)))
  5488.                         Case S.ColorBlend
  5489.                             .DrawLine(New Pen(SeperatorBrush, Thickness), New Point(0, CInt(Height / 2)), New Point(Width, CInt(Height / 2)))
  5490.                     End Select
  5491.                 Case A.Vertical
  5492.                     .DrawLine(New Pen(SeperatorColor, Thickness), New Point(CInt(Width / 2), CInt(0)), New Point(CInt(Width / 2), CInt(Height)))
  5493.             End Select
  5494.         End With
  5495.     End Sub
  5496.  
  5497. End Class
  5498.  
  5499. Public Class Numeric : Inherits Control
  5500.  
  5501. #Region "Variables"
  5502.  
  5503.     Private x, y As Integer
  5504.     Private Bool As Boolean
  5505.  
  5506. #End Region
  5507.  
  5508. #Region "Mouse States"
  5509.  
  5510.     Protected Overrides Sub OnMouseMove(e As MouseEventArgs)
  5511.         MyBase.OnMouseMove(e)
  5512.         x = e.Location.X
  5513.         y = e.Location.Y
  5514.         If e.X < Width - 26 Then Cursor = Cursors.IBeam Else Cursor = Cursors.Hand
  5515.     End Sub
  5516.  
  5517.     Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
  5518.         MyBase.OnMouseDown(e)
  5519.         If x > Width - 26 AndAlso x < Width Then
  5520.             If y < 15 Then
  5521.                 If Value + 1 <= Maximum Then Value += 1
  5522.             Else
  5523.                 If Value - 1 >= Minimum Then Value -= 1
  5524.             End If
  5525.         Else
  5526.             Bool = Not Bool
  5527.             Focus()
  5528.         End If
  5529.         Invalidate()
  5530.     End Sub
  5531.  
  5532. #End Region
  5533.  
  5534. #Region "Properties"
  5535.  
  5536.     Private _Border As Boolean = True
  5537.     <Category("Properties")>
  5538.     Public Property Border As Boolean
  5539.         Get
  5540.             Return _Border
  5541.         End Get
  5542.         Set(value As Boolean)
  5543.             _Border = value
  5544.             Invalidate()
  5545.         End Set
  5546.     End Property
  5547.  
  5548.     Private _Value As Long
  5549.     Public Property Value As Long
  5550.         Get
  5551.             Return _Value
  5552.         End Get
  5553.         Set(value As Long)
  5554.             If value <= Maximum And value >= Minimum Then _Value = value
  5555.             Invalidate()
  5556.         End Set
  5557.     End Property
  5558.  
  5559.     Private _Maximum As Long = 100
  5560.     Public Property Maximum As Long
  5561.         Get
  5562.             Return _Maximum
  5563.         End Get
  5564.         Set(value As Long)
  5565.             If value > Minimum Then _Maximum = value
  5566.             If _Value > Maximum Then _Value = Maximum
  5567.             Invalidate()
  5568.         End Set
  5569.     End Property
  5570.  
  5571.     Private _Minimum As Long = 0
  5572.     Public Property Minimum As Long
  5573.         Get
  5574.             Return _Minimum
  5575.         End Get
  5576.         Set(value As Long)
  5577.             If value < Maximum Then _Minimum = value
  5578.             If _Value < Minimum Then _Value = Minimum
  5579.             Invalidate()
  5580.         End Set
  5581.     End Property
  5582.  
  5583.     Protected Overrides Sub OnResize(e As EventArgs)
  5584.         MyBase.OnResize(e)
  5585.         Height = 30
  5586.     End Sub
  5587.  
  5588.     Protected Overrides Sub OnKeyPress(e As KeyPressEventArgs)
  5589.         MyBase.OnKeyPress(e)
  5590.         Try
  5591.             If Bool Then Value = CLng(Value & e.KeyChar.ToString())
  5592.             If Value > Maximum Then Value = Maximum
  5593.             Invalidate()
  5594.         Catch : End Try
  5595.     End Sub
  5596.  
  5597.     Protected Overrides Sub OnKeyDown(e As KeyEventArgs)
  5598.         MyBase.OnKeyDown(e)
  5599.         If e.KeyCode = Keys.Back Then
  5600.             Value = 0
  5601.         End If
  5602.     End Sub
  5603.  
  5604. #End Region
  5605.  
  5606. #Region "Color Properties"
  5607.  
  5608.     <Category("Color Properties")>
  5609.     Public Property BaseColor As Color
  5610.         Get
  5611.             Return _BaseColor
  5612.         End Get
  5613.         Set(value As Color)
  5614.             _BaseColor = value
  5615.         End Set
  5616.     End Property
  5617.  
  5618.     <Category("Color Properties")>
  5619.     Public Property ButtonColor As Color
  5620.         Get
  5621.             Return _ButtonColor
  5622.         End Get
  5623.         Set(value As Color)
  5624.             _ButtonColor = value
  5625.         End Set
  5626.     End Property
  5627.  
  5628.     <Category("Color Properties")>
  5629.     Public Property BorderColor As Color
  5630.         Get
  5631.             Return _BorderColor
  5632.         End Get
  5633.         Set(value As Color)
  5634.             _BorderColor = value
  5635.             Invalidate()
  5636.         End Set
  5637.     End Property
  5638.  
  5639.     <Category("Color Properties")>
  5640.     Public Property TextColor As Color
  5641.         Get
  5642.             Return _TextColor
  5643.         End Get
  5644.         Set(value As Color)
  5645.             _TextColor = value
  5646.             Invalidate()
  5647.         End Set
  5648.     End Property
  5649.  
  5650. #End Region
  5651.  
  5652. #Region "Colors"
  5653.  
  5654.     Private _BaseColor As Color = Black
  5655.     Private _BorderColor As Color = White
  5656.     Private _ButtonColor As Color = Color.FromArgb(30, 30, 30)
  5657.     Private _TextColor As Color = White
  5658.  
  5659. #End Region
  5660.  
  5661.     Sub New()
  5662.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or
  5663.         ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer Or
  5664.         ControlStyles.SupportsTransparentBackColor, True)
  5665.         DoubleBuffered = True
  5666.         Font = New Font("Segoe UI", 10)
  5667.         BackColor = Gray
  5668.     End Sub
  5669.  
  5670.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  5671.         B = New Bitmap(Width, Height) : G = Graphics.FromImage(B)
  5672.         Dim Base As New Rectangle(0, 0, Width, Height)
  5673.         With G
  5674.             .SmoothingMode = SmoothingMode.HighQuality
  5675.             .PixelOffsetMode = PixelOffsetMode.HighQuality
  5676.             .TextRenderingHint = TextRenderingHint.ClearTypeGridFit
  5677.             .Clear(BackColor)
  5678.             'Base
  5679.             .FillRectangle(New SolidBrush(BaseColor), Base)
  5680.             .FillRectangle(New SolidBrush(ButtonColor), New Rectangle(Width - 24, 0, 24, Height))
  5681.             '+ & -
  5682.             'Add
  5683.             .DrawString("+", New Font("Segoe UI", 10), New SolidBrush(White), New Point(Width - 12, 10), Center)
  5684.             'Subtract
  5685.             .DrawString("-", New Font("Segoe UI", 10), New SolidBrush(White), New Point(Width - 12, 22), Center)
  5686.             If x > Width - 26 AndAlso x < Width Then
  5687.                 If y < 15 Then
  5688.                     'Add
  5689.                     .DrawString("+", New Font("Segoe UI", 10), New SolidBrush(Green), New Point(Width - 12, 10), Center)
  5690.                 Else
  5691.                     'Subtract
  5692.                     .DrawString("-", New Font("Segoe UI", 10), New SolidBrush(Red), New Point(Width - 12, 22), Center)
  5693.                 End If
  5694.             End If
  5695.             'BorderStyle
  5696.             If Border Then
  5697.                 .DrawRectangle(New Pen(BorderColor), Base)
  5698.                 .DrawLine(New Pen(BorderColor), Width - 25, 1, Width - 25, 29)
  5699.             End If
  5700.             'Text
  5701.             .DrawString(Value & "", Font, New SolidBrush(TextColor), New Rectangle(5, 6, Width, Height), Near)
  5702.         End With
  5703.         MyBase.OnPaint(e)
  5704.         G.Dispose()
  5705.         e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic
  5706.         e.Graphics.DrawImageUnscaled(B, 0, 0)
  5707.         B.Dispose()
  5708.     End Sub
  5709.  
  5710. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement