Advertisement
ibennz

SLC Theme

Jun 25th, 2013
6,515
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 145.81 KB | None | 0 0
  1. 'IMPORTANT:
  2. 'Please leave these comments in place as they help protect intellectual rights and allow
  3. 'developers to determine the version of the theme they are using.
  4. 'Name: SLC Theme
  5. 'Created: Not defined yet
  6. 'Version: 1.0.0.0 beta
  7. 'Site: http://sliceproducts.pw/
  8.  
  9. 'Copyright © 2013 Slice Software
  10. 'Special Thanks to : Aeonhack http://nimoru.com/
  11.  
  12.  
  13. #Region "Theme Container"
  14. Imports System, System.IO, System.Collections.Generic
  15. Imports System.Drawing, System.Drawing.Drawing2D
  16. Imports System.ComponentModel, System.Windows.Forms
  17. Imports System.Runtime.InteropServices
  18. Imports System.Drawing.Imaging
  19.  
  20. '------------------
  21. 'Creator: aeonhack
  22. 'Site: elitevs.net
  23. 'Created: 08/02/2011
  24. 'Changed: 12/06/2011
  25. 'Version: 1.5.4
  26. '------------------
  27.  
  28. MustInherit Class ThemeContainer154
  29.     Inherits ContainerControl
  30.  
  31. #Region " Initialization "
  32.  
  33.     Protected G As Graphics, B As Bitmap
  34.  
  35.     Sub New()
  36.         SetStyle(DirectCast(139270, ControlStyles), True)
  37.  
  38.         _ImageSize = Size.Empty
  39.         Font = New Font("Verdana", 8S)
  40.  
  41.         MeasureBitmap = New Bitmap(1, 1)
  42.         MeasureGraphics = Graphics.FromImage(MeasureBitmap)
  43.  
  44.         DrawRadialPath = New GraphicsPath
  45.  
  46.         InvalidateCustimization()
  47.     End Sub
  48.  
  49.     Protected NotOverridable Overrides Sub OnHandleCreated(ByVal e As EventArgs)
  50.         If DoneCreation Then InitializeMessages()
  51.  
  52.         InvalidateCustimization()
  53.         ColorHook()
  54.  
  55.         If Not _LockWidth = 0 Then Width = _LockWidth
  56.         If Not _LockHeight = 0 Then Height = _LockHeight
  57.         If Not _ControlMode Then MyBase.Dock = DockStyle.Fill
  58.  
  59.         Transparent = _Transparent
  60.         If _Transparent AndAlso _BackColor Then BackColor = Color.Transparent
  61.  
  62.         MyBase.OnHandleCreated(e)
  63.     End Sub
  64.  
  65.     Private DoneCreation As Boolean
  66.     Protected NotOverridable Overrides Sub OnParentChanged(ByVal e As EventArgs)
  67.         MyBase.OnParentChanged(e)
  68.  
  69.         If Parent Is Nothing Then Return
  70.         _IsParentForm = TypeOf Parent Is Form
  71.  
  72.         If Not _ControlMode Then
  73.             InitializeMessages()
  74.  
  75.             If _IsParentForm Then
  76.                 ParentForm.FormBorderStyle = _BorderStyle
  77.                 ParentForm.TransparencyKey = _TransparencyKey
  78.  
  79.                 If Not DesignMode Then
  80.                     AddHandler ParentForm.Shown, AddressOf FormShown
  81.                 End If
  82.             End If
  83.  
  84.             Parent.BackColor = BackColor
  85.         End If
  86.  
  87.         OnCreation()
  88.         DoneCreation = True
  89.         InvalidateTimer()
  90.     End Sub
  91.  
  92. #End Region
  93.  
  94.     Private Sub DoAnimation(ByVal i As Boolean)
  95.         OnAnimation()
  96.         If i Then Invalidate()
  97.     End Sub
  98.  
  99.     Protected NotOverridable Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  100.         If Width = 0 OrElse Height = 0 Then Return
  101.  
  102.         If _Transparent AndAlso _ControlMode Then
  103.             PaintHook()
  104.             e.Graphics.DrawImage(B, 0, 0)
  105.         Else
  106.             G = e.Graphics
  107.             PaintHook()
  108.         End If
  109.     End Sub
  110.  
  111.     Protected Overrides Sub OnHandleDestroyed(ByVal e As EventArgs)
  112.         RemoveAnimationCallback(AddressOf DoAnimation)
  113.         MyBase.OnHandleDestroyed(e)
  114.     End Sub
  115.  
  116.     Private HasShown As Boolean
  117.     Private Sub FormShown(ByVal sender As Object, ByVal e As EventArgs)
  118.         If _ControlMode OrElse HasShown Then Return
  119.  
  120.         If _StartPosition = FormStartPosition.CenterParent OrElse _StartPosition = FormStartPosition.CenterScreen Then
  121.             Dim SB As Rectangle = Screen.PrimaryScreen.Bounds
  122.             Dim CB As Rectangle = ParentForm.Bounds
  123.             ParentForm.Location = New Point(SB.Width \ 2 - CB.Width \ 2, SB.Height \ 2 - CB.Width \ 2)
  124.         End If
  125.  
  126.         HasShown = True
  127.     End Sub
  128.  
  129.  
  130. #Region " Size Handling "
  131.  
  132.     Private Frame As Rectangle
  133.     Protected NotOverridable Overrides Sub OnSizeChanged(ByVal e As EventArgs)
  134.         If _Movable AndAlso Not _ControlMode Then
  135.             Frame = New Rectangle(7, 7, Width - 14, _Header - 7)
  136.         End If
  137.  
  138.         InvalidateBitmap()
  139.         Invalidate()
  140.  
  141.         MyBase.OnSizeChanged(e)
  142.     End Sub
  143.  
  144.     Protected Overrides Sub SetBoundsCore(ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal specified As BoundsSpecified)
  145.         If Not _LockWidth = 0 Then width = _LockWidth
  146.         If Not _LockHeight = 0 Then height = _LockHeight
  147.         MyBase.SetBoundsCore(x, y, width, height, specified)
  148.     End Sub
  149.  
  150. #End Region
  151.  
  152. #Region " State Handling "
  153.  
  154.     Protected State As MouseState
  155.     Private Sub SetState(ByVal current As MouseState)
  156.         State = current
  157.         Invalidate()
  158.     End Sub
  159.  
  160.     Protected Overrides Sub OnMouseMove(ByVal e As MouseEventArgs)
  161.         If Not (_IsParentForm AndAlso ParentForm.WindowState = FormWindowState.Maximized) Then
  162.             If _Sizable AndAlso Not _ControlMode Then InvalidateMouse()
  163.         End If
  164.  
  165.         MyBase.OnMouseMove(e)
  166.     End Sub
  167.  
  168.     Protected Overrides Sub OnEnabledChanged(ByVal e As EventArgs)
  169.         If Enabled Then SetState(MouseState.None) Else SetState(MouseState.Block)
  170.         MyBase.OnEnabledChanged(e)
  171.     End Sub
  172.  
  173.     Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
  174.         SetState(MouseState.Over)
  175.         MyBase.OnMouseEnter(e)
  176.     End Sub
  177.  
  178.     Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  179.         SetState(MouseState.Over)
  180.         MyBase.OnMouseUp(e)
  181.     End Sub
  182.  
  183.     Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
  184.         SetState(MouseState.None)
  185.  
  186.         If GetChildAtPoint(PointToClient(MousePosition)) IsNot Nothing Then
  187.             If _Sizable AndAlso Not _ControlMode Then
  188.                 Cursor = Cursors.Default
  189.                 Previous = 0
  190.             End If
  191.         End If
  192.  
  193.         MyBase.OnMouseLeave(e)
  194.     End Sub
  195.  
  196.     Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  197.         If e.Button = Windows.Forms.MouseButtons.Left Then SetState(MouseState.Down)
  198.  
  199.         If Not (_IsParentForm AndAlso ParentForm.WindowState = FormWindowState.Maximized OrElse _ControlMode) Then
  200.             If _Movable AndAlso Frame.Contains(e.Location) Then
  201.                 Capture = False
  202.                 WM_LMBUTTONDOWN = True
  203.                 DefWndProc(Messages(0))
  204.             ElseIf _Sizable AndAlso Not Previous = 0 Then
  205.                 Capture = False
  206.                 WM_LMBUTTONDOWN = True
  207.                 DefWndProc(Messages(Previous))
  208.             End If
  209.         End If
  210.  
  211.         MyBase.OnMouseDown(e)
  212.     End Sub
  213.  
  214.     Private WM_LMBUTTONDOWN As Boolean
  215.     Protected Overrides Sub WndProc(ByRef m As Message)
  216.         MyBase.WndProc(m)
  217.  
  218.         If WM_LMBUTTONDOWN AndAlso m.Msg = 513 Then
  219.             WM_LMBUTTONDOWN = False
  220.  
  221.             SetState(MouseState.Over)
  222.             If Not _SmartBounds Then Return
  223.  
  224.             If IsParentMdi Then
  225.                 CorrectBounds(New Rectangle(Point.Empty, Parent.Parent.Size))
  226.             Else
  227.                 CorrectBounds(Screen.FromControl(Parent).WorkingArea)
  228.             End If
  229.         End If
  230.     End Sub
  231.  
  232.     Private GetIndexPoint As Point
  233.     Private B1, B2, B3, B4 As Boolean
  234.     Private Function GetIndex() As Integer
  235.         GetIndexPoint = PointToClient(MousePosition)
  236.         B1 = GetIndexPoint.X < 7
  237.         B2 = GetIndexPoint.X > Width - 7
  238.         B3 = GetIndexPoint.Y < 7
  239.         B4 = GetIndexPoint.Y > Height - 7
  240.  
  241.         If B1 AndAlso B3 Then Return 4
  242.         If B1 AndAlso B4 Then Return 7
  243.         If B2 AndAlso B3 Then Return 5
  244.         If B2 AndAlso B4 Then Return 8
  245.         If B1 Then Return 1
  246.         If B2 Then Return 2
  247.         If B3 Then Return 3
  248.         If B4 Then Return 6
  249.         Return 0
  250.     End Function
  251.  
  252.     Private Current, Previous As Integer
  253.     Private Sub InvalidateMouse()
  254.         Current = GetIndex()
  255.         If Current = Previous Then Return
  256.  
  257.         Previous = Current
  258.         Select Case Previous
  259.             Case 0
  260.                 Cursor = Cursors.Default
  261.             Case 1, 2
  262.                 Cursor = Cursors.SizeWE
  263.             Case 3, 6
  264.                 Cursor = Cursors.SizeNS
  265.             Case 4, 8
  266.                 Cursor = Cursors.SizeNWSE
  267.             Case 5, 7
  268.                 Cursor = Cursors.SizeNESW
  269.         End Select
  270.     End Sub
  271.  
  272.     Private Messages(8) As Message
  273.     Private Sub InitializeMessages()
  274.         Messages(0) = Message.Create(Parent.Handle, 161, New IntPtr(2), IntPtr.Zero)
  275.         For I As Integer = 1 To 8
  276.             Messages(I) = Message.Create(Parent.Handle, 161, New IntPtr(I + 9), IntPtr.Zero)
  277.         Next
  278.     End Sub
  279.  
  280.     Private Sub CorrectBounds(ByVal bounds As Rectangle)
  281.         If Parent.Width > bounds.Width Then Parent.Width = bounds.Width
  282.         If Parent.Height > bounds.Height Then Parent.Height = bounds.Height
  283.  
  284.         Dim X As Integer = Parent.Location.X
  285.         Dim Y As Integer = Parent.Location.Y
  286.  
  287.         If X < bounds.X Then X = bounds.X
  288.         If Y < bounds.Y Then Y = bounds.Y
  289.  
  290.         Dim Width As Integer = bounds.X + bounds.Width
  291.         Dim Height As Integer = bounds.Y + bounds.Height
  292.  
  293.         If X + Parent.Width > Width Then X = Width - Parent.Width
  294.         If Y + Parent.Height > Height Then Y = Height - Parent.Height
  295.  
  296.         Parent.Location = New Point(X, Y)
  297.     End Sub
  298.  
  299. #End Region
  300.  
  301.  
  302. #Region " Base Properties "
  303.  
  304.     Overrides Property Dock As DockStyle
  305.         Get
  306.             Return MyBase.Dock
  307.         End Get
  308.         Set(ByVal value As DockStyle)
  309.             If Not _ControlMode Then Return
  310.             MyBase.Dock = value
  311.         End Set
  312.     End Property
  313.  
  314.     Private _BackColor As Boolean
  315.     <Category("Misc")> _
  316.     Overrides Property BackColor() As Color
  317.         Get
  318.             Return MyBase.BackColor
  319.         End Get
  320.         Set(ByVal value As Color)
  321.             If value = MyBase.BackColor Then Return
  322.  
  323.             If Not IsHandleCreated AndAlso _ControlMode AndAlso value = Color.Transparent Then
  324.                 _BackColor = True
  325.                 Return
  326.             End If
  327.  
  328.             MyBase.BackColor = value
  329.             If Parent IsNot Nothing Then
  330.                 If Not _ControlMode Then Parent.BackColor = value
  331.                 ColorHook()
  332.             End If
  333.         End Set
  334.     End Property
  335.  
  336.     Overrides Property MinimumSize As Size
  337.         Get
  338.             Return MyBase.MinimumSize
  339.         End Get
  340.         Set(ByVal value As Size)
  341.             MyBase.MinimumSize = value
  342.             If Parent IsNot Nothing Then Parent.MinimumSize = value
  343.         End Set
  344.     End Property
  345.  
  346.     Overrides Property MaximumSize As Size
  347.         Get
  348.             Return MyBase.MaximumSize
  349.         End Get
  350.         Set(ByVal value As Size)
  351.             MyBase.MaximumSize = value
  352.             If Parent IsNot Nothing Then Parent.MaximumSize = value
  353.         End Set
  354.     End Property
  355.  
  356.     Overrides Property Text() As String
  357.         Get
  358.             Return MyBase.Text
  359.         End Get
  360.         Set(ByVal value As String)
  361.             MyBase.Text = value
  362.             Invalidate()
  363.         End Set
  364.     End Property
  365.  
  366.     Overrides Property Font() As Font
  367.         Get
  368.             Return MyBase.Font
  369.         End Get
  370.         Set(ByVal value As Font)
  371.             MyBase.Font = value
  372.             Invalidate()
  373.         End Set
  374.     End Property
  375.  
  376.     <Browsable(False), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
  377.     Overrides Property ForeColor() As Color
  378.         Get
  379.             Return Color.Empty
  380.         End Get
  381.         Set(ByVal value As Color)
  382.         End Set
  383.     End Property
  384.     <Browsable(False), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
  385.     Overrides Property BackgroundImage() As Image
  386.         Get
  387.             Return Nothing
  388.         End Get
  389.         Set(ByVal value As Image)
  390.         End Set
  391.     End Property
  392.     <Browsable(False), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
  393.     Overrides Property BackgroundImageLayout() As ImageLayout
  394.         Get
  395.             Return ImageLayout.None
  396.         End Get
  397.         Set(ByVal value As ImageLayout)
  398.         End Set
  399.     End Property
  400.  
  401. #End Region
  402.  
  403. #Region " Public Properties "
  404.  
  405.     Private _SmartBounds As Boolean = True
  406.     Property SmartBounds() As Boolean
  407.         Get
  408.             Return _SmartBounds
  409.         End Get
  410.         Set(ByVal value As Boolean)
  411.             _SmartBounds = value
  412.         End Set
  413.     End Property
  414.  
  415.     Private _Movable As Boolean = True
  416.     Property Movable() As Boolean
  417.         Get
  418.             Return _Movable
  419.         End Get
  420.         Set(ByVal value As Boolean)
  421.             _Movable = value
  422.         End Set
  423.     End Property
  424.  
  425.     Private _Sizable As Boolean = True
  426.     Property Sizable() As Boolean
  427.         Get
  428.             Return _Sizable
  429.         End Get
  430.         Set(ByVal value As Boolean)
  431.             _Sizable = value
  432.         End Set
  433.     End Property
  434.  
  435.     Private _TransparencyKey As Color
  436.     Property TransparencyKey() As Color
  437.         Get
  438.             If _IsParentForm AndAlso Not _ControlMode Then Return ParentForm.TransparencyKey Else Return _TransparencyKey
  439.         End Get
  440.         Set(ByVal value As Color)
  441.             If value = _TransparencyKey Then Return
  442.             _TransparencyKey = value
  443.  
  444.             If _IsParentForm AndAlso Not _ControlMode Then
  445.                 ParentForm.TransparencyKey = value
  446.                 ColorHook()
  447.             End If
  448.         End Set
  449.     End Property
  450.  
  451.     Private _BorderStyle As FormBorderStyle
  452.     Property BorderStyle() As FormBorderStyle
  453.         Get
  454.             If _IsParentForm AndAlso Not _ControlMode Then Return ParentForm.FormBorderStyle Else Return _BorderStyle
  455.         End Get
  456.         Set(ByVal value As FormBorderStyle)
  457.             _BorderStyle = value
  458.  
  459.             If _IsParentForm AndAlso Not _ControlMode Then
  460.                 ParentForm.FormBorderStyle = value
  461.  
  462.                 If Not value = FormBorderStyle.None Then
  463.                     Movable = False
  464.                     Sizable = False
  465.                 End If
  466.             End If
  467.         End Set
  468.     End Property
  469.  
  470.     Private _StartPosition As FormStartPosition
  471.     Property StartPosition As FormStartPosition
  472.         Get
  473.             If _IsParentForm AndAlso Not _ControlMode Then Return ParentForm.StartPosition Else Return _StartPosition
  474.         End Get
  475.         Set(ByVal value As FormStartPosition)
  476.             _StartPosition = value
  477.  
  478.             If _IsParentForm AndAlso Not _ControlMode Then
  479.                 ParentForm.StartPosition = value
  480.             End If
  481.         End Set
  482.     End Property
  483.  
  484.     Private _NoRounding As Boolean
  485.     Property NoRounding() As Boolean
  486.         Get
  487.             Return _NoRounding
  488.         End Get
  489.         Set(ByVal v As Boolean)
  490.             _NoRounding = v
  491.             Invalidate()
  492.         End Set
  493.     End Property
  494.  
  495.     Private _Image As Image
  496.     Property Image() As Image
  497.         Get
  498.             Return _Image
  499.         End Get
  500.         Set(ByVal value As Image)
  501.             If value Is Nothing Then _ImageSize = Size.Empty Else _ImageSize = value.Size
  502.  
  503.             _Image = value
  504.             Invalidate()
  505.         End Set
  506.     End Property
  507.  
  508.     Private Items As New Dictionary(Of String, Color)
  509.     Property Colors() As Bloom()
  510.         Get
  511.             Dim T As New List(Of Bloom)
  512.             Dim E As Dictionary(Of String, Color).Enumerator = Items.GetEnumerator
  513.  
  514.             While E.MoveNext
  515.                 T.Add(New Bloom(E.Current.Key, E.Current.Value))
  516.             End While
  517.  
  518.             Return T.ToArray
  519.         End Get
  520.         Set(ByVal value As Bloom())
  521.             For Each B As Bloom In value
  522.                 If Items.ContainsKey(B.Name) Then Items(B.Name) = B.Value
  523.             Next
  524.  
  525.             InvalidateCustimization()
  526.             ColorHook()
  527.             Invalidate()
  528.         End Set
  529.     End Property
  530.  
  531.     Private _Customization As String
  532.     Property Customization() As String
  533.         Get
  534.             Return _Customization
  535.         End Get
  536.         Set(ByVal value As String)
  537.             If value = _Customization Then Return
  538.  
  539.             Dim Data As Byte()
  540.             Dim Items As Bloom() = Colors
  541.  
  542.             Try
  543.                 Data = Convert.FromBase64String(value)
  544.                 For I As Integer = 0 To Items.Length - 1
  545.                     Items(I).Value = Color.FromArgb(BitConverter.ToInt32(Data, I * 4))
  546.                 Next
  547.             Catch
  548.                 Return
  549.             End Try
  550.  
  551.             _Customization = value
  552.  
  553.             Colors = Items
  554.             ColorHook()
  555.             Invalidate()
  556.         End Set
  557.     End Property
  558.  
  559.     Private _Transparent As Boolean
  560.     Property Transparent() As Boolean
  561.         Get
  562.             Return _Transparent
  563.         End Get
  564.         Set(ByVal value As Boolean)
  565.             _Transparent = value
  566.             If Not (IsHandleCreated OrElse _ControlMode) Then Return
  567.  
  568.             If Not value AndAlso Not BackColor.A = 255 Then
  569.                 Throw New Exception("Unable to change value to false while a transparent BackColor is in use.")
  570.             End If
  571.  
  572.             SetStyle(ControlStyles.Opaque, Not value)
  573.             SetStyle(ControlStyles.SupportsTransparentBackColor, value)
  574.  
  575.             InvalidateBitmap()
  576.             Invalidate()
  577.         End Set
  578.     End Property
  579.  
  580. #End Region
  581.  
  582. #Region " Private Properties "
  583.  
  584.     Private _ImageSize As Size
  585.     Protected ReadOnly Property ImageSize() As Size
  586.         Get
  587.             Return _ImageSize
  588.         End Get
  589.     End Property
  590.  
  591.     Private _IsParentForm As Boolean
  592.     Protected ReadOnly Property IsParentForm As Boolean
  593.         Get
  594.             Return _IsParentForm
  595.         End Get
  596.     End Property
  597.  
  598.     Protected ReadOnly Property IsParentMdi As Boolean
  599.         Get
  600.             If Parent Is Nothing Then Return False
  601.             Return Parent.Parent IsNot Nothing
  602.         End Get
  603.     End Property
  604.  
  605.     Private _LockWidth As Integer
  606.     Protected Property LockWidth() As Integer
  607.         Get
  608.             Return _LockWidth
  609.         End Get
  610.         Set(ByVal value As Integer)
  611.             _LockWidth = value
  612.             If Not LockWidth = 0 AndAlso IsHandleCreated Then Width = LockWidth
  613.         End Set
  614.     End Property
  615.  
  616.     Private _LockHeight As Integer
  617.     Protected Property LockHeight() As Integer
  618.         Get
  619.             Return _LockHeight
  620.         End Get
  621.         Set(ByVal value As Integer)
  622.             _LockHeight = value
  623.             If Not LockHeight = 0 AndAlso IsHandleCreated Then Height = LockHeight
  624.         End Set
  625.     End Property
  626.  
  627.     Private _Header As Integer = 24
  628.     Protected Property Header() As Integer
  629.         Get
  630.             Return _Header
  631.         End Get
  632.         Set(ByVal v As Integer)
  633.             _Header = v
  634.  
  635.             If Not _ControlMode Then
  636.                 Frame = New Rectangle(7, 7, Width - 14, v - 7)
  637.                 Invalidate()
  638.             End If
  639.         End Set
  640.     End Property
  641.  
  642.     Private _ControlMode As Boolean
  643.     Protected Property ControlMode() As Boolean
  644.         Get
  645.             Return _ControlMode
  646.         End Get
  647.         Set(ByVal v As Boolean)
  648.             _ControlMode = v
  649.  
  650.             Transparent = _Transparent
  651.             If _Transparent AndAlso _BackColor Then BackColor = Color.Transparent
  652.  
  653.             InvalidateBitmap()
  654.             Invalidate()
  655.         End Set
  656.     End Property
  657.  
  658.     Private _IsAnimated As Boolean
  659.     Protected Property IsAnimated() As Boolean
  660.         Get
  661.             Return _IsAnimated
  662.         End Get
  663.         Set(ByVal value As Boolean)
  664.             _IsAnimated = value
  665.             InvalidateTimer()
  666.         End Set
  667.     End Property
  668.  
  669. #End Region
  670.  
  671.  
  672. #Region " Property Helpers "
  673.  
  674.     Protected Function GetPen(ByVal name As String) As Pen
  675.         Return New Pen(Items(name))
  676.     End Function
  677.     Protected Function GetPen(ByVal name As String, ByVal width As Single) As Pen
  678.         Return New Pen(Items(name), width)
  679.     End Function
  680.  
  681.     Protected Function GetBrush(ByVal name As String) As SolidBrush
  682.         Return New SolidBrush(Items(name))
  683.     End Function
  684.  
  685.     Protected Function GetColor(ByVal name As String) As Color
  686.         Return Items(name)
  687.     End Function
  688.  
  689.     Protected Sub SetColor(ByVal name As String, ByVal value As Color)
  690.         If Items.ContainsKey(name) Then Items(name) = value Else Items.Add(name, value)
  691.     End Sub
  692.     Protected Sub SetColor(ByVal name As String, ByVal r As Byte, ByVal g As Byte, ByVal b As Byte)
  693.         SetColor(name, Color.FromArgb(r, g, b))
  694.     End Sub
  695.     Protected Sub SetColor(ByVal name As String, ByVal a As Byte, ByVal r As Byte, ByVal g As Byte, ByVal b As Byte)
  696.         SetColor(name, Color.FromArgb(a, r, g, b))
  697.     End Sub
  698.     Protected Sub SetColor(ByVal name As String, ByVal a As Byte, ByVal value As Color)
  699.         SetColor(name, Color.FromArgb(a, value))
  700.     End Sub
  701.  
  702.     Private Sub InvalidateBitmap()
  703.         If _Transparent AndAlso _ControlMode Then
  704.             If Width = 0 OrElse Height = 0 Then Return
  705.             B = New Bitmap(Width, Height, PixelFormat.Format32bppPArgb)
  706.             G = Graphics.FromImage(B)
  707.         Else
  708.             G = Nothing
  709.             B = Nothing
  710.         End If
  711.     End Sub
  712.  
  713.     Private Sub InvalidateCustimization()
  714.         Dim M As New MemoryStream(Items.Count * 4)
  715.  
  716.         For Each B As Bloom In Colors
  717.             M.Write(BitConverter.GetBytes(B.Value.ToArgb), 0, 4)
  718.         Next
  719.  
  720.         M.Close()
  721.         _Customization = Convert.ToBase64String(M.ToArray)
  722.     End Sub
  723.  
  724.     Private Sub InvalidateTimer()
  725.         If DesignMode OrElse Not DoneCreation Then Return
  726.  
  727.         If _IsAnimated Then
  728.             AddAnimationCallback(AddressOf DoAnimation)
  729.         Else
  730.             RemoveAnimationCallback(AddressOf DoAnimation)
  731.         End If
  732.     End Sub
  733.  
  734. #End Region
  735.  
  736.  
  737. #Region " User Hooks "
  738.  
  739.     Protected MustOverride Sub ColorHook()
  740.     Protected MustOverride Sub PaintHook()
  741.  
  742.     Protected Overridable Sub OnCreation()
  743.     End Sub
  744.  
  745.     Protected Overridable Sub OnAnimation()
  746.     End Sub
  747.  
  748. #End Region
  749.  
  750.  
  751. #Region " Offset "
  752.  
  753.     Private OffsetReturnRectangle As Rectangle
  754.     Protected Function Offset(ByVal r As Rectangle, ByVal amount As Integer) As Rectangle
  755.         OffsetReturnRectangle = New Rectangle(r.X + amount, r.Y + amount, r.Width - (amount * 2), r.Height - (amount * 2))
  756.         Return OffsetReturnRectangle
  757.     End Function
  758.  
  759.     Private OffsetReturnSize As Size
  760.     Protected Function Offset(ByVal s As Size, ByVal amount As Integer) As Size
  761.         OffsetReturnSize = New Size(s.Width + amount, s.Height + amount)
  762.         Return OffsetReturnSize
  763.     End Function
  764.  
  765.     Private OffsetReturnPoint As Point
  766.     Protected Function Offset(ByVal p As Point, ByVal amount As Integer) As Point
  767.         OffsetReturnPoint = New Point(p.X + amount, p.Y + amount)
  768.         Return OffsetReturnPoint
  769.     End Function
  770.  
  771. #End Region
  772.  
  773. #Region " Center "
  774.  
  775.     Private CenterReturn As Point
  776.  
  777.     Protected Function Center(ByVal p As Rectangle, ByVal c As Rectangle) As Point
  778.         CenterReturn = New Point((p.Width \ 2 - c.Width \ 2) + p.X + c.X, (p.Height \ 2 - c.Height \ 2) + p.Y + c.Y)
  779.         Return CenterReturn
  780.     End Function
  781.     Protected Function Center(ByVal p As Rectangle, ByVal c As Size) As Point
  782.         CenterReturn = New Point((p.Width \ 2 - c.Width \ 2) + p.X, (p.Height \ 2 - c.Height \ 2) + p.Y)
  783.         Return CenterReturn
  784.     End Function
  785.  
  786.     Protected Function Center(ByVal child As Rectangle) As Point
  787.         Return Center(Width, Height, child.Width, child.Height)
  788.     End Function
  789.     Protected Function Center(ByVal child As Size) As Point
  790.         Return Center(Width, Height, child.Width, child.Height)
  791.     End Function
  792.     Protected Function Center(ByVal childWidth As Integer, ByVal childHeight As Integer) As Point
  793.         Return Center(Width, Height, childWidth, childHeight)
  794.     End Function
  795.  
  796.     Protected Function Center(ByVal p As Size, ByVal c As Size) As Point
  797.         Return Center(p.Width, p.Height, c.Width, c.Height)
  798.     End Function
  799.  
  800.     Protected Function Center(ByVal pWidth As Integer, ByVal pHeight As Integer, ByVal cWidth As Integer, ByVal cHeight As Integer) As Point
  801.         CenterReturn = New Point(pWidth \ 2 - cWidth \ 2, pHeight \ 2 - cHeight \ 2)
  802.         Return CenterReturn
  803.     End Function
  804.  
  805. #End Region
  806.  
  807. #Region " Measure "
  808.  
  809.     Private MeasureBitmap As Bitmap
  810.     Private MeasureGraphics As Graphics
  811.  
  812.     Protected Function Measure() As Size
  813.         SyncLock MeasureGraphics
  814.             Return MeasureGraphics.MeasureString(Text, Font, Width).ToSize
  815.         End SyncLock
  816.     End Function
  817.     Protected Function Measure(ByVal text As String) As Size
  818.         SyncLock MeasureGraphics
  819.             Return MeasureGraphics.MeasureString(text, Font, Width).ToSize
  820.         End SyncLock
  821.     End Function
  822.  
  823. #End Region
  824.  
  825.  
  826. #Region " DrawPixel "
  827.  
  828.     Private DrawPixelBrush As SolidBrush
  829.  
  830.     Protected Sub DrawPixel(ByVal c1 As Color, ByVal x As Integer, ByVal y As Integer)
  831.         If _Transparent Then
  832.             B.SetPixel(x, y, c1)
  833.         Else
  834.             DrawPixelBrush = New SolidBrush(c1)
  835.             G.FillRectangle(DrawPixelBrush, x, y, 1, 1)
  836.         End If
  837.     End Sub
  838.  
  839. #End Region
  840.  
  841. #Region " DrawCorners "
  842.  
  843.     Private DrawCornersBrush As SolidBrush
  844.  
  845.     Protected Sub DrawCorners(ByVal c1 As Color, ByVal offset As Integer)
  846.         DrawCorners(c1, 0, 0, Width, Height, offset)
  847.     End Sub
  848.     Protected Sub DrawCorners(ByVal c1 As Color, ByVal r1 As Rectangle, ByVal offset As Integer)
  849.         DrawCorners(c1, r1.X, r1.Y, r1.Width, r1.Height, offset)
  850.     End Sub
  851.     Protected Sub DrawCorners(ByVal c1 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal offset As Integer)
  852.         DrawCorners(c1, x + offset, y + offset, width - (offset * 2), height - (offset * 2))
  853.     End Sub
  854.  
  855.     Protected Sub DrawCorners(ByVal c1 As Color)
  856.         DrawCorners(c1, 0, 0, Width, Height)
  857.     End Sub
  858.     Protected Sub DrawCorners(ByVal c1 As Color, ByVal r1 As Rectangle)
  859.         DrawCorners(c1, r1.X, r1.Y, r1.Width, r1.Height)
  860.     End Sub
  861.     Protected Sub DrawCorners(ByVal c1 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
  862.         If _NoRounding Then Return
  863.  
  864.         If _Transparent Then
  865.             B.SetPixel(x, y, c1)
  866.             B.SetPixel(x + (width - 1), y, c1)
  867.             B.SetPixel(x, y + (height - 1), c1)
  868.             B.SetPixel(x + (width - 1), y + (height - 1), c1)
  869.         Else
  870.             DrawCornersBrush = New SolidBrush(c1)
  871.             G.FillRectangle(DrawCornersBrush, x, y, 1, 1)
  872.             G.FillRectangle(DrawCornersBrush, x + (width - 1), y, 1, 1)
  873.             G.FillRectangle(DrawCornersBrush, x, y + (height - 1), 1, 1)
  874.             G.FillRectangle(DrawCornersBrush, x + (width - 1), y + (height - 1), 1, 1)
  875.         End If
  876.     End Sub
  877.  
  878. #End Region
  879.  
  880. #Region " DrawBorders "
  881.  
  882.     Protected Sub DrawBorders(ByVal p1 As Pen, ByVal offset As Integer)
  883.         DrawBorders(p1, 0, 0, Width, Height, offset)
  884.     End Sub
  885.     Protected Sub DrawBorders(ByVal p1 As Pen, ByVal r As Rectangle, ByVal offset As Integer)
  886.         DrawBorders(p1, r.X, r.Y, r.Width, r.Height, offset)
  887.     End Sub
  888.     Protected Sub DrawBorders(ByVal p1 As Pen, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal offset As Integer)
  889.         DrawBorders(p1, x + offset, y + offset, width - (offset * 2), height - (offset * 2))
  890.     End Sub
  891.  
  892.     Protected Sub DrawBorders(ByVal p1 As Pen)
  893.         DrawBorders(p1, 0, 0, Width, Height)
  894.     End Sub
  895.     Protected Sub DrawBorders(ByVal p1 As Pen, ByVal r As Rectangle)
  896.         DrawBorders(p1, r.X, r.Y, r.Width, r.Height)
  897.     End Sub
  898.     Protected Sub DrawBorders(ByVal p1 As Pen, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
  899.         G.DrawRectangle(p1, x, y, width - 1, height - 1)
  900.     End Sub
  901.  
  902. #End Region
  903.  
  904. #Region " DrawText "
  905.  
  906.     Private DrawTextPoint As Point
  907.     Private DrawTextSize As Size
  908.  
  909.     Protected Sub DrawText(ByVal b1 As Brush, ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
  910.         DrawText(b1, Text, a, x, y)
  911.     End Sub
  912.     Protected Sub DrawText(ByVal b1 As Brush, ByVal text As String, ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
  913.         If text.Length = 0 Then Return
  914.  
  915.         DrawTextSize = Measure(text)
  916.         DrawTextPoint = New Point(Width \ 2 - DrawTextSize.Width \ 2, Header \ 2 - DrawTextSize.Height \ 2)
  917.  
  918.         Select Case a
  919.             Case HorizontalAlignment.Left
  920.                 G.DrawString(text, Font, b1, x, DrawTextPoint.Y + y)
  921.             Case HorizontalAlignment.Center
  922.                 G.DrawString(text, Font, b1, DrawTextPoint.X + x, DrawTextPoint.Y + y)
  923.             Case HorizontalAlignment.Right
  924.                 G.DrawString(text, Font, b1, Width - DrawTextSize.Width - x, DrawTextPoint.Y + y)
  925.         End Select
  926.     End Sub
  927.  
  928.     Protected Sub DrawText(ByVal b1 As Brush, ByVal p1 As Point)
  929.         If Text.Length = 0 Then Return
  930.         G.DrawString(Text, Font, b1, p1)
  931.     End Sub
  932.     Protected Sub DrawText(ByVal b1 As Brush, ByVal x As Integer, ByVal y As Integer)
  933.         If Text.Length = 0 Then Return
  934.         G.DrawString(Text, Font, b1, x, y)
  935.     End Sub
  936.  
  937. #End Region
  938.  
  939. #Region " DrawImage "
  940.  
  941.     Private DrawImagePoint As Point
  942.  
  943.     Protected Sub DrawImage(ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
  944.         DrawImage(_Image, a, x, y)
  945.     End Sub
  946.     Protected Sub DrawImage(ByVal image As Image, ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
  947.         If image Is Nothing Then Return
  948.         DrawImagePoint = New Point(Width \ 2 - image.Width \ 2, Header \ 2 - image.Height \ 2)
  949.  
  950.         Select Case a
  951.             Case HorizontalAlignment.Left
  952.                 G.DrawImage(image, x, DrawImagePoint.Y + y, image.Width, image.Height)
  953.             Case HorizontalAlignment.Center
  954.                 G.DrawImage(image, DrawImagePoint.X + x, DrawImagePoint.Y + y, image.Width, image.Height)
  955.             Case HorizontalAlignment.Right
  956.                 G.DrawImage(image, Width - image.Width - x, DrawImagePoint.Y + y, image.Width, image.Height)
  957.         End Select
  958.     End Sub
  959.  
  960.     Protected Sub DrawImage(ByVal p1 As Point)
  961.         DrawImage(_Image, p1.X, p1.Y)
  962.     End Sub
  963.     Protected Sub DrawImage(ByVal x As Integer, ByVal y As Integer)
  964.         DrawImage(_Image, x, y)
  965.     End Sub
  966.  
  967.     Protected Sub DrawImage(ByVal image As Image, ByVal p1 As Point)
  968.         DrawImage(image, p1.X, p1.Y)
  969.     End Sub
  970.     Protected Sub DrawImage(ByVal image As Image, ByVal x As Integer, ByVal y As Integer)
  971.         If image Is Nothing Then Return
  972.         G.DrawImage(image, x, y, image.Width, image.Height)
  973.     End Sub
  974.  
  975. #End Region
  976.  
  977. #Region " DrawGradient "
  978.  
  979.     Private DrawGradientBrush As LinearGradientBrush
  980.     Private DrawGradientRectangle As Rectangle
  981.  
  982.     Protected Sub DrawGradient(ByVal blend As ColorBlend, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
  983.         DrawGradientRectangle = New Rectangle(x, y, width, height)
  984.         DrawGradient(blend, DrawGradientRectangle)
  985.     End Sub
  986.     Protected Sub DrawGradient(ByVal blend As ColorBlend, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal angle As Single)
  987.         DrawGradientRectangle = New Rectangle(x, y, width, height)
  988.         DrawGradient(blend, DrawGradientRectangle, angle)
  989.     End Sub
  990.  
  991.     Protected Sub DrawGradient(ByVal blend As ColorBlend, ByVal r As Rectangle)
  992.         DrawGradientBrush = New LinearGradientBrush(r, Color.Empty, Color.Empty, 90.0F)
  993.         DrawGradientBrush.InterpolationColors = blend
  994.         G.FillRectangle(DrawGradientBrush, r)
  995.     End Sub
  996.     Protected Sub DrawGradient(ByVal blend As ColorBlend, ByVal r As Rectangle, ByVal angle As Single)
  997.         DrawGradientBrush = New LinearGradientBrush(r, Color.Empty, Color.Empty, angle)
  998.         DrawGradientBrush.InterpolationColors = blend
  999.         G.FillRectangle(DrawGradientBrush, r)
  1000.     End Sub
  1001.  
  1002.  
  1003.     Protected Sub DrawGradient(ByVal c1 As Color, ByVal c2 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
  1004.         DrawGradientRectangle = New Rectangle(x, y, width, height)
  1005.         DrawGradient(c1, c2, DrawGradientRectangle)
  1006.     End Sub
  1007.     Protected Sub DrawGradient(ByVal c1 As Color, ByVal c2 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal angle As Single)
  1008.         DrawGradientRectangle = New Rectangle(x, y, width, height)
  1009.         DrawGradient(c1, c2, DrawGradientRectangle, angle)
  1010.     End Sub
  1011.  
  1012.     Protected Sub DrawGradient(ByVal c1 As Color, ByVal c2 As Color, ByVal r As Rectangle)
  1013.         DrawGradientBrush = New LinearGradientBrush(r, c1, c2, 90.0F)
  1014.         G.FillRectangle(DrawGradientBrush, r)
  1015.     End Sub
  1016.     Protected Sub DrawGradient(ByVal c1 As Color, ByVal c2 As Color, ByVal r As Rectangle, ByVal angle As Single)
  1017.         DrawGradientBrush = New LinearGradientBrush(r, c1, c2, angle)
  1018.         G.FillRectangle(DrawGradientBrush, r)
  1019.     End Sub
  1020.  
  1021. #End Region
  1022.  
  1023. #Region " DrawRadial "
  1024.  
  1025.     Private DrawRadialPath As GraphicsPath
  1026.     Private DrawRadialBrush1 As PathGradientBrush
  1027.     Private DrawRadialBrush2 As LinearGradientBrush
  1028.     Private DrawRadialRectangle As Rectangle
  1029.  
  1030.     Sub DrawRadial(ByVal blend As ColorBlend, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
  1031.         DrawRadialRectangle = New Rectangle(x, y, width, height)
  1032.         DrawRadial(blend, DrawRadialRectangle, width \ 2, height \ 2)
  1033.     End Sub
  1034.     Sub DrawRadial(ByVal blend As ColorBlend, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal center As Point)
  1035.         DrawRadialRectangle = New Rectangle(x, y, width, height)
  1036.         DrawRadial(blend, DrawRadialRectangle, center.X, center.Y)
  1037.     End Sub
  1038.     Sub DrawRadial(ByVal blend As ColorBlend, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal cx As Integer, ByVal cy As Integer)
  1039.         DrawRadialRectangle = New Rectangle(x, y, width, height)
  1040.         DrawRadial(blend, DrawRadialRectangle, cx, cy)
  1041.     End Sub
  1042.  
  1043.     Sub DrawRadial(ByVal blend As ColorBlend, ByVal r As Rectangle)
  1044.         DrawRadial(blend, r, r.Width \ 2, r.Height \ 2)
  1045.     End Sub
  1046.     Sub DrawRadial(ByVal blend As ColorBlend, ByVal r As Rectangle, ByVal center As Point)
  1047.         DrawRadial(blend, r, center.X, center.Y)
  1048.     End Sub
  1049.     Sub DrawRadial(ByVal blend As ColorBlend, ByVal r As Rectangle, ByVal cx As Integer, ByVal cy As Integer)
  1050.         DrawRadialPath.Reset()
  1051.         DrawRadialPath.AddEllipse(r.X, r.Y, r.Width - 1, r.Height - 1)
  1052.  
  1053.         DrawRadialBrush1 = New PathGradientBrush(DrawRadialPath)
  1054.         DrawRadialBrush1.CenterPoint = New Point(r.X + cx, r.Y + cy)
  1055.         DrawRadialBrush1.InterpolationColors = blend
  1056.  
  1057.         If G.SmoothingMode = SmoothingMode.AntiAlias Then
  1058.             G.FillEllipse(DrawRadialBrush1, r.X + 1, r.Y + 1, r.Width - 3, r.Height - 3)
  1059.         Else
  1060.             G.FillEllipse(DrawRadialBrush1, r)
  1061.         End If
  1062.     End Sub
  1063.  
  1064.  
  1065.     Protected Sub DrawRadial(ByVal c1 As Color, ByVal c2 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
  1066.         DrawRadialRectangle = New Rectangle(x, y, width, height)
  1067.         DrawRadial(c1, c2, DrawGradientRectangle)
  1068.     End Sub
  1069.     Protected Sub DrawRadial(ByVal c1 As Color, ByVal c2 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal angle As Single)
  1070.         DrawRadialRectangle = New Rectangle(x, y, width, height)
  1071.         DrawRadial(c1, c2, DrawGradientRectangle, angle)
  1072.     End Sub
  1073.  
  1074.     Protected Sub DrawRadial(ByVal c1 As Color, ByVal c2 As Color, ByVal r As Rectangle)
  1075.         DrawRadialBrush2 = New LinearGradientBrush(r, c1, c2, 90.0F)
  1076.         G.FillRectangle(DrawGradientBrush, r)
  1077.     End Sub
  1078.     Protected Sub DrawRadial(ByVal c1 As Color, ByVal c2 As Color, ByVal r As Rectangle, ByVal angle As Single)
  1079.         DrawRadialBrush2 = New LinearGradientBrush(r, c1, c2, angle)
  1080.         G.FillEllipse(DrawGradientBrush, r)
  1081.     End Sub
  1082.  
  1083. #End Region
  1084.  
  1085. #Region " CreateRound "
  1086.  
  1087.     Private CreateRoundPath As GraphicsPath
  1088.     Private CreateRoundRectangle As Rectangle
  1089.  
  1090.     Function CreateRound(ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal slope As Integer) As GraphicsPath
  1091.         CreateRoundRectangle = New Rectangle(x, y, width, height)
  1092.         Return CreateRound(CreateRoundRectangle, slope)
  1093.     End Function
  1094.  
  1095.     Function CreateRound(ByVal r As Rectangle, ByVal slope As Integer) As GraphicsPath
  1096.         CreateRoundPath = New GraphicsPath(FillMode.Winding)
  1097.         CreateRoundPath.AddArc(r.X, r.Y, slope, slope, 180.0F, 90.0F)
  1098.         CreateRoundPath.AddArc(r.Right - slope, r.Y, slope, slope, 270.0F, 90.0F)
  1099.         CreateRoundPath.AddArc(r.Right - slope, r.Bottom - slope, slope, slope, 0.0F, 90.0F)
  1100.         CreateRoundPath.AddArc(r.X, r.Bottom - slope, slope, slope, 90.0F, 90.0F)
  1101.         CreateRoundPath.CloseFigure()
  1102.         Return CreateRoundPath
  1103.     End Function
  1104.  
  1105. #End Region
  1106.  
  1107. End Class
  1108.  
  1109. MustInherit Class ThemeControl154
  1110.     Inherits Control
  1111.  
  1112.  
  1113. #Region " Initialization "
  1114.  
  1115.     Protected G As Graphics, B As Bitmap
  1116.  
  1117.     Sub New()
  1118.         SetStyle(DirectCast(139270, ControlStyles), True)
  1119.  
  1120.         _ImageSize = Size.Empty
  1121.         Font = New Font("Verdana", 8S)
  1122.  
  1123.         MeasureBitmap = New Bitmap(1, 1)
  1124.         MeasureGraphics = Graphics.FromImage(MeasureBitmap)
  1125.  
  1126.         DrawRadialPath = New GraphicsPath
  1127.  
  1128.         InvalidateCustimization() 'Remove?
  1129.     End Sub
  1130.  
  1131.     Protected NotOverridable Overrides Sub OnHandleCreated(ByVal e As EventArgs)
  1132.         InvalidateCustimization()
  1133.         ColorHook()
  1134.  
  1135.         If Not _LockWidth = 0 Then Width = _LockWidth
  1136.         If Not _LockHeight = 0 Then Height = _LockHeight
  1137.  
  1138.         Transparent = _Transparent
  1139.         If _Transparent AndAlso _BackColor Then BackColor = Color.Transparent
  1140.  
  1141.         MyBase.OnHandleCreated(e)
  1142.     End Sub
  1143.  
  1144.     Private DoneCreation As Boolean
  1145.     Protected NotOverridable Overrides Sub OnParentChanged(ByVal e As EventArgs)
  1146.         If Parent IsNot Nothing Then
  1147.             OnCreation()
  1148.             DoneCreation = True
  1149.             InvalidateTimer()
  1150.         End If
  1151.  
  1152.         MyBase.OnParentChanged(e)
  1153.     End Sub
  1154.  
  1155. #End Region
  1156.  
  1157.     Private Sub DoAnimation(ByVal i As Boolean)
  1158.         OnAnimation()
  1159.         If i Then Invalidate()
  1160.     End Sub
  1161.  
  1162.     Protected NotOverridable Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  1163.         If Width = 0 OrElse Height = 0 Then Return
  1164.  
  1165.         If _Transparent Then
  1166.             PaintHook()
  1167.             e.Graphics.DrawImage(B, 0, 0)
  1168.         Else
  1169.             G = e.Graphics
  1170.             PaintHook()
  1171.         End If
  1172.     End Sub
  1173.  
  1174.     Protected Overrides Sub OnHandleDestroyed(ByVal e As EventArgs)
  1175.         RemoveAnimationCallback(AddressOf DoAnimation)
  1176.         MyBase.OnHandleDestroyed(e)
  1177.     End Sub
  1178.  
  1179. #Region " Size Handling "
  1180.  
  1181.     Protected NotOverridable Overrides Sub OnSizeChanged(ByVal e As EventArgs)
  1182.         If _Transparent Then
  1183.             InvalidateBitmap()
  1184.         End If
  1185.  
  1186.         Invalidate()
  1187.         MyBase.OnSizeChanged(e)
  1188.     End Sub
  1189.  
  1190.     Protected Overrides Sub SetBoundsCore(ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal specified As BoundsSpecified)
  1191.         If Not _LockWidth = 0 Then width = _LockWidth
  1192.         If Not _LockHeight = 0 Then height = _LockHeight
  1193.         MyBase.SetBoundsCore(x, y, width, height, specified)
  1194.     End Sub
  1195.  
  1196. #End Region
  1197.  
  1198. #Region " State Handling "
  1199.  
  1200.     Private InPosition As Boolean
  1201.     Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
  1202.         InPosition = True
  1203.         SetState(MouseState.Over)
  1204.         MyBase.OnMouseEnter(e)
  1205.     End Sub
  1206.  
  1207.     Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  1208.         If InPosition Then SetState(MouseState.Over)
  1209.         MyBase.OnMouseUp(e)
  1210.     End Sub
  1211.  
  1212.     Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  1213.         If e.Button = Windows.Forms.MouseButtons.Left Then SetState(MouseState.Down)
  1214.         MyBase.OnMouseDown(e)
  1215.     End Sub
  1216.  
  1217.     Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
  1218.         InPosition = False
  1219.         SetState(MouseState.None)
  1220.         MyBase.OnMouseLeave(e)
  1221.     End Sub
  1222.  
  1223.     Protected Overrides Sub OnEnabledChanged(ByVal e As EventArgs)
  1224.         If Enabled Then SetState(MouseState.None) Else SetState(MouseState.Block)
  1225.         MyBase.OnEnabledChanged(e)
  1226.     End Sub
  1227.  
  1228.     Protected State As MouseState
  1229.     Private Sub SetState(ByVal current As MouseState)
  1230.         State = current
  1231.         Invalidate()
  1232.     End Sub
  1233.  
  1234. #End Region
  1235.  
  1236.  
  1237. #Region " Base Properties "
  1238.  
  1239.     <Browsable(False), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
  1240.     Overrides Property ForeColor() As Color
  1241.         Get
  1242.             Return Color.Empty
  1243.         End Get
  1244.         Set(ByVal value As Color)
  1245.         End Set
  1246.     End Property
  1247.     <Browsable(False), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
  1248.     Overrides Property BackgroundImage() As Image
  1249.         Get
  1250.             Return Nothing
  1251.         End Get
  1252.         Set(ByVal value As Image)
  1253.         End Set
  1254.     End Property
  1255.     <Browsable(False), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
  1256.     Overrides Property BackgroundImageLayout() As ImageLayout
  1257.         Get
  1258.             Return ImageLayout.None
  1259.         End Get
  1260.         Set(ByVal value As ImageLayout)
  1261.         End Set
  1262.     End Property
  1263.  
  1264.     Overrides Property Text() As String
  1265.         Get
  1266.             Return MyBase.Text
  1267.         End Get
  1268.         Set(ByVal value As String)
  1269.             MyBase.Text = value
  1270.             Invalidate()
  1271.         End Set
  1272.     End Property
  1273.     Overrides Property Font() As Font
  1274.         Get
  1275.             Return MyBase.Font
  1276.         End Get
  1277.         Set(ByVal value As Font)
  1278.             MyBase.Font = value
  1279.             Invalidate()
  1280.         End Set
  1281.     End Property
  1282.  
  1283.     Private _BackColor As Boolean
  1284.     <Category("Misc")> _
  1285.     Overrides Property BackColor() As Color
  1286.         Get
  1287.             Return MyBase.BackColor
  1288.         End Get
  1289.         Set(ByVal value As Color)
  1290.             If Not IsHandleCreated AndAlso value = Color.Transparent Then
  1291.                 _BackColor = True
  1292.                 Return
  1293.             End If
  1294.  
  1295.             MyBase.BackColor = value
  1296.             If Parent IsNot Nothing Then ColorHook()
  1297.         End Set
  1298.     End Property
  1299.  
  1300. #End Region
  1301.  
  1302. #Region " Public Properties "
  1303.  
  1304.     Private _NoRounding As Boolean
  1305.     Property NoRounding() As Boolean
  1306.         Get
  1307.             Return _NoRounding
  1308.         End Get
  1309.         Set(ByVal v As Boolean)
  1310.             _NoRounding = v
  1311.             Invalidate()
  1312.         End Set
  1313.     End Property
  1314.  
  1315.     Private _Image As Image
  1316.     Property Image() As Image
  1317.         Get
  1318.             Return _Image
  1319.         End Get
  1320.         Set(ByVal value As Image)
  1321.             If value Is Nothing Then
  1322.                 _ImageSize = Size.Empty
  1323.             Else
  1324.                 _ImageSize = value.Size
  1325.             End If
  1326.  
  1327.             _Image = value
  1328.             Invalidate()
  1329.         End Set
  1330.     End Property
  1331.  
  1332.     Private _Transparent As Boolean
  1333.     Property Transparent() As Boolean
  1334.         Get
  1335.             Return _Transparent
  1336.         End Get
  1337.         Set(ByVal value As Boolean)
  1338.             _Transparent = value
  1339.             If Not IsHandleCreated Then Return
  1340.  
  1341.             If Not value AndAlso Not BackColor.A = 255 Then
  1342.                 Throw New Exception("Unable to change value to false while a transparent BackColor is in use.")
  1343.             End If
  1344.  
  1345.             SetStyle(ControlStyles.Opaque, Not value)
  1346.             SetStyle(ControlStyles.SupportsTransparentBackColor, value)
  1347.  
  1348.             If value Then InvalidateBitmap() Else B = Nothing
  1349.             Invalidate()
  1350.         End Set
  1351.     End Property
  1352.  
  1353.     Private Items As New Dictionary(Of String, Color)
  1354.     Property Colors() As Bloom()
  1355.         Get
  1356.             Dim T As New List(Of Bloom)
  1357.             Dim E As Dictionary(Of String, Color).Enumerator = Items.GetEnumerator
  1358.  
  1359.             While E.MoveNext
  1360.                 T.Add(New Bloom(E.Current.Key, E.Current.Value))
  1361.             End While
  1362.  
  1363.             Return T.ToArray
  1364.         End Get
  1365.         Set(ByVal value As Bloom())
  1366.             For Each B As Bloom In value
  1367.                 If Items.ContainsKey(B.Name) Then Items(B.Name) = B.Value
  1368.             Next
  1369.  
  1370.             InvalidateCustimization()
  1371.             ColorHook()
  1372.             Invalidate()
  1373.         End Set
  1374.     End Property
  1375.  
  1376.     Private _Customization As String
  1377.     Property Customization() As String
  1378.         Get
  1379.             Return _Customization
  1380.         End Get
  1381.         Set(ByVal value As String)
  1382.             If value = _Customization Then Return
  1383.  
  1384.             Dim Data As Byte()
  1385.             Dim Items As Bloom() = Colors
  1386.  
  1387.             Try
  1388.                 Data = Convert.FromBase64String(value)
  1389.                 For I As Integer = 0 To Items.Length - 1
  1390.                     Items(I).Value = Color.FromArgb(BitConverter.ToInt32(Data, I * 4))
  1391.                 Next
  1392.             Catch
  1393.                 Return
  1394.             End Try
  1395.  
  1396.             _Customization = value
  1397.  
  1398.             Colors = Items
  1399.             ColorHook()
  1400.             Invalidate()
  1401.         End Set
  1402.     End Property
  1403.  
  1404. #End Region
  1405.  
  1406. #Region " Private Properties "
  1407.  
  1408.     Private _ImageSize As Size
  1409.     Protected ReadOnly Property ImageSize() As Size
  1410.         Get
  1411.             Return _ImageSize
  1412.         End Get
  1413.     End Property
  1414.  
  1415.     Private _LockWidth As Integer
  1416.     Protected Property LockWidth() As Integer
  1417.         Get
  1418.             Return _LockWidth
  1419.         End Get
  1420.         Set(ByVal value As Integer)
  1421.             _LockWidth = value
  1422.             If Not LockWidth = 0 AndAlso IsHandleCreated Then Width = LockWidth
  1423.         End Set
  1424.     End Property
  1425.  
  1426.     Private _LockHeight As Integer
  1427.     Protected Property LockHeight() As Integer
  1428.         Get
  1429.             Return _LockHeight
  1430.         End Get
  1431.         Set(ByVal value As Integer)
  1432.             _LockHeight = value
  1433.             If Not LockHeight = 0 AndAlso IsHandleCreated Then Height = LockHeight
  1434.         End Set
  1435.     End Property
  1436.  
  1437.     Private _IsAnimated As Boolean
  1438.     Protected Property IsAnimated() As Boolean
  1439.         Get
  1440.             Return _IsAnimated
  1441.         End Get
  1442.         Set(ByVal value As Boolean)
  1443.             _IsAnimated = value
  1444.             InvalidateTimer()
  1445.         End Set
  1446.     End Property
  1447.  
  1448. #End Region
  1449.  
  1450.  
  1451. #Region " Property Helpers "
  1452.  
  1453.     Protected Function GetPen(ByVal name As String) As Pen
  1454.         Return New Pen(Items(name))
  1455.     End Function
  1456.     Protected Function GetPen(ByVal name As String, ByVal width As Single) As Pen
  1457.         Return New Pen(Items(name), width)
  1458.     End Function
  1459.  
  1460.     Protected Function GetBrush(ByVal name As String) As SolidBrush
  1461.         Return New SolidBrush(Items(name))
  1462.     End Function
  1463.  
  1464.     Protected Function GetColor(ByVal name As String) As Color
  1465.         Return Items(name)
  1466.     End Function
  1467.  
  1468.     Protected Sub SetColor(ByVal name As String, ByVal value As Color)
  1469.         If Items.ContainsKey(name) Then Items(name) = value Else Items.Add(name, value)
  1470.     End Sub
  1471.     Protected Sub SetColor(ByVal name As String, ByVal r As Byte, ByVal g As Byte, ByVal b As Byte)
  1472.         SetColor(name, Color.FromArgb(r, g, b))
  1473.     End Sub
  1474.     Protected Sub SetColor(ByVal name As String, ByVal a As Byte, ByVal r As Byte, ByVal g As Byte, ByVal b As Byte)
  1475.         SetColor(name, Color.FromArgb(a, r, g, b))
  1476.     End Sub
  1477.     Protected Sub SetColor(ByVal name As String, ByVal a As Byte, ByVal value As Color)
  1478.         SetColor(name, Color.FromArgb(a, value))
  1479.     End Sub
  1480.  
  1481.     Private Sub InvalidateBitmap()
  1482.         If Width = 0 OrElse Height = 0 Then Return
  1483.         B = New Bitmap(Width, Height, PixelFormat.Format32bppPArgb)
  1484.         G = Graphics.FromImage(B)
  1485.     End Sub
  1486.  
  1487.     Private Sub InvalidateCustimization()
  1488.         Dim M As New MemoryStream(Items.Count * 4)
  1489.  
  1490.         For Each B As Bloom In Colors
  1491.             M.Write(BitConverter.GetBytes(B.Value.ToArgb), 0, 4)
  1492.         Next
  1493.  
  1494.         M.Close()
  1495.         _Customization = Convert.ToBase64String(M.ToArray)
  1496.     End Sub
  1497.  
  1498.     Private Sub InvalidateTimer()
  1499.         If DesignMode OrElse Not DoneCreation Then Return
  1500.  
  1501.         If _IsAnimated Then
  1502.             AddAnimationCallback(AddressOf DoAnimation)
  1503.         Else
  1504.             RemoveAnimationCallback(AddressOf DoAnimation)
  1505.         End If
  1506.     End Sub
  1507. #End Region
  1508.  
  1509.  
  1510. #Region " User Hooks "
  1511.  
  1512.     Protected MustOverride Sub ColorHook()
  1513.     Protected MustOverride Sub PaintHook()
  1514.  
  1515.     Protected Overridable Sub OnCreation()
  1516.     End Sub
  1517.  
  1518.     Protected Overridable Sub OnAnimation()
  1519.     End Sub
  1520.  
  1521. #End Region
  1522.  
  1523.  
  1524. #Region " Offset "
  1525.  
  1526.     Private OffsetReturnRectangle As Rectangle
  1527.     Protected Function Offset(ByVal r As Rectangle, ByVal amount As Integer) As Rectangle
  1528.         OffsetReturnRectangle = New Rectangle(r.X + amount, r.Y + amount, r.Width - (amount * 2), r.Height - (amount * 2))
  1529.         Return OffsetReturnRectangle
  1530.     End Function
  1531.  
  1532.     Private OffsetReturnSize As Size
  1533.     Protected Function Offset(ByVal s As Size, ByVal amount As Integer) As Size
  1534.         OffsetReturnSize = New Size(s.Width + amount, s.Height + amount)
  1535.         Return OffsetReturnSize
  1536.     End Function
  1537.  
  1538.     Private OffsetReturnPoint As Point
  1539.     Protected Function Offset(ByVal p As Point, ByVal amount As Integer) As Point
  1540.         OffsetReturnPoint = New Point(p.X + amount, p.Y + amount)
  1541.         Return OffsetReturnPoint
  1542.     End Function
  1543.  
  1544. #End Region
  1545.  
  1546. #Region " Center "
  1547.  
  1548.     Private CenterReturn As Point
  1549.  
  1550.     Protected Function Center(ByVal p As Rectangle, ByVal c As Rectangle) As Point
  1551.         CenterReturn = New Point((p.Width \ 2 - c.Width \ 2) + p.X + c.X, (p.Height \ 2 - c.Height \ 2) + p.Y + c.Y)
  1552.         Return CenterReturn
  1553.     End Function
  1554.     Protected Function Center(ByVal p As Rectangle, ByVal c As Size) As Point
  1555.         CenterReturn = New Point((p.Width \ 2 - c.Width \ 2) + p.X, (p.Height \ 2 - c.Height \ 2) + p.Y)
  1556.         Return CenterReturn
  1557.     End Function
  1558.  
  1559.     Protected Function Center(ByVal child As Rectangle) As Point
  1560.         Return Center(Width, Height, child.Width, child.Height)
  1561.     End Function
  1562.     Protected Function Center(ByVal child As Size) As Point
  1563.         Return Center(Width, Height, child.Width, child.Height)
  1564.     End Function
  1565.     Protected Function Center(ByVal childWidth As Integer, ByVal childHeight As Integer) As Point
  1566.         Return Center(Width, Height, childWidth, childHeight)
  1567.     End Function
  1568.  
  1569.     Protected Function Center(ByVal p As Size, ByVal c As Size) As Point
  1570.         Return Center(p.Width, p.Height, c.Width, c.Height)
  1571.     End Function
  1572.  
  1573.     Protected Function Center(ByVal pWidth As Integer, ByVal pHeight As Integer, ByVal cWidth As Integer, ByVal cHeight As Integer) As Point
  1574.         CenterReturn = New Point(pWidth \ 2 - cWidth \ 2, pHeight \ 2 - cHeight \ 2)
  1575.         Return CenterReturn
  1576.     End Function
  1577.  
  1578. #End Region
  1579.  
  1580. #Region " Measure "
  1581.  
  1582.     Private MeasureBitmap As Bitmap
  1583.     Private MeasureGraphics As Graphics 'TODO: Potential issues during multi-threading.
  1584.  
  1585.     Protected Function Measure() As Size
  1586.         Return MeasureGraphics.MeasureString(Text, Font, Width).ToSize
  1587.     End Function
  1588.     Protected Function Measure(ByVal text As String) As Size
  1589.         Return MeasureGraphics.MeasureString(text, Font, Width).ToSize
  1590.     End Function
  1591.  
  1592. #End Region
  1593.  
  1594.  
  1595. #Region " DrawPixel "
  1596.  
  1597.     Private DrawPixelBrush As SolidBrush
  1598.  
  1599.     Protected Sub DrawPixel(ByVal c1 As Color, ByVal x As Integer, ByVal y As Integer)
  1600.         If _Transparent Then
  1601.             B.SetPixel(x, y, c1)
  1602.         Else
  1603.             DrawPixelBrush = New SolidBrush(c1)
  1604.             G.FillRectangle(DrawPixelBrush, x, y, 1, 1)
  1605.         End If
  1606.     End Sub
  1607.  
  1608. #End Region
  1609.  
  1610. #Region " DrawCorners "
  1611.  
  1612.     Private DrawCornersBrush As SolidBrush
  1613.  
  1614.     Protected Sub DrawCorners(ByVal c1 As Color, ByVal offset As Integer)
  1615.         DrawCorners(c1, 0, 0, Width, Height, offset)
  1616.     End Sub
  1617.     Protected Sub DrawCorners(ByVal c1 As Color, ByVal r1 As Rectangle, ByVal offset As Integer)
  1618.         DrawCorners(c1, r1.X, r1.Y, r1.Width, r1.Height, offset)
  1619.     End Sub
  1620.     Protected Sub DrawCorners(ByVal c1 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal offset As Integer)
  1621.         DrawCorners(c1, x + offset, y + offset, width - (offset * 2), height - (offset * 2))
  1622.     End Sub
  1623.  
  1624.     Protected Sub DrawCorners(ByVal c1 As Color)
  1625.         DrawCorners(c1, 0, 0, Width, Height)
  1626.     End Sub
  1627.     Protected Sub DrawCorners(ByVal c1 As Color, ByVal r1 As Rectangle)
  1628.         DrawCorners(c1, r1.X, r1.Y, r1.Width, r1.Height)
  1629.     End Sub
  1630.     Protected Sub DrawCorners(ByVal c1 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
  1631.         If _NoRounding Then Return
  1632.  
  1633.         If _Transparent Then
  1634.             B.SetPixel(x, y, c1)
  1635.             B.SetPixel(x + (width - 1), y, c1)
  1636.             B.SetPixel(x, y + (height - 1), c1)
  1637.             B.SetPixel(x + (width - 1), y + (height - 1), c1)
  1638.         Else
  1639.             DrawCornersBrush = New SolidBrush(c1)
  1640.             G.FillRectangle(DrawCornersBrush, x, y, 1, 1)
  1641.             G.FillRectangle(DrawCornersBrush, x + (width - 1), y, 1, 1)
  1642.             G.FillRectangle(DrawCornersBrush, x, y + (height - 1), 1, 1)
  1643.             G.FillRectangle(DrawCornersBrush, x + (width - 1), y + (height - 1), 1, 1)
  1644.         End If
  1645.     End Sub
  1646.  
  1647. #End Region
  1648.  
  1649. #Region " DrawBorders "
  1650.  
  1651.     Protected Sub DrawBorders(ByVal p1 As Pen, ByVal offset As Integer)
  1652.         DrawBorders(p1, 0, 0, Width, Height, offset)
  1653.     End Sub
  1654.     Protected Sub DrawBorders(ByVal p1 As Pen, ByVal r As Rectangle, ByVal offset As Integer)
  1655.         DrawBorders(p1, r.X, r.Y, r.Width, r.Height, offset)
  1656.     End Sub
  1657.     Protected Sub DrawBorders(ByVal p1 As Pen, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal offset As Integer)
  1658.         DrawBorders(p1, x + offset, y + offset, width - (offset * 2), height - (offset * 2))
  1659.     End Sub
  1660.  
  1661.     Protected Sub DrawBorders(ByVal p1 As Pen)
  1662.         DrawBorders(p1, 0, 0, Width, Height)
  1663.     End Sub
  1664.     Protected Sub DrawBorders(ByVal p1 As Pen, ByVal r As Rectangle)
  1665.         DrawBorders(p1, r.X, r.Y, r.Width, r.Height)
  1666.     End Sub
  1667.     Protected Sub DrawBorders(ByVal p1 As Pen, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
  1668.         G.DrawRectangle(p1, x, y, width - 1, height - 1)
  1669.     End Sub
  1670.  
  1671. #End Region
  1672.  
  1673. #Region " DrawText "
  1674.  
  1675.     Private DrawTextPoint As Point
  1676.     Private DrawTextSize As Size
  1677.  
  1678.     Protected Sub DrawText(ByVal b1 As Brush, ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
  1679.         DrawText(b1, Text, a, x, y)
  1680.     End Sub
  1681.     Protected Sub DrawText(ByVal b1 As Brush, ByVal text As String, ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
  1682.         If text.Length = 0 Then Return
  1683.  
  1684.         DrawTextSize = Measure(text)
  1685.         DrawTextPoint = Center(DrawTextSize)
  1686.  
  1687.         Select Case a
  1688.             Case HorizontalAlignment.Left
  1689.                 G.DrawString(text, Font, b1, x, DrawTextPoint.Y + y)
  1690.             Case HorizontalAlignment.Center
  1691.                 G.DrawString(text, Font, b1, DrawTextPoint.X + x, DrawTextPoint.Y + y)
  1692.             Case HorizontalAlignment.Right
  1693.                 G.DrawString(text, Font, b1, Width - DrawTextSize.Width - x, DrawTextPoint.Y + y)
  1694.         End Select
  1695.     End Sub
  1696.  
  1697.     Protected Sub DrawText(ByVal b1 As Brush, ByVal p1 As Point)
  1698.         If Text.Length = 0 Then Return
  1699.         G.DrawString(Text, Font, b1, p1)
  1700.     End Sub
  1701.     Protected Sub DrawText(ByVal b1 As Brush, ByVal x As Integer, ByVal y As Integer)
  1702.         If Text.Length = 0 Then Return
  1703.         G.DrawString(Text, Font, b1, x, y)
  1704.     End Sub
  1705.  
  1706. #End Region
  1707.  
  1708. #Region " DrawImage "
  1709.  
  1710.     Private DrawImagePoint As Point
  1711.  
  1712.     Protected Sub DrawImage(ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
  1713.         DrawImage(_Image, a, x, y)
  1714.     End Sub
  1715.     Protected Sub DrawImage(ByVal image As Image, ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
  1716.         If image Is Nothing Then Return
  1717.         DrawImagePoint = Center(image.Size)
  1718.  
  1719.         Select Case a
  1720.             Case HorizontalAlignment.Left
  1721.                 G.DrawImage(image, x, DrawImagePoint.Y + y, image.Width, image.Height)
  1722.             Case HorizontalAlignment.Center
  1723.                 G.DrawImage(image, DrawImagePoint.X + x, DrawImagePoint.Y + y, image.Width, image.Height)
  1724.             Case HorizontalAlignment.Right
  1725.                 G.DrawImage(image, Width - image.Width - x, DrawImagePoint.Y + y, image.Width, image.Height)
  1726.         End Select
  1727.     End Sub
  1728.  
  1729.     Protected Sub DrawImage(ByVal p1 As Point)
  1730.         DrawImage(_Image, p1.X, p1.Y)
  1731.     End Sub
  1732.     Protected Sub DrawImage(ByVal x As Integer, ByVal y As Integer)
  1733.         DrawImage(_Image, x, y)
  1734.     End Sub
  1735.  
  1736.     Protected Sub DrawImage(ByVal image As Image, ByVal p1 As Point)
  1737.         DrawImage(image, p1.X, p1.Y)
  1738.     End Sub
  1739.     Protected Sub DrawImage(ByVal image As Image, ByVal x As Integer, ByVal y As Integer)
  1740.         If image Is Nothing Then Return
  1741.         G.DrawImage(image, x, y, image.Width, image.Height)
  1742.     End Sub
  1743.  
  1744. #End Region
  1745.  
  1746. #Region " DrawGradient "
  1747.  
  1748.     Private DrawGradientBrush As LinearGradientBrush
  1749.     Private DrawGradientRectangle As Rectangle
  1750.  
  1751.     Protected Sub DrawGradient(ByVal blend As ColorBlend, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
  1752.         DrawGradientRectangle = New Rectangle(x, y, width, height)
  1753.         DrawGradient(blend, DrawGradientRectangle)
  1754.     End Sub
  1755.     Protected Sub DrawGradient(ByVal blend As ColorBlend, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal angle As Single)
  1756.         DrawGradientRectangle = New Rectangle(x, y, width, height)
  1757.         DrawGradient(blend, DrawGradientRectangle, angle)
  1758.     End Sub
  1759.  
  1760.     Protected Sub DrawGradient(ByVal blend As ColorBlend, ByVal r As Rectangle)
  1761.         DrawGradientBrush = New LinearGradientBrush(r, Color.Empty, Color.Empty, 90.0F)
  1762.         DrawGradientBrush.InterpolationColors = blend
  1763.         G.FillRectangle(DrawGradientBrush, r)
  1764.     End Sub
  1765.     Protected Sub DrawGradient(ByVal blend As ColorBlend, ByVal r As Rectangle, ByVal angle As Single)
  1766.         DrawGradientBrush = New LinearGradientBrush(r, Color.Empty, Color.Empty, angle)
  1767.         DrawGradientBrush.InterpolationColors = blend
  1768.         G.FillRectangle(DrawGradientBrush, r)
  1769.     End Sub
  1770.  
  1771.  
  1772.     Protected Sub DrawGradient(ByVal c1 As Color, ByVal c2 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
  1773.         DrawGradientRectangle = New Rectangle(x, y, width, height)
  1774.         DrawGradient(c1, c2, DrawGradientRectangle)
  1775.     End Sub
  1776.     Protected Sub DrawGradient(ByVal c1 As Color, ByVal c2 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal angle As Single)
  1777.         DrawGradientRectangle = New Rectangle(x, y, width, height)
  1778.         DrawGradient(c1, c2, DrawGradientRectangle, angle)
  1779.     End Sub
  1780.  
  1781.     Protected Sub DrawGradient(ByVal c1 As Color, ByVal c2 As Color, ByVal r As Rectangle)
  1782.         DrawGradientBrush = New LinearGradientBrush(r, c1, c2, 90.0F)
  1783.         G.FillRectangle(DrawGradientBrush, r)
  1784.     End Sub
  1785.     Protected Sub DrawGradient(ByVal c1 As Color, ByVal c2 As Color, ByVal r As Rectangle, ByVal angle As Single)
  1786.         DrawGradientBrush = New LinearGradientBrush(r, c1, c2, angle)
  1787.         G.FillRectangle(DrawGradientBrush, r)
  1788.     End Sub
  1789.  
  1790. #End Region
  1791.  
  1792. #Region " DrawRadial "
  1793.  
  1794.     Private DrawRadialPath As GraphicsPath
  1795.     Private DrawRadialBrush1 As PathGradientBrush
  1796.     Private DrawRadialBrush2 As LinearGradientBrush
  1797.     Private DrawRadialRectangle As Rectangle
  1798.  
  1799.     Sub DrawRadial(ByVal blend As ColorBlend, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
  1800.         DrawRadialRectangle = New Rectangle(x, y, width, height)
  1801.         DrawRadial(blend, DrawRadialRectangle, width \ 2, height \ 2)
  1802.     End Sub
  1803.     Sub DrawRadial(ByVal blend As ColorBlend, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal center As Point)
  1804.         DrawRadialRectangle = New Rectangle(x, y, width, height)
  1805.         DrawRadial(blend, DrawRadialRectangle, center.X, center.Y)
  1806.     End Sub
  1807.     Sub DrawRadial(ByVal blend As ColorBlend, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal cx As Integer, ByVal cy As Integer)
  1808.         DrawRadialRectangle = New Rectangle(x, y, width, height)
  1809.         DrawRadial(blend, DrawRadialRectangle, cx, cy)
  1810.     End Sub
  1811.  
  1812.     Sub DrawRadial(ByVal blend As ColorBlend, ByVal r As Rectangle)
  1813.         DrawRadial(blend, r, r.Width \ 2, r.Height \ 2)
  1814.     End Sub
  1815.     Sub DrawRadial(ByVal blend As ColorBlend, ByVal r As Rectangle, ByVal center As Point)
  1816.         DrawRadial(blend, r, center.X, center.Y)
  1817.     End Sub
  1818.     Sub DrawRadial(ByVal blend As ColorBlend, ByVal r As Rectangle, ByVal cx As Integer, ByVal cy As Integer)
  1819.         DrawRadialPath.Reset()
  1820.         DrawRadialPath.AddEllipse(r.X, r.Y, r.Width - 1, r.Height - 1)
  1821.  
  1822.         DrawRadialBrush1 = New PathGradientBrush(DrawRadialPath)
  1823.         DrawRadialBrush1.CenterPoint = New Point(r.X + cx, r.Y + cy)
  1824.         DrawRadialBrush1.InterpolationColors = blend
  1825.  
  1826.         If G.SmoothingMode = SmoothingMode.AntiAlias Then
  1827.             G.FillEllipse(DrawRadialBrush1, r.X + 1, r.Y + 1, r.Width - 3, r.Height - 3)
  1828.         Else
  1829.             G.FillEllipse(DrawRadialBrush1, r)
  1830.         End If
  1831.     End Sub
  1832.  
  1833.  
  1834.     Protected Sub DrawRadial(ByVal c1 As Color, ByVal c2 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
  1835.         DrawRadialRectangle = New Rectangle(x, y, width, height)
  1836.         DrawRadial(c1, c2, DrawRadialRectangle)
  1837.     End Sub
  1838.     Protected Sub DrawRadial(ByVal c1 As Color, ByVal c2 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal angle As Single)
  1839.         DrawRadialRectangle = New Rectangle(x, y, width, height)
  1840.         DrawRadial(c1, c2, DrawRadialRectangle, angle)
  1841.     End Sub
  1842.  
  1843.     Protected Sub DrawRadial(ByVal c1 As Color, ByVal c2 As Color, ByVal r As Rectangle)
  1844.         DrawRadialBrush2 = New LinearGradientBrush(r, c1, c2, 90.0F)
  1845.         G.FillEllipse(DrawRadialBrush2, r)
  1846.     End Sub
  1847.     Protected Sub DrawRadial(ByVal c1 As Color, ByVal c2 As Color, ByVal r As Rectangle, ByVal angle As Single)
  1848.         DrawRadialBrush2 = New LinearGradientBrush(r, c1, c2, angle)
  1849.         G.FillEllipse(DrawRadialBrush2, r)
  1850.     End Sub
  1851.  
  1852. #End Region
  1853.  
  1854. #Region " CreateRound "
  1855.  
  1856.     Private CreateRoundPath As GraphicsPath
  1857.     Private CreateRoundRectangle As Rectangle
  1858.  
  1859.     Function CreateRound(ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal slope As Integer) As GraphicsPath
  1860.         CreateRoundRectangle = New Rectangle(x, y, width, height)
  1861.         Return CreateRound(CreateRoundRectangle, slope)
  1862.     End Function
  1863.  
  1864.     Function CreateRound(ByVal r As Rectangle, ByVal slope As Integer) As GraphicsPath
  1865.         CreateRoundPath = New GraphicsPath(FillMode.Winding)
  1866.         CreateRoundPath.AddArc(r.X, r.Y, slope, slope, 180.0F, 90.0F)
  1867.         CreateRoundPath.AddArc(r.Right - slope, r.Y, slope, slope, 270.0F, 90.0F)
  1868.         CreateRoundPath.AddArc(r.Right - slope, r.Bottom - slope, slope, slope, 0.0F, 90.0F)
  1869.         CreateRoundPath.AddArc(r.X, r.Bottom - slope, slope, slope, 90.0F, 90.0F)
  1870.         CreateRoundPath.CloseFigure()
  1871.         Return CreateRoundPath
  1872.     End Function
  1873.  
  1874. #End Region
  1875.  
  1876. End Class
  1877.  
  1878. Module ThemeShare
  1879.  
  1880. #Region " Animation "
  1881.  
  1882.     Private Frames As Integer
  1883.     Private Invalidate As Boolean
  1884.     Public ThemeTimer As New PrecisionTimer
  1885.  
  1886.     Private Const FPS As Integer = 50 '1000 / 50 = 20 FPS
  1887.     Private Const Rate As Integer = 10
  1888.  
  1889.     Public Delegate Sub AnimationDelegate(ByVal invalidate As Boolean)
  1890.  
  1891.     Private Callbacks As New List(Of AnimationDelegate)
  1892.  
  1893.     Private Sub HandleCallbacks(ByVal state As IntPtr, ByVal reserve As Boolean)
  1894.         Invalidate = (Frames >= FPS)
  1895.         If Invalidate Then Frames = 0
  1896.  
  1897.         SyncLock Callbacks
  1898.             For I As Integer = 0 To Callbacks.Count - 1
  1899.                 Callbacks(I).Invoke(Invalidate)
  1900.             Next
  1901.         End SyncLock
  1902.  
  1903.         Frames += Rate
  1904.     End Sub
  1905.  
  1906.     Private Sub InvalidateThemeTimer()
  1907.         If Callbacks.Count = 0 Then
  1908.             ThemeTimer.Delete()
  1909.         Else
  1910.             ThemeTimer.Create(0, Rate, AddressOf HandleCallbacks)
  1911.         End If
  1912.     End Sub
  1913.  
  1914.     Sub AddAnimationCallback(ByVal callback As AnimationDelegate)
  1915.         SyncLock Callbacks
  1916.             If Callbacks.Contains(callback) Then Return
  1917.  
  1918.             Callbacks.Add(callback)
  1919.             InvalidateThemeTimer()
  1920.         End SyncLock
  1921.     End Sub
  1922.  
  1923.     Sub RemoveAnimationCallback(ByVal callback As AnimationDelegate)
  1924.         SyncLock Callbacks
  1925.             If Not Callbacks.Contains(callback) Then Return
  1926.  
  1927.             Callbacks.Remove(callback)
  1928.             InvalidateThemeTimer()
  1929.         End SyncLock
  1930.     End Sub
  1931.  
  1932. #End Region
  1933.  
  1934. End Module
  1935.  
  1936. Enum MouseState As Byte
  1937.     None = 0
  1938.     Over = 1
  1939.     Down = 2
  1940.     Block = 3
  1941. End Enum
  1942.  
  1943. Structure Bloom
  1944.  
  1945.     Public _Name As String
  1946.     ReadOnly Property Name() As String
  1947.         Get
  1948.             Return _Name
  1949.         End Get
  1950.     End Property
  1951.  
  1952.     Private _Value As Color
  1953.     Property Value() As Color
  1954.         Get
  1955.             Return _Value
  1956.         End Get
  1957.         Set(ByVal value As Color)
  1958.             _Value = value
  1959.         End Set
  1960.     End Property
  1961.  
  1962.     Property ValueHex() As String
  1963.         Get
  1964.             Return String.Concat("#", _
  1965.             _Value.R.ToString("X2", Nothing), _
  1966.             _Value.G.ToString("X2", Nothing), _
  1967.             _Value.B.ToString("X2", Nothing))
  1968.         End Get
  1969.         Set(ByVal value As String)
  1970.             Try
  1971.                 _Value = ColorTranslator.FromHtml(value)
  1972.             Catch
  1973.                 Return
  1974.             End Try
  1975.         End Set
  1976.     End Property
  1977.  
  1978.  
  1979.     Sub New(ByVal name As String, ByVal value As Color)
  1980.         _Name = name
  1981.         _Value = value
  1982.     End Sub
  1983. End Structure
  1984.  
  1985. '------------------
  1986. 'Creator: aeonhack
  1987. 'Site: elitevs.net
  1988. 'Created: 11/30/2011
  1989. 'Changed: 11/30/2011
  1990. 'Version: 1.0.0
  1991. '------------------
  1992. Class PrecisionTimer
  1993.     Implements IDisposable
  1994.  
  1995.     Private _Enabled As Boolean
  1996.     ReadOnly Property Enabled() As Boolean
  1997.         Get
  1998.             Return _Enabled
  1999.         End Get
  2000.     End Property
  2001.  
  2002.     Private Handle As IntPtr
  2003.     Private TimerCallback As TimerDelegate
  2004.  
  2005.     <DllImport("kernel32.dll", EntryPoint:="CreateTimerQueueTimer")> _
  2006.     Private Shared Function CreateTimerQueueTimer( _
  2007.     ByRef handle As IntPtr, _
  2008.     ByVal queue As IntPtr, _
  2009.     ByVal callback As TimerDelegate, _
  2010.     ByVal state As IntPtr, _
  2011.     ByVal dueTime As UInteger, _
  2012.     ByVal period As UInteger, _
  2013.     ByVal flags As UInteger) As Boolean
  2014.     End Function
  2015.  
  2016.     <DllImport("kernel32.dll", EntryPoint:="DeleteTimerQueueTimer")> _
  2017.     Private Shared Function DeleteTimerQueueTimer( _
  2018.     ByVal queue As IntPtr, _
  2019.     ByVal handle As IntPtr, _
  2020.     ByVal callback As IntPtr) As Boolean
  2021.     End Function
  2022.  
  2023.     Delegate Sub TimerDelegate(ByVal r1 As IntPtr, ByVal r2 As Boolean)
  2024.  
  2025.     Sub Create(ByVal dueTime As UInteger, ByVal period As UInteger, ByVal callback As TimerDelegate)
  2026.         If _Enabled Then Return
  2027.  
  2028.         TimerCallback = callback
  2029.         Dim Success As Boolean = CreateTimerQueueTimer(Handle, IntPtr.Zero, TimerCallback, IntPtr.Zero, dueTime, period, 0)
  2030.  
  2031.         If Not Success Then ThrowNewException("CreateTimerQueueTimer")
  2032.         _Enabled = Success
  2033.     End Sub
  2034.  
  2035.     Sub Delete()
  2036.         If Not _Enabled Then Return
  2037.         Dim Success As Boolean = DeleteTimerQueueTimer(IntPtr.Zero, Handle, IntPtr.Zero)
  2038.  
  2039.         If Not Success AndAlso Not Marshal.GetLastWin32Error = 997 Then
  2040.             ThrowNewException("DeleteTimerQueueTimer")
  2041.         End If
  2042.  
  2043.         _Enabled = Not Success
  2044.     End Sub
  2045.  
  2046.     Private Sub ThrowNewException(ByVal name As String)
  2047.         Throw New Exception(String.Format("{0} failed. Win32Error: {1}", name, Marshal.GetLastWin32Error))
  2048.     End Sub
  2049.  
  2050.     Public Sub Dispose() Implements IDisposable.Dispose
  2051.         Delete()
  2052.     End Sub
  2053. End Class
  2054. #End Region
  2055. #Region "SLCTheme"
  2056. Class SLCTheme
  2057.     Inherits ThemeContainer154
  2058.  
  2059.     Private P1, P2 As Pen
  2060.     Private topc, botc, topc2, botc2 As Color
  2061.     Private B1 As SolidBrush
  2062.  
  2063.  
  2064.  
  2065.  
  2066.     Sub New()
  2067.  
  2068.         TransparencyKey = Color.Fuchsia
  2069.         Header = 30
  2070.         SetColor("top", Color.FromArgb(21, 18, 37))
  2071.         SetColor("bottom", Color.FromArgb(32, 35, 54))
  2072.         '(21, 18, 37)
  2073.         SetColor("top2", Color.FromArgb(32, 35, 54))
  2074.         SetColor("bottom2", Color.FromArgb(21, 18, 37))
  2075.         BackColor = Color.FromArgb(0, 57, 72)
  2076.         P1 = New Pen(Color.FromArgb(35, 35, 35))
  2077.         P2 = New Pen(Color.FromArgb(60, 60, 60))
  2078.         B1 = New SolidBrush(Color.FromArgb(50, 50, 50))
  2079.  
  2080.     End Sub
  2081.  
  2082.     Protected Overrides Sub ColorHook()
  2083.         topc = GetColor("top")
  2084.         botc = GetColor("bottom")
  2085.         topc2 = GetColor("top2")
  2086.         botc2 = GetColor("bottom2")
  2087.     End Sub
  2088.  
  2089.     Private Function PrepareBorder() As GraphicsPath
  2090.         Dim P As New GraphicsPath()
  2091.  
  2092.         Dim PS As New List(Of Point)
  2093.         PS.Add(New Point(0, 2))
  2094.         PS.Add(New Point(2, 0))
  2095.         PS.Add(New Point(100, 0))
  2096.         PS.Add(New Point(115, 15))
  2097.         PS.Add(New Point(Width - 1 - 115, 15))
  2098.         PS.Add(New Point(Width - 1 - 100, 0))
  2099.         PS.Add(New Point(Width - 2, 0))
  2100.         PS.Add(New Point(Width - 1, 3))
  2101.  
  2102.  
  2103.         'PS.Add(New Point(Width - 1, Height - 1))
  2104.  
  2105.         'bottom
  2106.         PS.Add(New Point(Width - 1, Height - 3))
  2107.         PS.Add(New Point(Width - 3, Height - 1))
  2108.         PS.Add(New Point(Width - 100, Height - 1))
  2109.         PS.Add(New Point(Width - 115, Height - 15 - 1))
  2110.         PS.Add(New Point(116, Height - 15 - 1))
  2111.         PS.Add(New Point(101, Height - 1))
  2112.         PS.Add(New Point(2, Height - 1))
  2113.         PS.Add(New Point(0, Height - 2))
  2114.  
  2115.         P.AddPolygon(PS.ToArray())
  2116.         Return P
  2117.     End Function
  2118.  
  2119.     'Private Function FormInsideSQ()
  2120.     '    Dim P As New GraphicsPath()
  2121.     '    Dim PS As New List(Of Point)
  2122.  
  2123.     '    PS.Add(New Point(6, Height - 310))
  2124.     '    PS.Add(New Point(Width - 6, 64))
  2125.     '    PS.Add(New Point(Width - 6, Height - 6))
  2126.     '    PS.Add(New Point(Width - 100, Height - 6))
  2127.     '    PS.Add(New Point(Width - 116, Height - 22))
  2128.     '    PS.Add(New Point(Width - 522, Height - 22))
  2129.     '    PS.Add(New Point(Width - 538, Height - 6))
  2130.     '    PS.Add(New Point(6, Height - 6))
  2131.     '    P.AddPolygon(PS.ToArray())
  2132.     '    Return p
  2133.     'End Function
  2134.  
  2135.  
  2136.  
  2137.     Protected Overrides Sub PaintHook()
  2138.         TransparencyKey = Color.Fuchsia
  2139.  
  2140.         G.Clear(Color.Fuchsia)
  2141.  
  2142.  
  2143.  
  2144.  
  2145.         Dim HB As New HatchBrush(HatchStyle.Trellis, Color.FromArgb(50, Color.FromArgb(38, 138, 201)), Color.FromArgb(80, Color.FromArgb(12, 40, 57)))
  2146.         Dim linear As New LinearGradientBrush(New Rectangle(0, 0, Width, Height), Color.FromArgb(108, 137, 184), Color.FromArgb(13, 20, 25), 20.0F)
  2147.  
  2148.         G.FillRectangle(linear, New Rectangle(3, 3, Width - 5, Height - 3))
  2149.  
  2150.         G.FillRectangle(HB, New Rectangle(3, 3, Width - 5, Height - 3))
  2151.  
  2152.  
  2153.         G.DrawLine(Pens.Fuchsia, 1, 0, Width - 1, 0)
  2154.         G.DrawLine(Pens.Fuchsia, 1, 1, Width - 1, 1)
  2155.         G.DrawLine(New Pen(Color.FromArgb(26, 47, 59)), 1, 2, Width - 1, 2)
  2156.  
  2157.         G.DrawLine(Pens.Fuchsia, 1, Height - 1, Width - 1, Height - 1)
  2158.         G.DrawLine(Pens.Fuchsia, 1, Height - 2, Width - 1, Height - 2)
  2159.         G.DrawLine(New Pen(Color.FromArgb(26, 47, 59)), 1, Height - 2, Width - 4, Height - 2)
  2160.  
  2161.  
  2162.  
  2163.  
  2164.         Dim GPF As GraphicsPath = PrepareBorder()
  2165.  
  2166.  
  2167.         Dim PB2 As PathGradientBrush
  2168.         PB2 = New PathGradientBrush(GPF)
  2169.         PB2.CenterColor = Color.FromArgb(250, 250, 250)
  2170.         PB2.SurroundColors = {Color.FromArgb(237, 237, 237)}
  2171.         PB2.FocusScales = New PointF(0.9F, 0.5F)
  2172.  
  2173.         G.SetClip(GPF)
  2174.  
  2175.         G.FillPath(PB2, GPF)
  2176.         G.DrawPath(New Pen(Color.White, 3), GPF)
  2177.         G.ResetClip()
  2178.  
  2179.         Dim tmpG As GraphicsPath = PrepareBorder()
  2180.  
  2181.         G.DrawPath(Pens.Gray, tmpG)
  2182.  
  2183.  
  2184.  
  2185.         Dim linear2 As New LinearGradientBrush(New Rectangle(0, 0, Width - 1, Height - 1), Color.FromArgb(13, 59, 85), Color.FromArgb(22, 35, 43), 180.0F)
  2186.  
  2187.  
  2188.  
  2189.         Dim barGP As New GraphicsPath
  2190.  
  2191.         Dim PB3 As PathGradientBrush
  2192.         PB3 = New PathGradientBrush(GPF)
  2193.         PB3.CenterColor = Color.FromArgb(39, 60, 73)
  2194.         PB3.SurroundColors = {Color.FromArgb(31, 105, 152)}
  2195.         PB3.FocusScales = New PointF(0.5F, 0.5F)
  2196.         PB3.CenterPoint = New Point(Width / 2, 10)
  2197.  
  2198.         barGP.AddRectangle(New Rectangle(0, 39, Width - 1, 20))
  2199.  
  2200.         G.FillPath(PB3, barGP)
  2201.         G.FillPath(New HatchBrush(HatchStyle.NarrowHorizontal, Color.FromArgb(20, 34, 45), Color.Transparent), barGP)
  2202.  
  2203.         '// get rid of some pixels
  2204.         G.DrawRectangle(Pens.Fuchsia, New Rectangle(Width - 4, 40, 3, 17))
  2205.         G.FillRectangle(Brushes.Fuchsia, New Rectangle(Width - 4, 40, 3, 17))
  2206.  
  2207.         G.DrawRectangle(Pens.Fuchsia, New Rectangle(0, 40, 3, 17))
  2208.         G.FillRectangle(Brushes.Fuchsia, New Rectangle(0, 40, 3, 17))
  2209.  
  2210.  
  2211.         '// inside square
  2212.  
  2213.         'Dim SQpth As GraphicsPath = FormInsideSQ()
  2214.         ' G.DrawPath(Pens.Red, SQpth)
  2215.  
  2216.  
  2217.  
  2218.         DrawText(New SolidBrush(Color.FromArgb(30, Color.Black)), HorizontalAlignment.Left, 12, 6)
  2219.         DrawText(New SolidBrush(Color.FromArgb(20, Color.Black)), HorizontalAlignment.Left, 11, 5)
  2220.         DrawText(Brushes.Black, HorizontalAlignment.Left, 10, 4)
  2221.  
  2222.  
  2223.  
  2224.  
  2225.  
  2226.     End Sub
  2227. End Class
  2228. #End Region
  2229. #Region "SLCbtn"
  2230. Class SLCbtn
  2231.     Inherits ThemeControl154
  2232.  
  2233.  
  2234.     Protected Overrides Sub ColorHook()
  2235.  
  2236.     End Sub
  2237.  
  2238.     Protected Overrides Sub PaintHook()
  2239.         G.SmoothingMode = SmoothingMode.HighQuality
  2240.         G.Clear(Color.White)
  2241.  
  2242.         Select Case State
  2243.             Case MouseState.None
  2244.  
  2245.                 '// bnt form
  2246.  
  2247.                 Dim linear As New LinearGradientBrush(New Rectangle(0, 0, Width, Height / 2), Color.FromArgb(100, Color.FromArgb(207, 207, 207)), Color.FromArgb(250, 250, 250), 90.0F)
  2248.                 Dim gp As New GraphicsPath
  2249.                 gp = CreateRound(0, 0, Width - 1, Height - 1, 7)
  2250.                 G.FillPath(linear, gp)
  2251.                 G.DrawPath(New Pen(Color.FromArgb(105, 112, 115)), gp)
  2252.                 G.SetClip(gp)
  2253.                 Dim btninsideborder As GraphicsPath = CreateRound(1, 1, Width - 3, Height - 3, 7)
  2254.                 G.DrawPath(New Pen(Color.White, 1), btninsideborder)
  2255.                 G.ResetClip()
  2256.  
  2257.                 '// circle
  2258.  
  2259.  
  2260.  
  2261.                 'Dim GPF As New GraphicsPath
  2262.                 'GPF.AddEllipse(New Rectangle(4, Height / 2 - 2.5, 6, 6))
  2263.                 'Dim PB2 As PathGradientBrush
  2264.                 'PB2 = New PathGradientBrush(GPF)
  2265.                 'PB2.CenterColor = Color.FromArgb(69, 128, 156)
  2266.                 'PB2.SurroundColors = {Color.FromArgb(8, 25, 33)}
  2267.                 'PB2.FocusScales = New PointF(0.9F, 0.9F)
  2268.  
  2269.  
  2270.                 'G.FillPath(PB2, GPF)
  2271.  
  2272.                 'G.DrawPath(New Pen(Color.FromArgb(49, 63, 86)), GPF)
  2273.  
  2274.                 'G.DrawEllipse(New Pen(Color.LightGray), New Rectangle(3, Height / 2 - 3.1, 8, 8))
  2275.  
  2276.                 DrawText(New SolidBrush(Color.FromArgb(1, 75, 124)), HorizontalAlignment.Left, 5, 1)
  2277.             Case MouseState.Down
  2278.                 '// bnt form
  2279.  
  2280.                 Dim linear As New LinearGradientBrush(New Rectangle(0, 0, Width, Height / 2), Color.FromArgb(100, Color.FromArgb(207, 207, 207)), Color.FromArgb(250, 250, 250), 90.0F)
  2281.                 Dim gp As New GraphicsPath
  2282.                 gp = CreateRound(0, 0, Width - 1, Height - 1, 7)
  2283.                 G.FillPath(linear, gp)
  2284.                 G.DrawPath(New Pen(Color.FromArgb(105, 112, 115)), gp)
  2285.                 G.SetClip(gp)
  2286.                 Dim btninsideborder As GraphicsPath = CreateRound(1, 1, Width - 3, Height - 3, 7)
  2287.                 G.DrawPath(New Pen(Color.White, 1), btninsideborder)
  2288.                 G.ResetClip()
  2289.  
  2290.                 '// circle
  2291.  
  2292.  
  2293.  
  2294.                 'Dim GPF As New GraphicsPath
  2295.                 'GPF.AddEllipse(New Rectangle(4, Height / 2 - 2.5, 6, 6))
  2296.                 'Dim PB2 As PathGradientBrush
  2297.                 'PB2 = New PathGradientBrush(GPF)
  2298.                 'PB2.CenterColor = Color.FromArgb(86, 161, 196)
  2299.                 'PB2.SurroundColors = {Color.FromArgb(94, 176, 215)}
  2300.                 'PB2.FocusScales = New PointF(0.9F, 0.9F)
  2301.  
  2302.  
  2303.                 'G.FillPath(PB2, GPF)
  2304.  
  2305.                 'G.DrawPath(New Pen(Color.FromArgb(105, 194, 236)), GPF)
  2306.  
  2307.                 'G.DrawEllipse(New Pen(Color.LightGray), New Rectangle(3, Height / 2 - 3.1, 8, 8))
  2308.  
  2309.                 DrawText(New SolidBrush(Color.FromArgb(86, 161, 196)), HorizontalAlignment.Left, 5, 1)
  2310.  
  2311.             Case MouseState.Over
  2312.                 '// bnt form
  2313.  
  2314.                 Dim linear As New LinearGradientBrush(New Rectangle(0, 0, Width, Height / 2), Color.FromArgb(100, Color.FromArgb(207, 207, 207)), Color.FromArgb(250, 250, 250), 90.0F)
  2315.                 Dim gp As New GraphicsPath
  2316.                 gp = CreateRound(0, 0, Width - 1, Height - 1, 7)
  2317.                 G.FillPath(linear, gp)
  2318.                 G.DrawPath(New Pen(Color.FromArgb(105, 112, 115)), gp)
  2319.                 G.SetClip(gp)
  2320.                 Dim btninsideborder As GraphicsPath = CreateRound(1, 1, Width - 3, Height - 3, 7)
  2321.                 G.DrawPath(New Pen(Color.FromArgb(50, Color.Gray), 1), btninsideborder)
  2322.                 G.ResetClip()
  2323.  
  2324.                 '// circle
  2325.  
  2326.  
  2327.                 'Dim GPF As New GraphicsPath
  2328.                 'GPF.AddEllipse(New Rectangle(4, Height / 2 - 2.5, 6, 6))
  2329.                 'Dim PB2 As PathGradientBrush
  2330.                 'PB2 = New PathGradientBrush(GPF)
  2331.                 'PB2.CenterColor = Color.FromArgb(69, 128, 156)
  2332.                 'PB2.SurroundColors = {Color.FromArgb(8, 25, 33)}
  2333.                 'PB2.FocusScales = New PointF(0.9F, 0.9F)
  2334.  
  2335.  
  2336.                 'G.FillPath(PB2, GPF)
  2337.  
  2338.                 'G.DrawPath(New Pen(Color.FromArgb(49, 63, 86)), GPF)
  2339.                 'G.DrawEllipse(New Pen(Color.LightGray), New Rectangle(3, Height / 2 - 3.1, 8, 8))
  2340.                 DrawText(New SolidBrush(Color.FromArgb(1, 75, 124)), HorizontalAlignment.Left, 5, 1)
  2341.         End Select
  2342.  
  2343.     End Sub
  2344. End Class
  2345. #End Region
  2346. #Region "SLCTabControl"
  2347. Class SLCTabControl
  2348.     Inherits TabControl
  2349.  
  2350.     Sub New()
  2351.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint, True)
  2352.         DoubleBuffered = True
  2353.         SizeMode = TabSizeMode.Fixed
  2354.         ItemSize = New Size(30, 120)
  2355.  
  2356.     End Sub
  2357.  
  2358.     Protected Overrides Sub CreateHandle()
  2359.         MyBase.CreateHandle()
  2360.         Alignment = TabAlignment.Left
  2361.     End Sub
  2362.  
  2363.     Public Function Borderpts() As GraphicsPath
  2364.         Dim P As New GraphicsPath()
  2365.         Dim PS As New List(Of Point)
  2366.  
  2367.         PS.Add(New Point(0, 0))
  2368.         PS.Add(New Point(Width - 1, 0))
  2369.         PS.Add(New Point(Width - 1, Height - 1))
  2370.         PS.Add(New Point(0, Height - 1))
  2371.  
  2372.  
  2373.  
  2374.         P.AddPolygon(PS.ToArray())
  2375.         Return P
  2376.     End Function
  2377.  
  2378.     Public Function BorderptsInside() As GraphicsPath
  2379.         Dim P As New GraphicsPath()
  2380.         Dim PS As New List(Of Point)
  2381.  
  2382.         PS.Add(New Point(1, 1))
  2383.         PS.Add(New Point(122, 1))
  2384.         PS.Add(New Point(122, Height - 2))
  2385.         PS.Add(New Point(1, Height - 2))
  2386.  
  2387.  
  2388.  
  2389.         P.AddPolygon(PS.ToArray())
  2390.         Return P
  2391.     End Function
  2392.  
  2393.     Public Function BigBorder() As GraphicsPath
  2394.         Dim P As New GraphicsPath()
  2395.         Dim PS As New List(Of Point)
  2396.  
  2397.         PS.Add(New Point(50, 1))
  2398.         PS.Add(New Point(349, 50))
  2399.         PS.Add(New Point(349, 50))
  2400.         PS.Add(New Point(50, 349))
  2401.  
  2402.         P.AddPolygon(PS.ToArray())
  2403.         Return P
  2404.     End Function
  2405.  
  2406.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  2407.  
  2408.  
  2409.  
  2410.         Dim b As New Bitmap(Width, Height)
  2411.         Dim g As Graphics = Graphics.FromImage(b)
  2412.         g.Clear(Color.White)
  2413.  
  2414.  
  2415.  
  2416.  
  2417.         '//Big square shadow
  2418.  
  2419.  
  2420.  
  2421.  
  2422.  
  2423.  
  2424.  
  2425.         Dim GP1 As GraphicsPath = Borderpts()
  2426.         g.DrawPath(Pens.LightGray, GP1)
  2427.  
  2428.  
  2429.         '// small border
  2430.         Dim tmp1 As GraphicsPath = BorderptsInside()
  2431.  
  2432.         Dim PB2 As PathGradientBrush
  2433.         PB2 = New PathGradientBrush(tmp1)
  2434.         PB2.CenterColor = Color.FromArgb(250, 250, 250)
  2435.         PB2.SurroundColors = {Color.FromArgb(237, 237, 237)}
  2436.         PB2.FocusScales = New PointF(0.9F, 0.9F)
  2437.  
  2438.         g.FillPath(PB2, tmp1)
  2439.         g.DrawPath(Pens.Gray, tmp1)
  2440.  
  2441.  
  2442.  
  2443.  
  2444.         '// items
  2445.  
  2446.  
  2447.  
  2448.  
  2449.  
  2450.  
  2451.         For i = 0 To TabCount - 1
  2452.  
  2453.             Dim rec As Rectangle = GetTabRect(i)
  2454.             Dim rec2 As Rectangle = rec
  2455.  
  2456.  
  2457.             '//inside small
  2458.             rec2.Width -= 3
  2459.             rec2.Height -= 3
  2460.             rec2.Y += 1
  2461.             rec2.X += 1
  2462.  
  2463.  
  2464.  
  2465.  
  2466.             If i = SelectedIndex Then
  2467.  
  2468.  
  2469.  
  2470.                 Dim linear As New LinearGradientBrush(New Rectangle(rec2.X + 108, rec2.Y + 1, 10, rec2.Height - 1), Color.FromArgb(227, 227, 227), Color.Transparent, 180.0F)
  2471.                 Dim linear3 As New LinearGradientBrush(New Rectangle(rec2.X, rec2.Y + 1, 10, rec2.Height - 1), Color.FromArgb(227, 227, 227), Color.Transparent, 180.0F)
  2472.  
  2473.  
  2474.                 g.FillRectangle(New SolidBrush(Color.FromArgb(242, 242, 242)), rec2)
  2475.                 g.DrawRectangle(Pens.White, rec2)
  2476.                 g.DrawRectangle(New Pen(Color.FromArgb(70, Color.FromArgb(39, 93, 127)), 2), rec)
  2477.                 g.FillRectangle(linear, New Rectangle(rec2.X + 113, rec2.Y + 1, 6, rec2.Height - 1))
  2478.                 g.FillRectangle(linear3, New Rectangle(rec2.X, rec2.Y + 1, 6, rec2.Height - 1))
  2479.                 '// circle
  2480.  
  2481.  
  2482.                 g.SmoothingMode = SmoothingMode.HighQuality
  2483.                 '    g.DrawEllipse(New Pen(Color.FromArgb(200, 200, 200), 3), New Rectangle(rec2.X + 6.5, rec2.Y + 7, 14, 14))
  2484.                 ' g.DrawEllipse(New Pen(Color.FromArgb(150, 150, 150), 1), New Rectangle(rec2.X + 6.5, rec2.Y + 7, 14, 14))
  2485.  
  2486.  
  2487.                 Dim GPF As New GraphicsPath
  2488.                 GPF.AddEllipse(New Rectangle(rec2.X + 8, rec2.Y + 8, 12, 12))
  2489.                 Dim PB3 As PathGradientBrush
  2490.                 PB3 = New PathGradientBrush(GPF)
  2491.                 PB3.CenterPoint = New Point(rec2.X - 10, rec2.Y - 10)
  2492.                 PB3.CenterColor = Color.FromArgb(56, 142, 196)
  2493.                 PB3.SurroundColors = {Color.FromArgb(64, 106, 140)}
  2494.                 PB3.FocusScales = New PointF(0.9F, 0.9F)
  2495.  
  2496.  
  2497.                 g.FillPath(PB3, GPF)
  2498.  
  2499.                 g.DrawPath(New Pen(Color.FromArgb(49, 63, 86)), GPF)
  2500.                 g.SetClip(GPF)
  2501.                 g.FillEllipse(New SolidBrush(Color.FromArgb(40, Color.WhiteSmoke)), New Rectangle(rec2.X + 10.5, rec2.Y + 11, 6, 6))
  2502.                 g.ResetClip()
  2503.  
  2504.  
  2505.  
  2506.                 g.SmoothingMode = SmoothingMode.None
  2507.  
  2508.             Else
  2509.  
  2510.                 g.SmoothingMode = SmoothingMode.HighQuality
  2511.                 Dim linear As New LinearGradientBrush(New Rectangle(rec2.X + 108, rec2.Y + 1, 10, rec2.Height - 1), Color.FromArgb(227, 227, 227), Color.Transparent, 180.0F)
  2512.                 Dim linear3 As New LinearGradientBrush(New Rectangle(rec2.X, rec2.Y + 1, 10, rec2.Height - 1), Color.FromArgb(227, 227, 227), Color.Transparent, 180.0F)
  2513.  
  2514.  
  2515.                 g.FillRectangle(New SolidBrush(Color.FromArgb(242, 242, 242)), rec2)
  2516.                 g.DrawRectangle(Pens.White, rec2)
  2517.                 g.DrawRectangle(New Pen(Color.FromArgb(70, Color.FromArgb(39, 93, 127)), 2), rec)
  2518.                 g.FillRectangle(linear, New Rectangle(rec2.X + 113, rec2.Y + 1, 6, rec2.Height - 1))
  2519.                 g.FillRectangle(linear3, New Rectangle(rec2.X, rec2.Y + 1, 6, rec2.Height - 1))
  2520.  
  2521.  
  2522.                 g.FillEllipse(Brushes.LightGray, New Rectangle(rec2.X + 8, rec2.Y + 8, 12, 12))
  2523.                 g.DrawEllipse(New Pen(Color.FromArgb(100, 100, 100), 1), New Rectangle(rec2.X + 8, rec2.Y + 8, 12, 12))
  2524.                 g.SmoothingMode = SmoothingMode.None
  2525.  
  2526.             End If
  2527.  
  2528.             g.DrawString(TabPages(i).Text, Font, New SolidBrush(Color.FromArgb(56, 106, 137)), rec, New StringFormat With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  2529.         Next
  2530.  
  2531.  
  2532.  
  2533.  
  2534.         e.Graphics.DrawImage(b.Clone, 0, 0)
  2535.         g.Dispose()
  2536.         b.Dispose()
  2537.         MyBase.OnPaint(e)
  2538.     End Sub
  2539. End Class
  2540. #End Region
  2541. #Region "SLCTextbox"
  2542. <DefaultEvent("TextChanged")> Class SLCTextBox : Inherits Control
  2543.  
  2544. #Region " Variables"
  2545.     Private TB As Windows.Forms.TextBox
  2546.     Private State As MouseState = MouseState.None
  2547. #End Region
  2548.  
  2549. #Region " Properties"
  2550.     Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
  2551.         MyBase.OnMouseEnter(e)
  2552.         State = MouseState.Over : Invalidate()
  2553.     End Sub
  2554.     Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  2555.         MyBase.OnMouseDown(e)
  2556.         State = MouseState.Down : Invalidate()
  2557.     End Sub
  2558.     Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
  2559.         MyBase.OnMouseLeave(e)
  2560.         State = MouseState.None : Invalidate()
  2561.     End Sub
  2562.     Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  2563.         MyBase.OnMouseUp(e)
  2564.         State = MouseState.Over : TB.Focus() : Invalidate()
  2565.     End Sub
  2566.  
  2567.     Protected Overrides Sub OnEnter(ByVal e As EventArgs)
  2568.         MyBase.OnEnter(e) : TB.Focus() : Invalidate()
  2569.     End Sub
  2570.     Protected Overrides Sub OnLeave(ByVal e As EventArgs)
  2571.         MyBase.OnLeave(e) : Invalidate()
  2572.     End Sub
  2573.     Protected Overrides Sub OnMouseMove(ByVal e As System.Windows.Forms.MouseEventArgs)
  2574.         MyBase.OnMouseMove(e) : Invalidate()
  2575.     End Sub
  2576.  
  2577.     Private _TextAlign As HorizontalAlignment = HorizontalAlignment.Left
  2578.     Property TextAlign() As HorizontalAlignment
  2579.         Get
  2580.             Return _TextAlign
  2581.         End Get
  2582.         Set(ByVal value As HorizontalAlignment)
  2583.             _TextAlign = value
  2584.             If TB IsNot Nothing Then
  2585.                 TB.TextAlign = value
  2586.             End If
  2587.         End Set
  2588.     End Property
  2589.     Private _MaxLength As Integer = 32767
  2590.     Property MaxLength() As Integer
  2591.         Get
  2592.             Return _MaxLength
  2593.         End Get
  2594.         Set(ByVal value As Integer)
  2595.             _MaxLength = value
  2596.             If TB IsNot Nothing Then
  2597.                 TB.MaxLength = value
  2598.             End If
  2599.         End Set
  2600.     End Property
  2601.     Private _ReadOnly As Boolean
  2602.     Property [ReadOnly]() As Boolean
  2603.         Get
  2604.             Return _ReadOnly
  2605.         End Get
  2606.         Set(ByVal value As Boolean)
  2607.             _ReadOnly = value
  2608.             If TB IsNot Nothing Then
  2609.                 TB.ReadOnly = value
  2610.             End If
  2611.         End Set
  2612.     End Property
  2613.     Private _UseSystemPasswordChar As Boolean
  2614.     Property UseSystemPasswordChar() As Boolean
  2615.         Get
  2616.             Return _UseSystemPasswordChar
  2617.         End Get
  2618.         Set(ByVal value As Boolean)
  2619.             _UseSystemPasswordChar = value
  2620.             If TB IsNot Nothing Then
  2621.                 TB.UseSystemPasswordChar = value
  2622.             End If
  2623.         End Set
  2624.     End Property
  2625.     Private _Multiline As Boolean
  2626.     Property Multiline() As Boolean
  2627.         Get
  2628.             Return _Multiline
  2629.         End Get
  2630.         Set(ByVal value As Boolean)
  2631.             _Multiline = value
  2632.             If TB IsNot Nothing Then
  2633.                 TB.Multiline = value
  2634.  
  2635.                 If value Then
  2636.                     TB.Height = Height - 11
  2637.                 Else
  2638.                     Height = TB.Height + 11
  2639.                 End If
  2640.  
  2641.             End If
  2642.         End Set
  2643.     End Property
  2644.     Overrides Property Text As String
  2645.         Get
  2646.             Return MyBase.Text
  2647.         End Get
  2648.         Set(ByVal value As String)
  2649.             MyBase.Text = value
  2650.             If TB IsNot Nothing Then
  2651.                 TB.Text = value
  2652.             End If
  2653.         End Set
  2654.     End Property
  2655.     Overrides Property Font As Font
  2656.         Get
  2657.             Return MyBase.Font
  2658.         End Get
  2659.         Set(ByVal value As Font)
  2660.             MyBase.Font = value
  2661.             If TB IsNot Nothing Then
  2662.                 TB.Font = value
  2663.                 TB.Location = New Point(3, 5)
  2664.                 TB.Width = Width - 6
  2665.  
  2666.                 If Not _Multiline Then
  2667.                     Height = TB.Height + 11
  2668.                 End If
  2669.             End If
  2670.         End Set
  2671.     End Property
  2672.     Protected Overrides Sub OnCreateControl()
  2673.         MyBase.OnCreateControl()
  2674.         If Not Controls.Contains(TB) Then
  2675.             Controls.Add(TB)
  2676.         End If
  2677.     End Sub
  2678.     Private Sub OnBaseTextChanged(ByVal s As Object, ByVal e As EventArgs)
  2679.         Text = TB.Text
  2680.     End Sub
  2681.     Private Sub OnBaseKeyDown(ByVal s As Object, ByVal e As KeyEventArgs)
  2682.         If e.Control AndAlso e.KeyCode = Keys.A Then
  2683.             TB.SelectAll()
  2684.             e.SuppressKeyPress = True
  2685.         End If
  2686.         If e.Control AndAlso e.KeyCode = Keys.C Then
  2687.             TB.Copy()
  2688.             e.SuppressKeyPress = True
  2689.         End If
  2690.     End Sub
  2691.  
  2692.     Protected Overrides Sub OnResize(ByVal e As EventArgs)
  2693.         TB.Location = New Point(5, 5)
  2694.         TB.Width = Width - 10
  2695.  
  2696.         If _Multiline Then
  2697.             TB.Height = Height - 11
  2698.         Else
  2699.             Height = TB.Height + 11
  2700.         End If
  2701.  
  2702.         MyBase.OnResize(e)
  2703.     End Sub
  2704. #End Region
  2705.  
  2706.     Sub New()
  2707.         SetStyle(ControlStyles.AllPaintingInWmPaint Or _
  2708.               ControlStyles.UserPaint Or _
  2709.               ControlStyles.OptimizedDoubleBuffer Or _
  2710.               ControlStyles.ResizeRedraw Or ControlStyles.SupportsTransparentBackColor Or ControlStyles.Selectable, True)
  2711.  
  2712.         DoubleBuffered = True
  2713.  
  2714.         TB = New Windows.Forms.TextBox
  2715.         TB.Font = New Font("Tahoma", 8)
  2716.         TB.BackColor = Color.White
  2717.         TB.ForeColor = Color.FromArgb(1, 75, 124)
  2718.         TB.MaxLength = _MaxLength
  2719.         TB.Multiline = _Multiline
  2720.         TB.ReadOnly = _ReadOnly
  2721.         TB.UseSystemPasswordChar = _UseSystemPasswordChar
  2722.         TB.BorderStyle = BorderStyle.None
  2723.         TB.Location = New Point(5, 5)
  2724.         TB.Width = Width - 10
  2725.  
  2726.         TB.Cursor = Cursors.IBeam
  2727.  
  2728.         If _Multiline Then
  2729.             TB.Height = Height - 11
  2730.         Else
  2731.             Height = TB.Height + 11
  2732.         End If
  2733.  
  2734.         AddHandler TB.TextChanged, AddressOf OnBaseTextChanged
  2735.         AddHandler TB.KeyDown, AddressOf OnBaseKeyDown
  2736.     End Sub
  2737.     Public Function Borderpts() As Rectangle
  2738.         Dim P As New Rectangle
  2739.  
  2740.  
  2741.         P = New Rectangle(2, 2, Width - 5, Height - 5)
  2742.         Return P
  2743.     End Function
  2744.  
  2745.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  2746.         Dim B As New Bitmap(Width, Height)
  2747.         Dim G As Graphics = Graphics.FromImage(B)
  2748.  
  2749.  
  2750.         Dim PB1 As PathGradientBrush
  2751.         Dim GP1 As GraphicsPath = RoundRec(Borderpts, 2)
  2752.  
  2753.  
  2754.  
  2755.  
  2756.  
  2757.         With G
  2758.             .SmoothingMode = 2
  2759.             .TextRenderingHint = 1
  2760.             .Clear(Color.White)
  2761.  
  2762.             PB1 = New PathGradientBrush(GP1)
  2763.             PB1.CenterColor = Color.White
  2764.             PB1.SurroundColors = {Color.FromArgb(234, 234, 234)}
  2765.             PB1.FocusScales = New PointF(0.9F, 0.5F)
  2766.  
  2767.  
  2768.  
  2769.             .FillPath(PB1, GP1)
  2770.             .DrawPath(New Pen(Color.FromArgb(125, 125, 125)), GP1)
  2771.  
  2772.  
  2773.             MyBase.OnPaint(e)
  2774.             G.Dispose()
  2775.             e.Graphics.InterpolationMode = 7
  2776.             e.Graphics.DrawImageUnscaled(B, 0, 0)
  2777.             B.Dispose()
  2778.         End With
  2779.     End Sub
  2780.  
  2781.     Public Function RoundRec(ByVal Rectangle As Rectangle, ByVal Curve As Integer) As GraphicsPath
  2782.         Dim P As GraphicsPath = New GraphicsPath()
  2783.         Dim ArcRectangleWidth As Integer = Curve * 2
  2784.         P.AddArc(New Rectangle(Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -180, 90)
  2785.         P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -90, 90)
  2786.         P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 0, 90)
  2787.         P.AddArc(New Rectangle(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 90, 90)
  2788.         P.AddLine(New Point(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y), New Point(Rectangle.X, Curve + Rectangle.Y))
  2789.         Return P
  2790.     End Function
  2791. End Class
  2792. #End Region
  2793. #Region "SLCRadioButton"
  2794. <DefaultEvent("CheckedChanged")> _
  2795. Class SLCRadionButton
  2796.     Inherits Control
  2797.  
  2798.     Event CheckedChanged(ByVal sender As Object)
  2799.  
  2800.     Sub New()
  2801.         SetStyle(DirectCast(139286, ControlStyles), True)
  2802.         SetStyle(ControlStyles.Selectable, False)
  2803.         SetStyle(ControlStyles.SupportsTransparentBackColor, True)
  2804.  
  2805.         BackColor = Color.White
  2806.  
  2807.         P1 = New Pen(Color.FromArgb(55, 55, 55))
  2808.         P2 = New Pen(Brushes.Red)
  2809.     End Sub
  2810.  
  2811.     Private _Checked As Boolean
  2812.     Public Property Checked() As Boolean
  2813.         Get
  2814.             Return _Checked
  2815.         End Get
  2816.         Set(ByVal value As Boolean)
  2817.             _Checked = value
  2818.  
  2819.             If _Checked Then
  2820.                 InvalidateParent()
  2821.             End If
  2822.  
  2823.             RaiseEvent CheckedChanged(Me)
  2824.             Invalidate()
  2825.         End Set
  2826.     End Property
  2827.  
  2828.     Private Sub InvalidateParent()
  2829.         If Parent Is Nothing Then Return
  2830.  
  2831.         For Each C As Control In Parent.Controls
  2832.             If Not (C Is Me) AndAlso (TypeOf C Is SLCRadionButton) Then
  2833.                 DirectCast(C, SLCRadionButton).Checked = False
  2834.             End If
  2835.         Next
  2836.     End Sub
  2837.  
  2838.     Private GP1 As GraphicsPath
  2839.  
  2840.     Private SZ1 As SizeF
  2841.     Private PT1 As PointF
  2842.  
  2843.     Private P1, P2 As Pen
  2844.  
  2845.     Private PB1 As PathGradientBrush
  2846.  
  2847.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  2848.         Dim G As Graphics
  2849.         G = e.Graphics
  2850.  
  2851.  
  2852.         G.Clear(BackColor)
  2853.         G.SmoothingMode = SmoothingMode.AntiAlias
  2854.  
  2855.         GP1 = New GraphicsPath
  2856.         GP1.AddEllipse(0, 2, Height - 5, Height - 5)
  2857.  
  2858.         PB1 = New PathGradientBrush(GP1)
  2859.         PB1.CenterColor = Color.FromArgb(50, 50, 50)
  2860.         PB1.SurroundColors = {Color.FromArgb(45, 45, 45)}
  2861.         PB1.FocusScales = New PointF(0.3F, 0.3F)
  2862.  
  2863.         ' G.FillPath(PB1, GP1)
  2864.  
  2865.         G.DrawEllipse(P1, 4, 4, Height - 11, Height - 11)
  2866.         ' G.DrawEllipse(P2, 1, 3, Height - 7, Height - 7)
  2867.  
  2868.         If _Checked Then
  2869.             Dim GPF As New GraphicsPath
  2870.             GPF.AddEllipse(New Rectangle(Height - 18.5, Height - 19, 12, 12))
  2871.             Dim PB3 As PathGradientBrush
  2872.             PB3 = New PathGradientBrush(GPF)
  2873.             PB3.CenterPoint = New Point(Height - 18.5, Height - 20)
  2874.             PB3.CenterColor = Color.FromArgb(56, 142, 196)
  2875.             PB3.SurroundColors = {Color.FromArgb(64, 106, 140)}
  2876.             PB3.FocusScales = New PointF(0.9F, 0.9F)
  2877.  
  2878.  
  2879.             G.FillPath(PB3, GPF)
  2880.  
  2881.             G.DrawPath(New Pen(Color.FromArgb(49, 63, 86)), GPF)
  2882.             G.SetClip(GPF)
  2883.             G.FillEllipse(New SolidBrush(Color.FromArgb(40, Color.WhiteSmoke)), New Rectangle(Height - 16, Height - 18, 6, 6))
  2884.             G.ResetClip()
  2885.         End If
  2886.  
  2887.         SZ1 = G.MeasureString(Text, Font)
  2888.         PT1 = New PointF(Height - 3, Height \ 2 - SZ1.Height / 2)
  2889.  
  2890.  
  2891.         G.DrawString(Text, Font, New SolidBrush(Color.FromArgb(1, 75, 124)), PT1)
  2892.     End Sub
  2893.  
  2894.     Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  2895.         Checked = True
  2896.         MyBase.OnMouseDown(e)
  2897.     End Sub
  2898.  
  2899. End Class
  2900. #End Region
  2901. #Region "SLCComboBox"
  2902. Class SLCComboBox
  2903.     Inherits ComboBox
  2904.  
  2905.     Sub New()
  2906.         SetStyle(DirectCast(139286, ControlStyles), True)
  2907.         SetStyle(ControlStyles.Selectable, False)
  2908.  
  2909.         DrawMode = Windows.Forms.DrawMode.OwnerDrawFixed
  2910.         DropDownStyle = ComboBoxStyle.DropDownList
  2911.  
  2912.  
  2913.         DrawMode = Windows.Forms.DrawMode.OwnerDrawFixed
  2914.  
  2915.  
  2916.     End Sub
  2917.  
  2918.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  2919.         Dim G As Graphics = e.Graphics
  2920.         G.Clear(Color.White)
  2921.  
  2922.  
  2923.  
  2924.  
  2925.  
  2926.         'inside borders
  2927.  
  2928.  
  2929.  
  2930.         Dim GP As GraphicsPath = RoundRec(New Rectangle(0, 0, Width - 1, Height - 1), 5)
  2931.         Dim GP2 As GraphicsPath = RoundRec(New Rectangle(1, 1, Width - 3, Height - 3), 5)
  2932.         Dim GP3 As GraphicsPath = RoundRec(New Rectangle(2, 2, Width - 5, Height - 5), 5)
  2933.  
  2934.  
  2935.         G.SmoothingMode = SmoothingMode.HighQuality
  2936.  
  2937.         G.FillPath(New SolidBrush(Color.FromArgb(250, 250, 250)), GP3)
  2938.         G.DrawPath(New Pen(Color.FromArgb(60, Color.LightGray), 4), GP2)
  2939.         G.DrawPath(New Pen(Color.FromArgb(100, Color.FromArgb(15, 15, 15))), GP)
  2940.         ' G.DrawPath(New Pen(Color.FromArgb(60, Color.LightGray), 4), GP3)
  2941.         G.SmoothingMode = SmoothingMode.None
  2942.  
  2943.         Dim rect1 As New Rectangle(Width - 26, 0, 1, Height)
  2944.         Dim rect2 As New Rectangle(Width - 27, 0, 2, Height)
  2945.         G.FillRectangle(New SolidBrush(Color.FromArgb(30, Color.FromArgb(1, 75, 124))), rect1)
  2946.         G.DrawRectangle(New Pen(Color.FromArgb(60, Color.FromArgb(61, 113, 153))), rect1)
  2947.  
  2948.  
  2949.  
  2950.         'little arrow shit
  2951.  
  2952.         G.SmoothingMode = SmoothingMode.HighQuality
  2953.  
  2954.  
  2955.         G.DrawArc(New Pen(Color.FromArgb(97, 152, 195)), New Rectangle(Width - 18, Height - 19, 8, 8), 20, 140)
  2956.  
  2957.         G.DrawArc(New Pen(Color.LightGray), New Rectangle(Width - 18, Height - 18, 8, 8), 10, 160)
  2958.         G.DrawArc(New Pen(Color.FromArgb(78, 121, 154), 1.5), New Rectangle(Width - 18, Height - 20, 8, 8), 20, 140)
  2959.  
  2960.  
  2961.  
  2962.         G.DrawArc(New Pen(Color.FromArgb(97, 152, 195)), New Rectangle(Width - 19, Height - 16, 10, 10), 20, 140)
  2963.  
  2964.         G.DrawArc(New Pen(Color.LightGray), New Rectangle(Width - 19, Height - 15, 10, 10), 10, 160)
  2965.         G.DrawArc(New Pen(Color.FromArgb(78, 121, 154), 1.5), New Rectangle(Width - 19, Height - 17, 10, 10), 20, 140)
  2966.         G.SmoothingMode = SmoothingMode.None
  2967.  
  2968.  
  2969.         Dim PT1 As New PointF(3, Height - 18)
  2970.  
  2971.         G.DrawString(Text, Font, New SolidBrush(Color.FromArgb(1, 75, 124)), PT1)
  2972.     End Sub
  2973.  
  2974.     Protected Overrides Sub OnDrawItem(ByVal e As DrawItemEventArgs)
  2975.  
  2976.         If (e.State And DrawItemState.Selected) = DrawItemState.Selected Then
  2977.             e.Graphics.FillRectangle(Brushes.LightGray, e.Bounds)
  2978.         Else
  2979.             e.Graphics.FillRectangle(New SolidBrush(Color.FromArgb(250, 250, 250)), e.Bounds)
  2980.         End If
  2981.  
  2982.         If Not e.Index = -1 Then
  2983.             e.Graphics.DrawString(GetItemText(Items(e.Index)), e.Font, New SolidBrush(Color.FromArgb(1, 75, 124)), e.Bounds)
  2984.         End If
  2985.     End Sub
  2986.  
  2987.     Public Function RoundRec(ByVal Rectangle As Rectangle, ByVal Curve As Integer) As GraphicsPath
  2988.         Dim P As GraphicsPath = New GraphicsPath()
  2989.         Dim ArcRectangleWidth As Integer = Curve * 2
  2990.         P.AddArc(New Rectangle(Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -180, 90)
  2991.         P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -90, 90)
  2992.         P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 0, 90)
  2993.         P.AddArc(New Rectangle(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 90, 90)
  2994.         P.AddLine(New Point(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y), New Point(Rectangle.X, Curve + Rectangle.Y))
  2995.         Return P
  2996.     End Function
  2997. End Class
  2998. #End Region
  2999. #Region "SLCProgrssBar"
  3000. Class SLCProgrssBar
  3001.     Inherits Control
  3002.  
  3003.     Private _Minimum As Integer
  3004.     Property Minimum() As Integer
  3005.         Get
  3006.             Return _Minimum
  3007.         End Get
  3008.         Set(ByVal value As Integer)
  3009.             If value < 0 Then
  3010.                 Throw New Exception("Property value is not valid.")
  3011.             End If
  3012.  
  3013.             _Minimum = value
  3014.             If value > _Value Then _Value = value
  3015.             If value > _Maximum Then _Maximum = value
  3016.             Invalidate()
  3017.         End Set
  3018.     End Property
  3019.  
  3020.     Private _Maximum As Integer = 100
  3021.     Property Maximum() As Integer
  3022.         Get
  3023.             Return _Maximum
  3024.         End Get
  3025.         Set(ByVal value As Integer)
  3026.             If value < 0 Then
  3027.                 Throw New Exception("Property value is not valid.")
  3028.             End If
  3029.  
  3030.             _Maximum = value
  3031.             If value < _Value Then _Value = value
  3032.             If value < _Minimum Then _Minimum = value
  3033.             Invalidate()
  3034.         End Set
  3035.     End Property
  3036.  
  3037.     Private _Value As Integer
  3038.     Property Value() As Integer
  3039.         Get
  3040.             Return _Value
  3041.         End Get
  3042.         Set(ByVal value As Integer)
  3043.             If value > _Maximum OrElse value < _Minimum Then
  3044.                 Throw New Exception("Property value is not valid.")
  3045.             End If
  3046.  
  3047.             _Value = value
  3048.             Invalidate()
  3049.         End Set
  3050.     End Property
  3051.  
  3052.     Private Sub Increment(ByVal amount As Integer)
  3053.         Value += amount
  3054.     End Sub
  3055.  
  3056.     Sub New()
  3057.         SetStyle(DirectCast(139286, ControlStyles), True)
  3058.         SetStyle(ControlStyles.Selectable, False)
  3059.  
  3060.  
  3061.         P2 = New Pen(Color.FromArgb(55, 55, 55))
  3062.         B1 = New SolidBrush(Color.FromArgb(0, 214, 37))
  3063.     End Sub
  3064.  
  3065.     Private GP1, GP2, GP3 As GraphicsPath
  3066.  
  3067.     Private R1, R2 As Rectangle
  3068.  
  3069.     Private P2 As Pen
  3070.     Private B1 As SolidBrush
  3071.     Private GB1, GB2 As LinearGradientBrush
  3072.  
  3073.     Private I1 As Integer
  3074.  
  3075.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  3076.         Dim G As Graphics = e.Graphics
  3077.         Dim R3 As New Rectangle
  3078.         Dim HB As HatchBrush
  3079.  
  3080.         G.Clear(Color.White)
  3081.         G.SmoothingMode = SmoothingMode.HighQuality
  3082.  
  3083.         GP1 = RoundRec(New Rectangle(0, 0, Width - 1, Height - 1), 4)
  3084.         GP2 = RoundRec(New Rectangle(1, 1, Width - 3, Height - 3), 4)
  3085.  
  3086.         R1 = New Rectangle(0, 2, Width - 1, Height - 1)
  3087.         GB1 = New LinearGradientBrush(R1, Color.FromArgb(255, 255, 255), Color.FromArgb(230, 230, 230), 90.0F)
  3088.  
  3089.  
  3090.  
  3091.  
  3092.  
  3093.         G.SetClip(GP1)
  3094.         'gloss
  3095.         Dim PB As New PathGradientBrush(GP1)
  3096.         PB.CenterColor = Color.FromArgb(230, 230, 230)
  3097.         PB.SurroundColors = {Color.FromArgb(255, 255, 255)}
  3098.         PB.CenterPoint = New Point(0, Height)
  3099.         PB.FocusScales = New PointF(1, 0)
  3100.  
  3101.         G.FillRectangle(PB, R1)
  3102.  
  3103.         G.FillPath(New SolidBrush(Color.FromArgb(250, 250, 250)), RoundRec(New Rectangle(1, 1, Width - 3, Height / 2 - 2), 4))
  3104.  
  3105.         I1 = CInt((_Value - _Minimum) / (_Maximum - _Minimum) * (Width - 3))
  3106.  
  3107.         If I1 > 1 Then
  3108.  
  3109.  
  3110.  
  3111.  
  3112.  
  3113.             GP3 = RoundRec(New Rectangle(1, 1, I1, Height - 3), 4)
  3114.  
  3115.             'grad
  3116.             HB = New HatchBrush(HatchStyle.Trellis, Color.FromArgb(50, Color.Black), Color.Transparent)
  3117.  
  3118.  
  3119.  
  3120.             'bar
  3121.             R2 = New Rectangle(1, 1, I1, Height - 3)
  3122.             GB2 = New LinearGradientBrush(R2, Color.FromArgb(20, 34, 45), Color.FromArgb(27, 84, 121), 90.0F)
  3123.  
  3124.             G.FillPath(GB2, GP3)
  3125.             G.DrawPath(New Pen(Color.FromArgb(120, 134, 145)), GP3)
  3126.  
  3127.             G.SetClip(GP3)
  3128.             G.SmoothingMode = SmoothingMode.None
  3129.  
  3130.  
  3131.  
  3132.             G.FillRectangle(New SolidBrush(Color.FromArgb(32, 100, 144)), R2.X, R2.Y + 1, R2.Width, R2.Height \ 2)
  3133.  
  3134.             R3 = New Rectangle(1, 1, I1, Height - 1)
  3135.  
  3136.             G.FillRectangle(HB, R3)
  3137.  
  3138.             G.SmoothingMode = SmoothingMode.AntiAlias
  3139.             G.ResetClip()
  3140.         End If
  3141.  
  3142.  
  3143.  
  3144.         G.DrawPath(New Pen(Color.FromArgb(125, 125, 125)), GP2)
  3145.         G.DrawPath(New Pen(Color.FromArgb(80, Color.LightGray)), GP1)
  3146.     End Sub
  3147.     Public Function RoundRec(ByVal Rectangle As Rectangle, ByVal Curve As Integer) As GraphicsPath
  3148.         Dim P As GraphicsPath = New GraphicsPath()
  3149.         Dim ArcRectangleWidth As Integer = Curve * 2
  3150.         P.AddArc(New Rectangle(Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -180, 90)
  3151.         P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -90, 90)
  3152.         P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 0, 90)
  3153.         P.AddArc(New Rectangle(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 90, 90)
  3154.         P.AddLine(New Point(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y), New Point(Rectangle.X, Curve + Rectangle.Y))
  3155.         Return P
  3156.     End Function
  3157.  
  3158. End Class
  3159. #End Region
  3160. #Region "SLCCheckbox"
  3161. <DefaultEvent("CheckedChanged")> _
  3162. Class SLCCheckbox
  3163.     Inherits Control
  3164.  
  3165.     Event CheckedChanged(ByVal sender As Object)
  3166.  
  3167.     Sub New()
  3168.         SetStyle(DirectCast(139286, ControlStyles), True)
  3169.         SetStyle(ControlStyles.Selectable, False)
  3170.  
  3171.         P11 = New Pen(Color.LightGray)
  3172.         P22 = New Pen(Color.FromArgb(35, 35, 35))
  3173.         P3 = New Pen(Color.Black, 2.0F)
  3174.         P4 = New Pen(Color.White, 2.0F)
  3175.     End Sub
  3176.  
  3177.     Private _Checked As Boolean
  3178.     Public Property Checked() As Boolean
  3179.         Get
  3180.             Return _Checked
  3181.         End Get
  3182.         Set(ByVal value As Boolean)
  3183.             _Checked = value
  3184.             RaiseEvent CheckedChanged(Me)
  3185.  
  3186.             Invalidate()
  3187.         End Set
  3188.     End Property
  3189.  
  3190.     Private GP1, GP2 As GraphicsPath
  3191.  
  3192.     Private SZ1 As SizeF
  3193.     Private PT1 As PointF
  3194.  
  3195.     Private P11, P22, P3, P4 As Pen
  3196.  
  3197.     Private PB1 As PathGradientBrush
  3198.  
  3199.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  3200.         Dim g As Graphics = e.Graphics
  3201.  
  3202.  
  3203.         g.Clear(Color.White)
  3204.         g.SmoothingMode = SmoothingMode.AntiAlias
  3205.  
  3206.         GP1 = RoundRec(New Rectangle(0, 2, Height - 5, Height - 5), 1)
  3207.         GP2 = RoundRec(New Rectangle(1, 3, Height - 7, Height - 7), 1)
  3208.  
  3209.         Dim GPF As New GraphicsPath
  3210.         GPF.AddPath(RoundRec(New Rectangle(Height - 18.5, Height - 20, 14, 14), 2), True)
  3211.         Dim PB3 As PathGradientBrush
  3212.         PB3 = New PathGradientBrush(GPF)
  3213.         '  PB3.CenterPoint = New Point(Height - 18.5, Height - 21)
  3214.         PB3.CenterColor = Color.FromArgb(240, 240, 240)
  3215.         PB3.SurroundColors = {Color.FromArgb(90, 90, 90)}
  3216.         PB3.FocusScales = New PointF(0.4F, 0.4F)
  3217.  
  3218.         Dim hb As New HatchBrush(HatchStyle.Trellis, Color.FromArgb(70, Color.FromArgb(15, 54, 80)), Color.Transparent)
  3219.  
  3220.         g.FillPath(PB3, GPF)
  3221.         g.FillPath(hb, GPF)
  3222.  
  3223.  
  3224.         g.DrawPath(New Pen(Color.FromArgb(49, 63, 86)), GPF)
  3225.         g.SetClip(GPF)
  3226.         g.FillEllipse(New SolidBrush(Color.FromArgb(70, Color.DarkGray)), New Rectangle(Height - 16, Height - 18, 6, 6))
  3227.         g.DrawPath(Pens.White, RoundRec(New Rectangle(5, 4, Height - 11, Height - 11), 2))
  3228.         g.ResetClip()
  3229.  
  3230.  
  3231.  
  3232.         If _Checked Then
  3233.  
  3234.             'g.DrawLine(Pens.Red, New PointF(7, Height - 10), New PointF(Height - 10, 5))
  3235.             g.DrawLine(New Pen(New SolidBrush(Color.FromArgb(1, 75, 124)), 2), New Point(8, Height - 9), New Point(Height - 8, 6))
  3236.  
  3237.  
  3238.             g.DrawLine(New Pen(New SolidBrush(Color.FromArgb(1, 75, 124)), 2), 7, Height - 13, 8, Height - 10)
  3239.  
  3240.  
  3241.         End If
  3242.  
  3243.         SZ1 = g.MeasureString(Text, Font)
  3244.         PT1 = New PointF(Height - 3, Height \ 2 - SZ1.Height / 2)
  3245.  
  3246.  
  3247.         g.DrawString(Text, Font, New SolidBrush(Color.FromArgb(1, 75, 124)), PT1)
  3248.     End Sub
  3249.  
  3250.     Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  3251.         Checked = Not Checked
  3252.     End Sub
  3253.  
  3254.     Public Function RoundRec(ByVal Rectangle As Rectangle, ByVal Curve As Integer) As GraphicsPath
  3255.         Dim P As GraphicsPath = New GraphicsPath()
  3256.         Dim ArcRectangleWidth As Integer = Curve * 2
  3257.         P.AddArc(New Rectangle(Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -180, 90)
  3258.         P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -90, 90)
  3259.         P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 0, 90)
  3260.         P.AddArc(New Rectangle(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 90, 90)
  3261.         P.AddLine(New Point(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y), New Point(Rectangle.X, Curve + Rectangle.Y))
  3262.         Return P
  3263.     End Function
  3264.  
  3265. End Class
  3266.  
  3267. #End Region
  3268. #Region "SLCListview"
  3269. Class SLCListView
  3270.     Inherits Control
  3271.  
  3272.     Class NSListViewItem
  3273.         Property Text As String
  3274.         <DesignerSerializationVisibility(DesignerSerializationVisibility.Content)> _
  3275.         Property SubItems As New List(Of NSListViewSubItem)
  3276.  
  3277.         Protected UniqueId As Guid
  3278.  
  3279.         Sub New()
  3280.             UniqueId = Guid.NewGuid()
  3281.         End Sub
  3282.  
  3283.         Public Overrides Function ToString() As String
  3284.             Return Text
  3285.         End Function
  3286.  
  3287.         Public Overrides Function Equals(ByVal obj As Object) As Boolean
  3288.             If TypeOf obj Is NSListViewItem Then
  3289.                 Return (DirectCast(obj, NSListViewItem).UniqueId = UniqueId)
  3290.             End If
  3291.  
  3292.             Return False
  3293.         End Function
  3294.  
  3295.  
  3296.     End Class
  3297.  
  3298.     Class NSListViewSubItem
  3299.         Property Text As String
  3300.  
  3301.         Public Overrides Function ToString() As String
  3302.             Return Text
  3303.         End Function
  3304.     End Class
  3305.  
  3306.     Class NSListViewColumnHeader
  3307.         Property Text As String
  3308.         Property Width As Integer = 60
  3309.  
  3310.         Public Overrides Function ToString() As String
  3311.             Return Text
  3312.         End Function
  3313.     End Class
  3314.  
  3315.     Private _Items As New List(Of NSListViewItem)
  3316.     <DesignerSerializationVisibility(DesignerSerializationVisibility.Content)> _
  3317.     Public Property Items() As NSListViewItem()
  3318.         Get
  3319.             Return _Items.ToArray()
  3320.         End Get
  3321.         Set(ByVal value As NSListViewItem())
  3322.             _Items = New List(Of NSListViewItem)(value)
  3323.             InvalidateScroll()
  3324.         End Set
  3325.     End Property
  3326.  
  3327.     Private _SelectedItems As New List(Of NSListViewItem)
  3328.     Public ReadOnly Property SelectedItems() As NSListViewItem()
  3329.         Get
  3330.             Return _SelectedItems.ToArray()
  3331.         End Get
  3332.     End Property
  3333.  
  3334.     Private _Columns As New List(Of NSListViewColumnHeader)
  3335.     <DesignerSerializationVisibility(DesignerSerializationVisibility.Content)> _
  3336.     Public Property Columns() As NSListViewColumnHeader()
  3337.         Get
  3338.             Return _Columns.ToArray()
  3339.         End Get
  3340.         Set(ByVal value As NSListViewColumnHeader())
  3341.             _Columns = New List(Of NSListViewColumnHeader)(value)
  3342.             InvalidateColumns()
  3343.         End Set
  3344.     End Property
  3345.  
  3346.     Private _MultiSelect As Boolean = True
  3347.     Public Property MultiSelect() As Boolean
  3348.         Get
  3349.             Return _MultiSelect
  3350.         End Get
  3351.         Set(ByVal value As Boolean)
  3352.             _MultiSelect = value
  3353.  
  3354.             If _SelectedItems.Count > 1 Then
  3355.                 _SelectedItems.RemoveRange(1, _SelectedItems.Count - 1)
  3356.             End If
  3357.  
  3358.             Invalidate()
  3359.         End Set
  3360.     End Property
  3361.  
  3362.     Private ItemHeight As Integer = 24
  3363.     Public Overrides Property Font As Font
  3364.         Get
  3365.             Return MyBase.Font
  3366.         End Get
  3367.         Set(ByVal value As Font)
  3368.             ItemHeight = CInt(Graphics.FromHwnd(Handle).MeasureString("@", Font).Height) + 6
  3369.  
  3370.             If VS IsNot Nothing Then
  3371.                 VS.SmallChange = ItemHeight
  3372.                 VS.LargeChange = ItemHeight
  3373.             End If
  3374.  
  3375.             MyBase.Font = value
  3376.             InvalidateLayout()
  3377.         End Set
  3378.     End Property
  3379.  
  3380. #Region " Item Helper Methods "
  3381.  
  3382.     'Ok, you've seen everything of importance at this point; I am begging you to spare yourself. You must not read any further!
  3383.  
  3384.     Public Sub AddItem(ByVal text As String, ByVal ParamArray subItems As String())
  3385.         Dim Items As New List(Of NSListViewSubItem)
  3386.         For Each I As String In subItems
  3387.             Dim SubItem As New NSListViewSubItem()
  3388.             SubItem.Text = I
  3389.             Items.Add(SubItem)
  3390.         Next
  3391.  
  3392.         Dim Item As New NSListViewItem()
  3393.         Item.Text = text
  3394.         Item.SubItems = Items
  3395.  
  3396.         _Items.Add(Item)
  3397.         InvalidateScroll()
  3398.     End Sub
  3399.  
  3400.     Public Sub RemoveItemAt(ByVal index As Integer)
  3401.         _Items.RemoveAt(index)
  3402.         InvalidateScroll()
  3403.     End Sub
  3404.  
  3405.     Public Sub RemoveItem(ByVal item As NSListViewItem)
  3406.         _Items.Remove(item)
  3407.         InvalidateScroll()
  3408.     End Sub
  3409.  
  3410.     Public Sub RemoveItems(ByVal items As NSListViewItem())
  3411.         For Each I As NSListViewItem In items
  3412.             _Items.Remove(I)
  3413.         Next
  3414.  
  3415.         InvalidateScroll()
  3416.     End Sub
  3417.  
  3418. #End Region
  3419.  
  3420.     Private VS As SLCScrollBar
  3421.  
  3422.     Sub New()
  3423.         SetStyle(DirectCast(139286, ControlStyles), True)
  3424.         SetStyle(ControlStyles.Selectable, True)
  3425.  
  3426.         P1 = New Pen(Color.FromArgb(55, 55, 55))
  3427.         P2 = New Pen(Color.FromArgb(35, 35, 35))
  3428.         P3 = New Pen(Color.FromArgb(65, 65, 65))
  3429.  
  3430.         B1 = New SolidBrush(Color.FromArgb(62, 62, 62))
  3431.         B2 = New SolidBrush(Color.FromArgb(65, 65, 65))
  3432.         B3 = New SolidBrush(Color.FromArgb(47, 47, 47))
  3433.         B4 = New SolidBrush(Color.FromArgb(50, 50, 50))
  3434.  
  3435.         VS = New SLCScrollBar
  3436.         VS.SmallChange = ItemHeight
  3437.         VS.LargeChange = ItemHeight
  3438.  
  3439.         AddHandler VS.Scroll, AddressOf HandleScroll
  3440.         AddHandler VS.MouseDown, AddressOf VS_MouseDown
  3441.         Controls.Add(VS)
  3442.  
  3443.         InvalidateLayout()
  3444.     End Sub
  3445.  
  3446.     Protected Overrides Sub OnSizeChanged(ByVal e As EventArgs)
  3447.         InvalidateLayout()
  3448.         MyBase.OnSizeChanged(e)
  3449.     End Sub
  3450.  
  3451.     Private Sub HandleScroll(ByVal sender As Object)
  3452.         Invalidate()
  3453.     End Sub
  3454.  
  3455.     Private Sub InvalidateScroll()
  3456.         VS.Maximum = (_Items.Count * ItemHeight)
  3457.         Invalidate()
  3458.     End Sub
  3459.  
  3460.     Private Sub InvalidateLayout()
  3461.         VS.Location = New Point(Width - VS.Width - 1, 1)
  3462.         VS.Size = New Size(18, Height - 2)
  3463.  
  3464.         Invalidate()
  3465.     End Sub
  3466.  
  3467.     Private ColumnOffsets As Integer()
  3468.     Private Sub InvalidateColumns()
  3469.         Dim Width As Integer = 3
  3470.         ColumnOffsets = New Integer(_Columns.Count - 1) {}
  3471.  
  3472.         For I As Integer = 0 To _Columns.Count - 1
  3473.             ColumnOffsets(I) = Width
  3474.             Width += Columns(I).Width
  3475.         Next
  3476.  
  3477.         Invalidate()
  3478.     End Sub
  3479.  
  3480.     Private Sub VS_MouseDown(ByVal sender As Object, ByVal e As MouseEventArgs)
  3481.         Focus()
  3482.     End Sub
  3483.  
  3484.     Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  3485.         Focus()
  3486.  
  3487.         If e.Button = Windows.Forms.MouseButtons.Left Then
  3488.             Dim Offset As Integer = CInt(VS.Percent * (VS.Maximum - (Height - (ItemHeight * 2))))
  3489.             Dim Index As Integer = ((e.Y + Offset - ItemHeight) \ ItemHeight)
  3490.  
  3491.             If Index > _Items.Count - 1 Then Index = -1
  3492.  
  3493.             If Not Index = -1 Then
  3494.                 'TODO: Handle Shift key
  3495.  
  3496.                 If ModifierKeys = Keys.Control AndAlso _MultiSelect Then
  3497.                     If _SelectedItems.Contains(_Items(Index)) Then
  3498.                         _SelectedItems.Remove(_Items(Index))
  3499.                     Else
  3500.                         _SelectedItems.Add(_Items(Index))
  3501.                     End If
  3502.                 Else
  3503.                     _SelectedItems.Clear()
  3504.                     _SelectedItems.Add(_Items(Index))
  3505.                 End If
  3506.             End If
  3507.  
  3508.             Invalidate()
  3509.         End If
  3510.  
  3511.         MyBase.OnMouseDown(e)
  3512.     End Sub
  3513.  
  3514.     Private P1, P2, P3 As Pen
  3515.     Private B1, B2, B3, B4 As SolidBrush
  3516.     Private GB1 As LinearGradientBrush
  3517.  
  3518.     'I am so sorry you have to witness this. I tried warning you. ;.;
  3519.  
  3520.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  3521.         Dim G As Graphics = e.Graphics
  3522.         G = e.Graphics
  3523.  
  3524.         G.Clear(Color.White)
  3525.  
  3526.         Dim X, Y As Integer
  3527.         Dim H As Single
  3528.  
  3529.         G.DrawRectangle(New Pen(New SolidBrush(Color.FromArgb(50, Color.LightGray))), 1, 1, Width - 3, Height - 3)
  3530.  
  3531.         Dim R1 As Rectangle
  3532.         Dim CI As NSListViewItem
  3533.  
  3534.         Dim Offset As Integer = CInt(VS.Percent * (VS.Maximum - (Height - (ItemHeight * 2))))
  3535.  
  3536.         Dim StartIndex As Integer
  3537.         If Offset = 0 Then StartIndex = 0 Else StartIndex = (Offset \ ItemHeight)
  3538.  
  3539.         Dim EndIndex As Integer = Math.Min(StartIndex + (Height \ ItemHeight), _Items.Count - 1)
  3540.  
  3541.         For I As Integer = StartIndex To EndIndex
  3542.             CI = Items(I)
  3543.  
  3544.             R1 = New Rectangle(0, ItemHeight + (I * ItemHeight) + 1 - Offset, Width, ItemHeight - 1)
  3545.  
  3546.             H = G.MeasureString(CI.Text, Font).Height
  3547.             Y = R1.Y + CInt((ItemHeight / 2) - (H / 2))
  3548.  
  3549.             If _SelectedItems.Contains(CI) Then
  3550.                 If I Mod 2 = 0 Then
  3551.                     G.FillRectangle(New SolidBrush(Color.FromArgb(40, Color.LightGray)), R1)
  3552.                 Else
  3553.                     G.FillRectangle(New SolidBrush(Color.FromArgb(40, Color.LightGray)), R1)
  3554.                 End If
  3555.             Else
  3556.                 If I Mod 2 = 0 Then
  3557.                     G.FillRectangle(Brushes.White, R1)
  3558.                 Else
  3559.                     G.FillRectangle(Brushes.White, R1)
  3560.                 End If
  3561.             End If
  3562.  
  3563.             G.DrawLine(Pens.LightGray, 0, R1.Bottom, Width, R1.Bottom)
  3564.  
  3565.             If Columns.Length > 0 Then
  3566.                 R1.Width = Columns(0).Width
  3567.                 G.SetClip(R1)
  3568.             End If
  3569.  
  3570.             'TODO: Ellipse text that overhangs seperators.
  3571.             G.DrawString(CI.Text, Font, New SolidBrush(Color.FromArgb(1, 75, 124)), 10, Y + 1)
  3572.  
  3573.  
  3574.             If CI.SubItems IsNot Nothing Then
  3575.                 For I2 As Integer = 0 To Math.Min(CI.SubItems.Count, _Columns.Count) - 1
  3576.                     X = ColumnOffsets(I2 + 1) + 4
  3577.  
  3578.                     R1.X = X
  3579.                     R1.Width = Columns(I2).Width
  3580.                     G.SetClip(R1)
  3581.  
  3582.                     G.DrawString(CI.SubItems(I2).Text, Font, New SolidBrush(Color.FromArgb(1, 75, 124)), X + 1, Y + 1)
  3583.  
  3584.                 Next
  3585.             End If
  3586.  
  3587.             G.ResetClip()
  3588.         Next
  3589.  
  3590.         R1 = New Rectangle(0, 0, Width, ItemHeight)
  3591.  
  3592.         GB1 = New LinearGradientBrush(R1, Color.FromArgb(255, 255, 255), Color.FromArgb(245, 245, 245), 90.0F)
  3593.         G.FillRectangle(GB1, R1)
  3594.         G.SetClip(R1)
  3595.         G.FillRectangle(Brushes.White, New Rectangle(0, 0, R1.Width - 1, R1.Height / 2 - 1))
  3596.         G.ResetClip()
  3597.         G.DrawRectangle(Pens.White, 1, 1, Width - 22, ItemHeight - 2)
  3598.  
  3599.         Dim LH As Integer = Math.Min(VS.Maximum + ItemHeight - Offset, Height)
  3600.  
  3601.         Dim CC As NSListViewColumnHeader
  3602.         For I As Integer = 0 To _Columns.Count - 1
  3603.             CC = Columns(I)
  3604.  
  3605.             H = G.MeasureString(CC.Text, Font).Height
  3606.             Y = CInt((ItemHeight / 2) - (H / 2))
  3607.             X = ColumnOffsets(I)
  3608.  
  3609.             G.DrawString(CC.Text, Font, New SolidBrush(Color.FromArgb(1, 75, 124)), X + 1, Y + 1)
  3610.  
  3611.  
  3612.             G.DrawLine(Pens.LightGray, X - 3, 0, X - 3, LH)
  3613.             G.DrawLine(Pens.White, X - 2, 0, X - 2, ItemHeight)
  3614.         Next
  3615.  
  3616.         G.DrawRectangle(Pens.LightGray, 0, 0, Width - 1, Height - 1)
  3617.  
  3618.         G.DrawLine(New Pen(New SolidBrush(Color.LightGray)), 0, ItemHeight, Width, ItemHeight)
  3619.         G.DrawLine(New Pen(Brushes.LightGray), VS.Location.X - 1, 0, VS.Location.X - 1, Height)
  3620.  
  3621.         G.FillRectangle(Brushes.White, Width - 19, 0, Width, Height)
  3622.     End Sub
  3623.  
  3624.     Protected Overrides Sub OnMouseWheel(ByVal e As MouseEventArgs)
  3625.         Dim Move As Integer = -((e.Delta * SystemInformation.MouseWheelScrollLines \ 120) * (ItemHeight \ 2))
  3626.  
  3627.         Dim Value As Integer = Math.Max(Math.Min(VS.Value + Move, VS.Maximum), VS.Minimum)
  3628.         VS.Value = Value
  3629.  
  3630.         MyBase.OnMouseWheel(e)
  3631.     End Sub
  3632.  
  3633. End Class
  3634.  
  3635. #End Region
  3636. #Region "SLCScrollBar"
  3637. <DefaultEvent("Scroll")> _
  3638. Class SLCScrollBar
  3639.     Inherits Control
  3640.  
  3641.     Event Scroll(ByVal sender As Object)
  3642.  
  3643.     Private _Minimum As Integer
  3644.     Property Minimum() As Integer
  3645.         Get
  3646.             Return _Minimum
  3647.         End Get
  3648.         Set(ByVal value As Integer)
  3649.             If value < 0 Then
  3650.                 Throw New Exception("Property value is not valid.")
  3651.             End If
  3652.  
  3653.             _Minimum = value
  3654.             If value > _Value Then _Value = value
  3655.             If value > _Maximum Then _Maximum = value
  3656.  
  3657.             InvalidateLayout()
  3658.         End Set
  3659.     End Property
  3660.  
  3661.     Private _Maximum As Integer = 100
  3662.     Property Maximum() As Integer
  3663.         Get
  3664.             Return _Maximum
  3665.         End Get
  3666.         Set(ByVal value As Integer)
  3667.             If value < 1 Then value = 1
  3668.  
  3669.             _Maximum = value
  3670.             If value < _Value Then _Value = value
  3671.             If value < _Minimum Then _Minimum = value
  3672.  
  3673.             InvalidateLayout()
  3674.         End Set
  3675.     End Property
  3676.  
  3677.     Private _Value As Integer
  3678.     Property Value() As Integer
  3679.         Get
  3680.             If Not ShowThumb Then Return _Minimum
  3681.             Return _Value
  3682.         End Get
  3683.         Set(ByVal value As Integer)
  3684.             If value = _Value Then Return
  3685.  
  3686.             If value > _Maximum OrElse value < _Minimum Then
  3687.                 Throw New Exception("Property value is not valid.")
  3688.             End If
  3689.  
  3690.             _Value = value
  3691.             InvalidatePosition()
  3692.  
  3693.             RaiseEvent Scroll(Me)
  3694.         End Set
  3695.     End Property
  3696.  
  3697.     Property _Percent As Double
  3698.     Public ReadOnly Property Percent As Double
  3699.         Get
  3700.             If Not ShowThumb Then Return 0
  3701.             Return GetProgress()
  3702.         End Get
  3703.     End Property
  3704.  
  3705.     Private _SmallChange As Integer = 1
  3706.     Public Property SmallChange() As Integer
  3707.         Get
  3708.             Return _SmallChange
  3709.         End Get
  3710.         Set(ByVal value As Integer)
  3711.             If value < 1 Then
  3712.                 Throw New Exception("Property value is not valid.")
  3713.             End If
  3714.  
  3715.             _SmallChange = value
  3716.         End Set
  3717.     End Property
  3718.  
  3719.     Private _LargeChange As Integer = 10
  3720.     Public Property LargeChange() As Integer
  3721.         Get
  3722.             Return _LargeChange
  3723.         End Get
  3724.         Set(ByVal value As Integer)
  3725.             If value < 1 Then
  3726.                 Throw New Exception("Property value is not valid.")
  3727.             End If
  3728.  
  3729.             _LargeChange = value
  3730.         End Set
  3731.     End Property
  3732.  
  3733.     Private ButtonSize As Integer = 16
  3734.     Private ThumbSize As Integer = 24 ' 14 minimum
  3735.  
  3736.     Private TSA As Rectangle
  3737.     Private BSA As Rectangle
  3738.     Private Shaft As Rectangle
  3739.     Private Thumb As Rectangle
  3740.  
  3741.     Private ShowThumb As Boolean
  3742.     Private ThumbDown As Boolean
  3743.  
  3744.     Sub New()
  3745.         SetStyle(DirectCast(139286, ControlStyles), True)
  3746.         SetStyle(ControlStyles.Selectable, False)
  3747.  
  3748.         Width = 18
  3749.  
  3750.  
  3751.     End Sub
  3752.  
  3753.     Private GP1, GP2, GP3, GP4 As GraphicsPath
  3754.  
  3755.  
  3756.  
  3757.     Dim I1 As Integer
  3758.  
  3759.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  3760.         Dim G As Graphics = e.Graphics
  3761.         G = e.Graphics
  3762.         G.Clear(Color.FromArgb(255, 255, 255))
  3763.  
  3764.         GP1 = DrawArrow(4, 6, False)
  3765.         GP2 = DrawArrow(5, 7, False)
  3766.  
  3767.         G.FillPath(New SolidBrush(Color.LightGray), GP2)
  3768.         G.FillPath(New SolidBrush(Color.FromArgb(83, 123, 168)), GP1)
  3769.  
  3770.         GP3 = DrawArrow(4, Height - 11, True)
  3771.         GP4 = DrawArrow(5, Height - 10, True)
  3772.  
  3773.         G.FillPath(New SolidBrush(Color.LightGray), GP4)
  3774.         G.FillPath(New SolidBrush(Color.FromArgb(83, 123, 168)), GP3)
  3775.  
  3776.         If ShowThumb Then
  3777.             G.FillRectangle(New SolidBrush(Color.FromArgb(250, 250, 250)), Thumb)
  3778.             G.DrawRectangle(Pens.LightGray, Thumb)
  3779.             G.DrawRectangle(Pens.White, Thumb.X + 1, Thumb.Y + 1, Thumb.Width - 2, Thumb.Height - 2)
  3780.  
  3781.             Dim Y As Integer
  3782.             Dim LY As Integer = Thumb.Y + (Thumb.Height \ 2) - 3
  3783.  
  3784.             For I As Integer = 0 To 2
  3785.                 Y = LY + (I * 3)
  3786.  
  3787.                 G.DrawLine(New Pen(New SolidBrush(Color.FromArgb(68, 95, 127))), Thumb.X + 5, Y, Thumb.Right - 5, Y)
  3788.                 G.DrawLine(New Pen(New SolidBrush(Color.FromArgb(50, Color.FromArgb(68, 95, 127)))), Thumb.X + 5, Y + 1, Thumb.Right - 5, Y + 1)
  3789.             Next
  3790.         End If
  3791.         G.SmoothingMode = SmoothingMode.HighQuality
  3792.         'G.DrawRectangle(New Pen(New SolidBrush(Color.Red)), 0, 0, Width - 1, Height - 1)
  3793.         G.DrawPath(New Pen(New SolidBrush(Color.FromArgb(59, 122, 165))), RoundRec(New Rectangle(1, 1, Width - 3, Height - 3), 4))
  3794.         G.SmoothingMode = SmoothingMode.None
  3795.     End Sub
  3796.  
  3797.     Private Function DrawArrow(ByVal x As Integer, ByVal y As Integer, ByVal flip As Boolean) As GraphicsPath
  3798.         Dim GP As New GraphicsPath()
  3799.  
  3800.         Dim W As Integer = 9
  3801.         Dim H As Integer = 5
  3802.  
  3803.         If flip Then
  3804.             GP.AddLine(x + 1, y, x + W + 1, y)
  3805.             GP.AddLine(x + W, y, x + H, y + H - 1)
  3806.         Else
  3807.             GP.AddLine(x, y + H, x + W, y + H)
  3808.             GP.AddLine(x + W, y + H, x + H, y)
  3809.         End If
  3810.  
  3811.         GP.CloseFigure()
  3812.         Return GP
  3813.     End Function
  3814.  
  3815.     Protected Overrides Sub OnSizeChanged(ByVal e As EventArgs)
  3816.         InvalidateLayout()
  3817.     End Sub
  3818.  
  3819.     Private Sub InvalidateLayout()
  3820.         TSA = New Rectangle(0, 0, Width, ButtonSize)
  3821.         BSA = New Rectangle(0, Height - ButtonSize, Width, ButtonSize)
  3822.         Shaft = New Rectangle(0, TSA.Bottom + 1, Width, Height - (ButtonSize * 2) - 1)
  3823.  
  3824.         ShowThumb = ((_Maximum - _Minimum) > Shaft.Height)
  3825.  
  3826.         If ShowThumb Then
  3827.             'ThumbSize = Math.Max(0, 14) 'TODO: Implement this.
  3828.             Thumb = New Rectangle(1, 0, Width - 3, ThumbSize)
  3829.         End If
  3830.  
  3831.         RaiseEvent Scroll(Me)
  3832.         InvalidatePosition()
  3833.     End Sub
  3834.  
  3835.     Private Sub InvalidatePosition()
  3836.         Thumb.Y = CInt(GetProgress() * (Shaft.Height - ThumbSize)) + TSA.Height
  3837.         Invalidate()
  3838.     End Sub
  3839.  
  3840.     Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  3841.         If e.Button = Windows.Forms.MouseButtons.Left AndAlso ShowThumb Then
  3842.             If TSA.Contains(e.Location) Then
  3843.                 I1 = _Value - _SmallChange
  3844.             ElseIf BSA.Contains(e.Location) Then
  3845.                 I1 = _Value + _SmallChange
  3846.             Else
  3847.                 If Thumb.Contains(e.Location) Then
  3848.                     ThumbDown = True
  3849.                     MyBase.OnMouseDown(e)
  3850.                     Return
  3851.                 Else
  3852.                     If e.Y < Thumb.Y Then
  3853.                         I1 = _Value - _LargeChange
  3854.                     Else
  3855.                         I1 = _Value + _LargeChange
  3856.                     End If
  3857.                 End If
  3858.             End If
  3859.  
  3860.             Value = Math.Min(Math.Max(I1, _Minimum), _Maximum)
  3861.             InvalidatePosition()
  3862.         End If
  3863.  
  3864.         MyBase.OnMouseDown(e)
  3865.     End Sub
  3866.  
  3867.     Protected Overrides Sub OnMouseMove(ByVal e As MouseEventArgs)
  3868.         If ThumbDown AndAlso ShowThumb Then
  3869.             Dim ThumbPosition As Integer = e.Y - TSA.Height - (ThumbSize \ 2)
  3870.             Dim ThumbBounds As Integer = Shaft.Height - ThumbSize
  3871.  
  3872.             I1 = CInt((ThumbPosition / ThumbBounds) * (_Maximum - _Minimum)) + _Minimum
  3873.  
  3874.             Value = Math.Min(Math.Max(I1, _Minimum), _Maximum)
  3875.             InvalidatePosition()
  3876.         End If
  3877.  
  3878.         MyBase.OnMouseMove(e)
  3879.     End Sub
  3880.  
  3881.     Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  3882.         ThumbDown = False
  3883.         MyBase.OnMouseUp(e)
  3884.     End Sub
  3885.  
  3886.     Private Function GetProgress() As Double
  3887.         Return (_Value - _Minimum) / (_Maximum - _Minimum)
  3888.     End Function
  3889.  
  3890.     Public Function RoundRec(ByVal Rectangle As Rectangle, ByVal Curve As Integer) As GraphicsPath
  3891.         Dim P As GraphicsPath = New GraphicsPath()
  3892.         Dim ArcRectangleWidth As Integer = Curve * 2
  3893.         P.AddArc(New Rectangle(Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -180, 90)
  3894.         P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -90, 90)
  3895.         P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 0, 90)
  3896.         P.AddArc(New Rectangle(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 90, 90)
  3897.         P.AddLine(New Point(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y), New Point(Rectangle.X, Curve + Rectangle.Y))
  3898.         Return P
  3899.     End Function
  3900. End Class
  3901. #End Region
  3902. #Region "SLCOnOffBox"
  3903. <DefaultEvent("CheckedChanged")> _
  3904. Class SLCOnOffBox
  3905.     Inherits Control
  3906.  
  3907.     Event CheckedChanged(ByVal sender As Object)
  3908.  
  3909.     Protected State As MouseState
  3910.  
  3911.  
  3912.     Sub New()
  3913.         SetStyle(DirectCast(139286, ControlStyles), True)
  3914.         SetStyle(ControlStyles.Selectable, False)
  3915.  
  3916.         P1 = New Pen(Color.FromArgb(55, 55, 55))
  3917.         P2 = New Pen(Color.FromArgb(35, 35, 35))
  3918.         P3 = New Pen(Color.FromArgb(65, 65, 65))
  3919.  
  3920.         B1 = New SolidBrush(Color.FromArgb(35, 35, 35))
  3921.         B2 = New SolidBrush(Color.FromArgb(85, 85, 85))
  3922.         B3 = New SolidBrush(Color.FromArgb(65, 65, 65))
  3923.         B4 = New SolidBrush(Color.FromArgb(205, 150, 0))
  3924.         B5 = New SolidBrush(Color.FromArgb(40, 40, 40))
  3925.  
  3926.         SF1 = New StringFormat()
  3927.         SF1.LineAlignment = StringAlignment.Center
  3928.         SF1.Alignment = StringAlignment.Near
  3929.  
  3930.         SF2 = New StringFormat()
  3931.         SF2.LineAlignment = StringAlignment.Center
  3932.         SF2.Alignment = StringAlignment.Far
  3933.  
  3934.         Size = New Size(56, 24)
  3935.         MinimumSize = Size
  3936.         MaximumSize = Size
  3937.     End Sub
  3938.  
  3939.     Private _Checked As Boolean
  3940.     Public Property Checked() As Boolean
  3941.         Get
  3942.             Return _Checked
  3943.         End Get
  3944.         Set(ByVal value As Boolean)
  3945.             _Checked = value
  3946.             RaiseEvent CheckedChanged(Me)
  3947.  
  3948.             Invalidate()
  3949.         End Set
  3950.     End Property
  3951.  
  3952.     Private GP1, GP2, GP3, GP4 As GraphicsPath
  3953.  
  3954.     Private P1, P2, P3 As Pen
  3955.     Private B1, B2, B3, B4, B5 As SolidBrush
  3956.  
  3957.     Private PB1 As PathGradientBrush
  3958.     Private GB1 As LinearGradientBrush
  3959.  
  3960.     Private R1, R2, R3 As Rectangle
  3961.     Private SF1, SF2 As StringFormat
  3962.  
  3963.     Private Offset As Integer
  3964.  
  3965.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  3966.  
  3967.         Dim G As Graphics = e.Graphics
  3968.  
  3969.         G.Clear(Color.White)
  3970.         G.SmoothingMode = SmoothingMode.AntiAlias
  3971.  
  3972.         GP1 = RoundRec(New Rectangle(0, 0, Width - 1, Height - 1), 7)
  3973.         GP2 = RoundRec(New Rectangle(1, 1, Width - 3, Height - 3), 7)
  3974.  
  3975.         PB1 = New PathGradientBrush(GP1)
  3976.         PB1.CenterColor = Color.FromArgb(250, 250, 250)
  3977.         PB1.SurroundColors = {Color.FromArgb(245, 245, 245)}
  3978.         PB1.FocusScales = New PointF(0.3F, 0.3F)
  3979.  
  3980.         G.FillPath(PB1, GP1)
  3981.         G.DrawPath(Pens.LightGray, GP1)
  3982.         G.DrawPath(Pens.White, GP2)
  3983.  
  3984.         R1 = New Rectangle(5, 0, Width - 10, Height + 2)
  3985.         R2 = New Rectangle(6, 1, Width - 10, Height + 2)
  3986.  
  3987.         R3 = New Rectangle(1, 1, (Width \ 2) - 1, Height - 3)
  3988.  
  3989.  
  3990.  
  3991.         If _Checked Then
  3992.             ' G.DrawString("On", Font, Brushes.Black, R2, SF1)
  3993.             G.DrawString("On", Font, New SolidBrush(Color.FromArgb(1, 75, 124)), R1, SF1)
  3994.  
  3995.             R3.X += (Width \ 2) - 1
  3996.         Else
  3997.             'G.DrawString("Off", Font, B1, R2, SF2)
  3998.             G.DrawString("Off", Font, New SolidBrush(Color.FromArgb(1, 75, 124)), R1, SF2)
  3999.         End If
  4000.  
  4001.         GP3 = RoundRec(R3, 7)
  4002.         GP4 = RoundRec(New Rectangle(R3.X + 1, R3.Y + 1, R3.Width - 2, R3.Height - 2), 7)
  4003.  
  4004.         GB1 = New LinearGradientBrush(ClientRectangle, Color.FromArgb(255, 255, 255), Color.FromArgb(245, 245, 245), 90.0F)
  4005.  
  4006.         G.FillPath(GB1, GP3)
  4007.         G.DrawPath(Pens.LightGray, GP3)
  4008.         G.DrawPath(Pens.White, GP4)
  4009.  
  4010.  
  4011.         Offset = R3.X + (R3.Width \ 2) - 3
  4012.  
  4013.         For I As Integer = 0 To 1
  4014.             If _Checked Then
  4015.                 'G.FillRectangle(Brushes.LightGray, Offset + (I * 5), 7, 2, Height - 14)
  4016.             Else
  4017.                 ' G.FillRectangle(Brushes.LightGray, Offset + (I * 5), 7, 2, Height - 14)
  4018.             End If
  4019.  
  4020.             G.SmoothingMode = SmoothingMode.None
  4021.  
  4022.             If _Checked Then
  4023.  
  4024.                 G.SmoothingMode = SmoothingMode.HighQuality
  4025.  
  4026.                 Dim GPF As New GraphicsPath
  4027.                 GPF.AddEllipse(New Rectangle(Width - 20, Height - 17, 10, 10))
  4028.                 Dim PB3 As PathGradientBrush
  4029.                 PB3 = New PathGradientBrush(GPF)
  4030.                 PB3.CenterPoint = New Point(Height - 18.5, Height - 20)
  4031.                 PB3.CenterColor = Color.FromArgb(53, 152, 74)
  4032.                 PB3.SurroundColors = {Color.FromArgb(86, 216, 114)}
  4033.                 PB3.FocusScales = New PointF(0.9F, 0.9F)
  4034.  
  4035.  
  4036.                 G.FillPath(PB3, GPF)
  4037.  
  4038.                 G.DrawPath(New Pen(Color.FromArgb(85, 200, 109)), GPF)
  4039.                 G.SetClip(GPF)
  4040.                 G.FillEllipse(New SolidBrush(Color.FromArgb(40, Color.WhiteSmoke)), New Rectangle(Width - 20, Height - 18, 6, 6))
  4041.                 G.ResetClip()
  4042.  
  4043.  
  4044.                 '  G.FillRectangle(New SolidBrush(Color.FromArgb(85, 158, 203)), Offset + (I * 5), 7, 2, Height - 14)
  4045.             Else
  4046.                 G.SmoothingMode = SmoothingMode.HighQuality
  4047.  
  4048.                 Dim GPF As New GraphicsPath
  4049.                 GPF.AddEllipse(New Rectangle(Height - 15, Height - 17, 10, 10))
  4050.                 Dim PB3 As PathGradientBrush
  4051.                 PB3 = New PathGradientBrush(GPF)
  4052.                 PB3.CenterPoint = New Point(Height - 18.5, Height - 20)
  4053.                 PB3.CenterColor = Color.FromArgb(185, 65, 65)
  4054.                 PB3.SurroundColors = {Color.Red}
  4055.                 PB3.FocusScales = New PointF(0.9F, 0.9F)
  4056.  
  4057.  
  4058.                 G.FillPath(PB3, GPF)
  4059.  
  4060.                 G.DrawPath(New Pen(Color.FromArgb(152, 53, 53)), GPF)
  4061.                 G.SetClip(GPF)
  4062.                 G.FillEllipse(New SolidBrush(Color.FromArgb(40, Color.WhiteSmoke)), New Rectangle(Height - 16, Height - 18, 6, 6))
  4063.                 G.ResetClip()
  4064.  
  4065.  
  4066.  
  4067.                 '  G.FillRectangle(Brushes.LightGray, Offset + (I * 5), 7, 2, Height - 14)
  4068.             End If
  4069.  
  4070.             G.SmoothingMode = SmoothingMode.AntiAlias
  4071.         Next
  4072.     End Sub
  4073.  
  4074.     Public Function RoundRec(ByVal Rectangle As Rectangle, ByVal Curve As Integer) As GraphicsPath
  4075.         Dim P As GraphicsPath = New GraphicsPath()
  4076.         Dim ArcRectangleWidth As Integer = Curve * 2
  4077.         P.AddArc(New Rectangle(Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -180, 90)
  4078.         P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -90, 90)
  4079.         P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 0, 90)
  4080.         P.AddArc(New Rectangle(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 90, 90)
  4081.         P.AddLine(New Point(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y), New Point(Rectangle.X, Curve + Rectangle.Y))
  4082.         Return P
  4083.     End Function
  4084.  
  4085.     Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  4086.         Checked = Not Checked
  4087.         MyBase.OnMouseDown(e)
  4088.     End Sub
  4089.  
  4090. End Class
  4091. #End Region
  4092. #Region "SLCGroupBox"
  4093. Class SLCGroupBox
  4094.     Inherits ContainerControl
  4095.  
  4096.     Private _DrawSeperator As Boolean
  4097.     Public Property DrawSeperator() As Boolean
  4098.         Get
  4099.             Return _DrawSeperator
  4100.         End Get
  4101.         Set(ByVal value As Boolean)
  4102.             _DrawSeperator = value
  4103.             Invalidate()
  4104.         End Set
  4105.     End Property
  4106.  
  4107.     Private _Title As String = "GroupBox"
  4108.     Public Property Title() As String
  4109.         Get
  4110.             Return _Title
  4111.         End Get
  4112.         Set(ByVal value As String)
  4113.             _Title = value
  4114.             Invalidate()
  4115.         End Set
  4116.     End Property
  4117.  
  4118.     Private _SubTitle As String = "Details"
  4119.     Public Property SubTitle() As String
  4120.         Get
  4121.             Return _SubTitle
  4122.         End Get
  4123.         Set(ByVal value As String)
  4124.             _SubTitle = value
  4125.             Invalidate()
  4126.         End Set
  4127.     End Property
  4128.  
  4129.     Private _TitleFont As Font
  4130.     Private _SubTitleFont As Font
  4131.  
  4132.     Sub New()
  4133.         SetStyle(DirectCast(139286, ControlStyles), True)
  4134.         SetStyle(ControlStyles.Selectable, False)
  4135.  
  4136.         _TitleFont = New Font("Verdana", 10.0F)
  4137.         _SubTitleFont = New Font("Verdana", 6.5F)
  4138.  
  4139.  
  4140.     End Sub
  4141.  
  4142.     Private GP1, GP2 As GraphicsPath
  4143.  
  4144.     Private PT1 As PointF
  4145.     Private SZ1, SZ2 As SizeF
  4146.  
  4147.  
  4148.  
  4149.  
  4150.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  4151.         Dim G As Graphics = e.Graphics
  4152.         G = e.Graphics
  4153.  
  4154.  
  4155.         G.Clear(Color.White)
  4156.         G.SmoothingMode = SmoothingMode.AntiAlias
  4157.  
  4158.         GP1 = RoundRec(New Rectangle(0, 0, Width - 1, Height - 1), 7)
  4159.         GP2 = RoundRec(New Rectangle(1, 1, Width - 3, Height - 3), 7)
  4160.  
  4161.  
  4162.         G.FillPath(New SolidBrush(Color.FromArgb(250, 250, 250)), GP2)
  4163.         G.SetClip(GP2)
  4164.         Dim PB As New PathGradientBrush(GP2)
  4165.         PB.CenterColor = Color.FromArgb(255, 255, 255)
  4166.         PB.SurroundColors = {Color.FromArgb(250, 250, 250)}
  4167.         PB.FocusScales = New PointF(0.95, 0.95)
  4168.         G.FillPath(PB, GP2)
  4169.         G.ResetClip()
  4170.  
  4171.         G.DrawPath(New Pen(New SolidBrush(Color.FromArgb(70, Color.LightGray))), GP1)
  4172.         G.DrawPath(Pens.Gray, GP2)
  4173.  
  4174.         SZ1 = G.MeasureString(_Title, _TitleFont, Width, StringFormat.GenericTypographic)
  4175.         SZ2 = G.MeasureString(_SubTitle, _SubTitleFont, Width, StringFormat.GenericTypographic)
  4176.  
  4177.  
  4178.         G.DrawString(_Title, _TitleFont, New SolidBrush(Color.FromArgb(1, 75, 124)), 5, 5)
  4179.  
  4180.         PT1 = New PointF(6.0F, SZ1.Height + 4.0F)
  4181.  
  4182.  
  4183.         G.DrawString(_SubTitle, _SubTitleFont, New SolidBrush(Color.Black), PT1.X, PT1.Y)
  4184.  
  4185.  
  4186.     End Sub
  4187.  
  4188.     Public Function RoundRec(ByVal Rectangle As Rectangle, ByVal Curve As Integer) As GraphicsPath
  4189.         Dim P As GraphicsPath = New GraphicsPath()
  4190.         Dim ArcRectangleWidth As Integer = Curve * 2
  4191.         P.AddArc(New Rectangle(Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -180, 90)
  4192.         P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -90, 90)
  4193.         P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 0, 90)
  4194.         P.AddArc(New Rectangle(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 90, 90)
  4195.         P.AddLine(New Point(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y), New Point(Rectangle.X, Curve + Rectangle.Y))
  4196.         Return P
  4197.     End Function
  4198.  
  4199. End Class
  4200. #End Region
  4201. #Region "SLCContextMenu"
  4202. Class SLCContextMenu
  4203.     Inherits ContextMenuStrip
  4204.  
  4205.     Sub New()
  4206.         Renderer = New ToolStripProfessionalRenderer(New SLCColorTable())
  4207.         ForeColor = Color.FromArgb(1, 75, 124)
  4208.     End Sub
  4209.  
  4210.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  4211.         Dim g As Graphics = e.Graphics
  4212.         g.Clear(Color.White)
  4213.         MyBase.OnPaint(e)
  4214.     End Sub
  4215.  
  4216. End Class
  4217.  
  4218. #End Region
  4219. #Region "SCLCT"
  4220.  
  4221. Class SLCColorTable
  4222.     Inherits ProfessionalColorTable
  4223.  
  4224.     Private BackColor As Color = Color.White
  4225.  
  4226.     Public Overrides ReadOnly Property ButtonSelectedBorder() As Color
  4227.         Get
  4228.             Return BackColor
  4229.         End Get
  4230.     End Property
  4231.  
  4232.     Public Overrides ReadOnly Property CheckBackground() As Color
  4233.         Get
  4234.             Return BackColor
  4235.         End Get
  4236.     End Property
  4237.  
  4238.     Public Overrides ReadOnly Property CheckPressedBackground() As Color
  4239.         Get
  4240.             Return BackColor
  4241.         End Get
  4242.     End Property
  4243.  
  4244.     Public Overrides ReadOnly Property CheckSelectedBackground() As Color
  4245.         Get
  4246.             Return BackColor
  4247.         End Get
  4248.     End Property
  4249.  
  4250.     Public Overrides ReadOnly Property ImageMarginGradientBegin() As Color
  4251.         Get
  4252.             Return BackColor
  4253.         End Get
  4254.     End Property
  4255.  
  4256.     Public Overrides ReadOnly Property ImageMarginGradientEnd() As Color
  4257.         Get
  4258.             Return BackColor
  4259.         End Get
  4260.     End Property
  4261.  
  4262.     Public Overrides ReadOnly Property ImageMarginGradientMiddle() As Color
  4263.         Get
  4264.             Return BackColor
  4265.         End Get
  4266.     End Property
  4267.  
  4268.     Public Overrides ReadOnly Property MenuBorder() As Color
  4269.         Get
  4270.             Return Color.FromArgb(1, 75, 124)
  4271.         End Get
  4272.     End Property
  4273.  
  4274.     Public Overrides ReadOnly Property MenuItemBorder() As Color
  4275.         Get
  4276.             Return BackColor
  4277.         End Get
  4278.     End Property
  4279.  
  4280.     Public Overrides ReadOnly Property MenuItemSelected() As Color
  4281.         Get
  4282.             Return Color.FromArgb(50, Color.LightGray)
  4283.         End Get
  4284.     End Property
  4285.  
  4286.     Public Overrides ReadOnly Property SeparatorDark() As Color
  4287.         Get
  4288.             Return Color.FromArgb(35, 35, 35)
  4289.         End Get
  4290.     End Property
  4291.  
  4292.     Public Overrides ReadOnly Property ToolStripDropDownBackground() As Color
  4293.         Get
  4294.             Return BackColor
  4295.         End Get
  4296.     End Property
  4297.  
  4298. End Class
  4299. #End Region
  4300. #Region "SLCLABEL"
  4301. Class SLCLabel
  4302.     Inherits Control
  4303.     Dim lb As New Windows.Forms.Label
  4304.     Sub New()
  4305.         SetStyle(DirectCast(139286, ControlStyles), True)
  4306.         SetStyle(ControlStyles.Selectable, False)
  4307.  
  4308.         Font = New Font("Verdana", 8.0F, FontStyle.Regular)
  4309.         Size = New Size(39, 13)
  4310.  
  4311.  
  4312.     End Sub
  4313.  
  4314.     Private _text As String = "SLCLabel"
  4315.     Public Overrides Property Text As String
  4316.         Get
  4317.             Return _text
  4318.         End Get
  4319.         Set(ByVal value As String)
  4320.             _text = value
  4321.             Invalidate()
  4322.         End Set
  4323.     End Property
  4324.  
  4325.  
  4326.     Private PT1 As PointF
  4327.     Private SZ1 As SizeF
  4328.  
  4329.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  4330.         Dim G As Graphics = e.Graphics
  4331.         G = e.Graphics
  4332.  
  4333.         G.Clear(Color.White)
  4334.  
  4335.  
  4336.         PT1 = New PointF(0, 0)
  4337.  
  4338.         G.DrawString(Text, Font, New SolidBrush(Color.FromArgb(1, 75, 124)), PT1)
  4339.  
  4340.     End Sub
  4341.  
  4342. End Class
  4343. #End Region
  4344. #Region "SLCClose"
  4345. Class SLCClose
  4346.     Inherits ThemeControl154
  4347.     Dim LB As New Label
  4348.     Protected Overrides Sub ColorHook()
  4349.  
  4350.     End Sub
  4351.  
  4352.     Sub New()
  4353.         SetStyle(ControlStyles.SupportsTransparentBackColor, True)
  4354.         Size = New Size(20, 20)
  4355.  
  4356.  
  4357.     End Sub
  4358.  
  4359.     Protected Overrides Sub PaintHook()
  4360.         G.SmoothingMode = SmoothingMode.HighQuality
  4361.         G.Clear(Color.White)
  4362.         G.FillRectangle(New SolidBrush(Color.FromArgb(239, 239, 239)), New Rectangle(-1, -1, Width + 1, Height + 1))
  4363.  
  4364.  
  4365.  
  4366.         Select Case State
  4367.             Case MouseState.None
  4368.  
  4369.  
  4370.                 '// circle
  4371.  
  4372.                 G.SmoothingMode = SmoothingMode.HighQuality
  4373.  
  4374.                 Dim GPF As New GraphicsPath
  4375.                 GPF.AddEllipse(New Rectangle(Width - 20, Height - 19, 15, 15))
  4376.                 Dim PB3 As PathGradientBrush
  4377.                 PB3 = New PathGradientBrush(GPF)
  4378.                 PB3.CenterPoint = New Point(Height - 18.5, Height - 20)
  4379.                 PB3.CenterColor = Color.FromArgb(193, 26, 26)
  4380.                 PB3.SurroundColors = {Color.FromArgb(229, 110, 110)}
  4381.                 PB3.FocusScales = New PointF(0.6F, 0.6F)
  4382.  
  4383.  
  4384.                 G.FillPath(PB3, GPF)
  4385.  
  4386.                 G.DrawPath(New Pen(Color.FromArgb(159, 41, 41)), GPF)
  4387.                 G.SetClip(GPF)
  4388.                 G.FillEllipse(New SolidBrush(Color.FromArgb(40, Color.WhiteSmoke)), New Rectangle(Width - 20, Height - 18, 6, 6))
  4389.                 G.ResetClip()
  4390.             Case MouseState.Down
  4391.                 '// circle
  4392.  
  4393.                 G.SmoothingMode = SmoothingMode.HighQuality
  4394.  
  4395.                 Dim GPF As New GraphicsPath
  4396.                 GPF.AddEllipse(New Rectangle(Width - 20, Height - 19, 15, 15))
  4397.                 Dim PB3 As PathGradientBrush
  4398.                 PB3 = New PathGradientBrush(GPF)
  4399.                 PB3.CenterPoint = New Point(Height - 18.5, Height - 20)
  4400.                 PB3.CenterColor = Color.FromArgb(221, 32, 32)
  4401.                 PB3.SurroundColors = {Color.FromArgb(229, 110, 110)}
  4402.                 PB3.FocusScales = New PointF(0.6F, 0.6F)
  4403.  
  4404.  
  4405.                 G.FillPath(PB3, GPF)
  4406.  
  4407.                 G.DrawPath(New Pen(Color.White), GPF)
  4408.                 G.SetClip(GPF)
  4409.                 G.FillEllipse(New SolidBrush(Color.FromArgb(40, Color.WhiteSmoke)), New Rectangle(Width - 20, Height - 18, 6, 6))
  4410.                 G.ResetClip()
  4411.             Case MouseState.Over
  4412.                 '// circle
  4413.  
  4414.                 G.SmoothingMode = SmoothingMode.HighQuality
  4415.  
  4416.                 Dim GPF As New GraphicsPath
  4417.                 GPF.AddEllipse(New Rectangle(Width - 20, Height - 19, 15, 15))
  4418.                 Dim PB3 As PathGradientBrush
  4419.                 PB3 = New PathGradientBrush(GPF)
  4420.                 PB3.CenterPoint = New Point(Height - 18.5, Height - 20)
  4421.                 PB3.CenterColor = Color.FromArgb(221, 32, 32)
  4422.                 PB3.SurroundColors = {Color.FromArgb(229, 110, 110)}
  4423.                 PB3.FocusScales = New PointF(0.6F, 0.6F)
  4424.  
  4425.  
  4426.                 G.FillPath(PB3, GPF)
  4427.  
  4428.                 G.DrawPath(New Pen(Color.FromArgb(159, 41, 41)), GPF)
  4429.                 G.SetClip(GPF)
  4430.                 G.FillEllipse(New SolidBrush(Color.FromArgb(40, Color.WhiteSmoke)), New Rectangle(Width - 20, Height - 18, 6, 6))
  4431.                 G.ResetClip()
  4432.         End Select
  4433.  
  4434.     End Sub
  4435. End Class
  4436. #End Region
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement