THE_LORD

Acacia Theme

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