Advertisement
XertzHF

Facebook GDI Theme

Dec 14th, 2013
1,562
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 69.54 KB | None | 0 0
  1. Imports System.Drawing.Text
  2. Imports System.Drawing.Drawing2D
  3. Imports System.ComponentModel
  4. Imports System.Drawing.Design
  5.  
  6. ''' <summary>
  7. ''' Facebook GDI Theme
  8. ''' Creator: Xertz (HF)
  9. ''' Version: 1.1
  10. ''' Date Created: 15/12/2013
  11. ''' Date Changed: 15/12/2013
  12. ''' UID: 1602992
  13. ''' For any bugs / errors, PM me.
  14. ''' </summary>
  15. ''' <remarks></remarks>
  16.  
  17. Module DrawHelpers
  18.  
  19. #Region "Functions"
  20.  
  21.     Dim Height As Integer
  22.     Dim Width As Integer
  23.  
  24.     Public Function RoundRec(ByVal Rectangle As Rectangle, ByVal Curve As Integer) As GraphicsPath
  25.         Dim P As GraphicsPath = New GraphicsPath()
  26.         Dim ArcRectangleWidth As Integer = Curve * 2
  27.         P.AddArc(New Rectangle(Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -180, 90)
  28.         P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -90, 90)
  29.         P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 0, 90)
  30.         P.AddArc(New Rectangle(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 90, 90)
  31.         P.AddLine(New Point(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y), New Point(Rectangle.X, Curve + Rectangle.Y))
  32.         Return P
  33.     End Function
  34.  
  35.     Public Function RoundRect(x!, y!, w!, h!, Optional r! = 0.3, Optional TL As Boolean = True, Optional TR As Boolean = True, Optional BR As Boolean = True, Optional BL As Boolean = True) As GraphicsPath
  36.         Dim d! = Math.Min(w, h) * r, xw = x + w, yh = y + h
  37.         RoundRect = New GraphicsPath
  38.  
  39.         With RoundRect
  40.             If TL Then .AddArc(x, y, d, d, 180, 90) Else .AddLine(x, y, x, y)
  41.             If TR Then .AddArc(xw - d, y, d, d, 270, 90) Else .AddLine(xw, y, xw, y)
  42.             If BR Then .AddArc(xw - d, yh - d, d, d, 0, 90) Else .AddLine(xw, yh, xw, yh)
  43.             If BL Then .AddArc(x, yh - d, d, d, 90, 90) Else .AddLine(x, yh, x, yh)
  44.  
  45.             .CloseFigure()
  46.         End With
  47.     End Function
  48.  
  49.     Enum MouseState As Byte
  50.         None = 0
  51.         Over = 1
  52.         Down = 2
  53.         Block = 3
  54.     End Enum
  55.  
  56. #End Region
  57.  
  58. End Module
  59.  
  60. Public Class FacebookThemeContainer
  61.     Inherits ContainerControl
  62.  
  63. #Region "Declarations"
  64.     Private _MainColour As Color = Color.FromArgb(252, 252, 252)
  65.     Private _HeaderColour As Color = Color.FromArgb(67, 96, 156)
  66.     Private _BorderColour As Color = Color.DarkGray
  67.     Private _MainBrushColour As New SolidBrush(_MainColour)
  68.     Private _HeaderBrushColour As New SolidBrush(_HeaderColour)
  69.     Private F As New Font("Tahoma", 13, FontStyle.Bold)
  70.     Private Cap As Boolean = False
  71.     Private MoveHeight As Integer = 45
  72.     Private MouseP As Point = New Point(0, 0)
  73. #End Region
  74.  
  75. #Region "Mouse States"
  76.     Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  77.         MyBase.OnMouseDown(e)
  78.         If e.Button = Windows.Forms.MouseButtons.Left And New Rectangle(0, 0, Width, MoveHeight).Contains(e.Location) Then
  79.             Cap = True : MouseP = e.Location
  80.         End If
  81.     End Sub
  82.     Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
  83.         MyBase.OnMouseUp(e) : Cap = False
  84.     End Sub
  85.     Protected Overrides Sub OnMouseMove(ByVal e As System.Windows.Forms.MouseEventArgs)
  86.         MyBase.OnMouseMove(e)
  87.         If Cap Then
  88.             Parent.Location = MousePosition - MouseP
  89.         End If
  90.     End Sub
  91. #End Region
  92.  
  93. #Region "Colour Properties"
  94.     <Category("Colours")>
  95.     Public Property BaseColour As Color
  96.         Get
  97.             Return _MainColour
  98.         End Get
  99.         Set(value As Color)
  100.             _MainColour = value
  101.         End Set
  102.     End Property
  103.  
  104.     <Category("Colours")>
  105.     Public Property HeaderColour As Color
  106.         Get
  107.             Return _HeaderColour
  108.         End Get
  109.         Set(value As Color)
  110.             _HeaderColour = value
  111.         End Set
  112.     End Property
  113.  
  114.     <Category("Colours")>
  115.     Public Property BorderColour As Color
  116.         Get
  117.             Return _BorderColour
  118.         End Get
  119.         Set(value As Color)
  120.             _BorderColour = value
  121.         End Set
  122.     End Property
  123.  
  124. #End Region
  125.  
  126. #Region "Draw Control"
  127.     Sub New()
  128.  
  129.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or _
  130.                 ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer, True)
  131.  
  132.         Me.DoubleBuffered = True
  133.         Me.BackColor = _MainColour
  134.         Me.Dock = DockStyle.Fill
  135.     End Sub
  136.  
  137.     Protected Overrides Sub OnCreateControl()
  138.         MyBase.OnCreateControl()
  139.         ParentForm.FormBorderStyle = FormBorderStyle.None
  140.         ParentForm.AllowTransparency = False
  141.         ParentForm.TransparencyKey = Color.Fuchsia
  142.         ParentForm.FindForm.StartPosition = FormStartPosition.CenterScreen
  143.         Dock = DockStyle.Fill
  144.         Invalidate()
  145.     End Sub
  146.  
  147.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  148.         Dim G As Graphics
  149.         G = e.Graphics
  150.         G.SmoothingMode = SmoothingMode.HighQuality
  151.         G.FillRectangle(_HeaderBrushColour, New Rectangle(-1, -1, Me.Width + 1, 45))
  152.         G.DrawLine(New Pen(New SolidBrush(_BorderColour)), New Point(-1, 45), New Point(Me.Width - 1, 45))
  153.         G.DrawRectangle(New Pen(New SolidBrush(_BorderColour)), New Rectangle(0, 0, Width - 1, Height - 1))
  154.         Dim I As Bitmap = Me.ParentForm.Icon.ToBitmap
  155.         Dim IM As Image = I
  156.         Dim FormText As String = Me.ParentForm.Text
  157.         G.TextRenderingHint = TextRenderingHint.AntiAlias
  158.         G.DrawString(FormText, F, New SolidBrush(Color.FromArgb(220, 220, 220)), New Point(43, 11))
  159.         G.DrawImage(IM, New Rectangle(8, 6, 32, 32))
  160.         MyBase.OnPaint(e)
  161.         I.Dispose()
  162.         IM.Dispose()
  163.     End Sub
  164. #End Region
  165.  
  166. End Class
  167.  
  168. Public Class FacebookButton
  169.     Inherits Control
  170.  
  171. #Region "Declarations"
  172.     Private State As MouseState = MouseState.None
  173.     Private _MainColour As Color = Color.FromArgb(70, 98, 158)
  174.     Private _TextColour As Color = Color.FromArgb(255, 255, 255)
  175.     Private _HoverColour As Color = Color.FromArgb(55, 83, 158)
  176. #End Region
  177.  
  178. #Region "Mouse States"
  179.  
  180.     Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
  181.         MyBase.OnMouseDown(e)
  182.         State = MouseState.Down : Invalidate()
  183.     End Sub
  184.     Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
  185.         MyBase.OnMouseUp(e)
  186.         State = MouseState.Over : Invalidate()
  187.     End Sub
  188.     Protected Overrides Sub OnMouseEnter(e As EventArgs)
  189.         MyBase.OnMouseEnter(e)
  190.         State = MouseState.Over : Invalidate()
  191.     End Sub
  192.     Protected Overrides Sub OnMouseLeave(e As EventArgs)
  193.         MyBase.OnMouseLeave(e)
  194.         State = MouseState.None : Invalidate()
  195.     End Sub
  196.  
  197. #End Region
  198.  
  199. #Region "Colour Properties"
  200.  
  201.     <Category("Colours"), Description("Background Colour Selection")> _
  202.     Public Property BackgroundColour As Color
  203.         Get
  204.             Return _MainColour
  205.         End Get
  206.         Set(value As Color)
  207.             _MainColour = value
  208.         End Set
  209.     End Property
  210.  
  211.     <Category("Colours"), Description("Text Colour Selection")> _
  212.     Public Property TextColour As Color
  213.         Get
  214.             Return _TextColour
  215.         End Get
  216.         Set(value As Color)
  217.             _TextColour = value
  218.         End Set
  219.     End Property
  220.  
  221. #End Region
  222.  
  223. #Region "Draw Control"
  224.  
  225.     Sub New()
  226.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or _
  227.                 ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer Or _
  228.                 ControlStyles.SupportsTransparentBackColor, True)
  229.         DoubleBuffered = True
  230.         Size = New Size(135, 32)
  231.         BackColor = Color.Transparent
  232.         Font = New Font("Klavika", 9)
  233.     End Sub
  234.  
  235.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  236.         Dim B As New Bitmap(Width, Height)
  237.         Dim G = Graphics.FromImage(B)
  238.         Dim GP, GP1 As New GraphicsPath
  239.         Dim Base As New Rectangle(0, 0, Width - 1, Height - 1)
  240.         With G
  241.             .TextRenderingHint = TextRenderingHint.ClearTypeGridFit
  242.             .SmoothingMode = SmoothingMode.HighQuality
  243.             .PixelOffsetMode = PixelOffsetMode.HighQuality
  244.             .Clear(BackColor)
  245.             Select Case State
  246.                 Case MouseState.None
  247.                     GP = DrawHelpers.RoundRec(Base, 2)
  248.                     .FillPath(New SolidBrush(_MainColour), GP)
  249.                     .DrawString(Text, Font, New SolidBrush(_TextColour), Base, New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
  250.                 Case MouseState.Over
  251.                     GP = DrawHelpers.RoundRec(Base, 2)
  252.                     .FillPath(New SolidBrush(_HoverColour), GP)
  253.                     .DrawString(Text, Font, New SolidBrush(_TextColour), Base, New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
  254.                 Case MouseState.Down
  255.                     GP = DrawHelpers.RoundRec(Base, 2)
  256.                     .FillPath(New SolidBrush(_HoverColour), GP)
  257.                     .DrawString(Text, Font, New SolidBrush(_TextColour), Base, New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
  258.                     GP1 = DrawHelpers.RoundRec(New Rectangle(0, 0, Width, Height), 3)
  259.                     .DrawPath(New Pen(New SolidBrush(Color.LightYellow), 2), GP1)
  260.             End Select
  261.         End With
  262.         MyBase.OnPaint(e)
  263.         e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic
  264.         e.Graphics.DrawImageUnscaled(B, 0, 0)
  265.         B.Dispose()
  266.     End Sub
  267.  
  268. #End Region
  269.  
  270. End Class
  271.  
  272. <DefaultEvent("TextChanged")>
  273. Public Class FacebookTextBox
  274.     Inherits Control
  275.  
  276. #Region "Declarations"
  277.     Private State As MouseState = MouseState.None
  278.     Private WithEvents TB As Windows.Forms.TextBox
  279.     Private _BaseColour As Color = Color.FromArgb(255, 255, 255)
  280.     Private _TextColour As Color = Color.FromArgb(50, 50, 50)
  281.     Private _BorderColour As Color = Color.FromArgb(180, 187, 205)
  282. #End Region
  283.  
  284. #Region "TextBox Properties"
  285.  
  286.     Private _TextAlign As HorizontalAlignment = HorizontalAlignment.Left
  287.     <Category("Options")>
  288.     Property TextAlign() As HorizontalAlignment
  289.         Get
  290.             Return _TextAlign
  291.         End Get
  292.         Set(ByVal value As HorizontalAlignment)
  293.             _TextAlign = value
  294.             If TB IsNot Nothing Then
  295.                 TB.TextAlign = value
  296.             End If
  297.         End Set
  298.     End Property
  299.     Private _MaxLength As Integer = 32767
  300.     <Category("Options")>
  301.     Property MaxLength() As Integer
  302.         Get
  303.             Return _MaxLength
  304.         End Get
  305.         Set(ByVal value As Integer)
  306.             _MaxLength = value
  307.             If TB IsNot Nothing Then
  308.                 TB.MaxLength = value
  309.             End If
  310.         End Set
  311.     End Property
  312.     Private _ReadOnly As Boolean
  313.     <Category("Options")>
  314.     Property [ReadOnly]() As Boolean
  315.         Get
  316.             Return _ReadOnly
  317.         End Get
  318.         Set(ByVal value As Boolean)
  319.             _ReadOnly = value
  320.             If TB IsNot Nothing Then
  321.                 TB.ReadOnly = value
  322.             End If
  323.         End Set
  324.     End Property
  325.     Private _UseSystemPasswordChar As Boolean
  326.     <Category("Options")>
  327.     Property UseSystemPasswordChar() As Boolean
  328.         Get
  329.             Return _UseSystemPasswordChar
  330.         End Get
  331.         Set(ByVal value As Boolean)
  332.             _UseSystemPasswordChar = value
  333.             If TB IsNot Nothing Then
  334.                 TB.UseSystemPasswordChar = value
  335.             End If
  336.         End Set
  337.     End Property
  338.     Private _Multiline As Boolean
  339.     <Category("Options")>
  340.     Property Multiline() As Boolean
  341.         Get
  342.             Return _Multiline
  343.         End Get
  344.         Set(ByVal value As Boolean)
  345.             _Multiline = value
  346.             If TB IsNot Nothing Then
  347.                 TB.Multiline = value
  348.  
  349.                 If value Then
  350.                     TB.Height = Height - 11
  351.                 Else
  352.                     Height = TB.Height + 11
  353.                 End If
  354.  
  355.             End If
  356.         End Set
  357.     End Property
  358.     <Category("Options")>
  359.     Overrides Property Text As String
  360.         Get
  361.             Return MyBase.Text
  362.         End Get
  363.         Set(ByVal value As String)
  364.             MyBase.Text = value
  365.             If TB IsNot Nothing Then
  366.                 TB.Text = value
  367.             End If
  368.         End Set
  369.     End Property
  370.     <Category("Options")>
  371.     Overrides Property Font As Font
  372.         Get
  373.             Return MyBase.Font
  374.         End Get
  375.         Set(ByVal value As Font)
  376.             MyBase.Font = value
  377.             If TB IsNot Nothing Then
  378.                 TB.Font = value
  379.                 TB.Location = New Point(3, 5)
  380.                 TB.Width = Width - 6
  381.  
  382.                 If Not _Multiline Then
  383.                     Height = TB.Height + 11
  384.                 End If
  385.             End If
  386.         End Set
  387.     End Property
  388.  
  389.     Protected Overrides Sub OnCreateControl()
  390.         MyBase.OnCreateControl()
  391.         If Not Controls.Contains(TB) Then
  392.             Controls.Add(TB)
  393.         End If
  394.     End Sub
  395.     Private Sub OnBaseTextChanged(ByVal s As Object, ByVal e As EventArgs)
  396.         Text = TB.Text
  397.     End Sub
  398.     Private Sub OnBaseKeyDown(ByVal s As Object, ByVal e As KeyEventArgs)
  399.         If e.Control AndAlso e.KeyCode = Keys.A Then
  400.             TB.SelectAll()
  401.             e.SuppressKeyPress = True
  402.         End If
  403.         If e.Control AndAlso e.KeyCode = Keys.C Then
  404.             TB.Copy()
  405.             e.SuppressKeyPress = True
  406.         End If
  407.     End Sub
  408.     Protected Overrides Sub OnResize(ByVal e As EventArgs)
  409.         TB.Location = New Point(5, 5)
  410.         TB.Width = Width - 10
  411.  
  412.         If _Multiline Then
  413.             TB.Height = Height - 11
  414.         Else
  415.             Height = TB.Height + 11
  416.         End If
  417.  
  418.         MyBase.OnResize(e)
  419.     End Sub
  420.  
  421. #End Region
  422.  
  423. #Region "Colour Properties"
  424.  
  425.     <Category("Colours")>
  426.     Public Property BackgroundColour As Color
  427.         Get
  428.             Return _BaseColour
  429.         End Get
  430.         Set(value As Color)
  431.             _BaseColour = value
  432.         End Set
  433.     End Property
  434.  
  435.     <Category("Colours")>
  436.     Public Property TextColour As Color
  437.         Get
  438.             Return _TextColour
  439.         End Get
  440.         Set(value As Color)
  441.             _TextColour = value
  442.         End Set
  443.     End Property
  444.  
  445.     <Category("Colours")>
  446.     Public Property BorderColour As Color
  447.         Get
  448.             Return _BorderColour
  449.         End Get
  450.         Set(value As Color)
  451.             _BorderColour = value
  452.         End Set
  453.     End Property
  454.  
  455. #End Region
  456.  
  457. #Region "Mouse States"
  458.  
  459.     Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
  460.         MyBase.OnMouseDown(e)
  461.         State = MouseState.Down : Invalidate()
  462.     End Sub
  463.     Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
  464.         MyBase.OnMouseUp(e)
  465.         State = MouseState.Over : TB.Focus() : Invalidate()
  466.     End Sub
  467.     Protected Overrides Sub OnMouseLeave(e As EventArgs)
  468.         MyBase.OnMouseLeave(e)
  469.         State = MouseState.None : Invalidate()
  470.     End Sub
  471.  
  472. #End Region
  473.  
  474. #Region "Draw Control"
  475.     Sub New()
  476.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or _
  477.                  ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer Or _
  478.                  ControlStyles.SupportsTransparentBackColor, True)
  479.         DoubleBuffered = True
  480.         BackColor = Color.Transparent
  481.         TB = New Windows.Forms.TextBox
  482.         TB.Font = New Font("Segoe UI", 10)
  483.         TB.Text = Text
  484.         TB.BackColor = _BaseColour
  485.         TB.ForeColor = _TextColour
  486.         TB.MaxLength = _MaxLength
  487.         TB.Multiline = _Multiline
  488.         TB.ReadOnly = _ReadOnly
  489.         TB.UseSystemPasswordChar = _UseSystemPasswordChar
  490.         TB.BorderStyle = BorderStyle.None
  491.         TB.Location = New Point(5, 5)
  492.         TB.Width = Width - 10
  493.         If _Multiline Then
  494.             TB.Height = Height - 11
  495.         Else
  496.             Height = TB.Height + 11
  497.         End If
  498.         AddHandler TB.TextChanged, AddressOf OnBaseTextChanged
  499.         AddHandler TB.KeyDown, AddressOf OnBaseKeyDown
  500.     End Sub
  501.  
  502.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  503.         Dim B As New Bitmap(Width, Height)
  504.         Dim G = Graphics.FromImage(B)
  505.         Dim Base As New Rectangle(0, 0, Width - 1, Height - 1)
  506.         With G
  507.             .TextRenderingHint = TextRenderingHint.ClearTypeGridFit
  508.             .SmoothingMode = SmoothingMode.HighQuality
  509.             .PixelOffsetMode = PixelOffsetMode.HighQuality
  510.             .Clear(BackColor)
  511.             TB.BackColor = _BaseColour
  512.             TB.ForeColor = _TextColour
  513.             .FillRectangle(New SolidBrush(_BaseColour), Base)
  514.             .DrawRectangle(New Pen(New SolidBrush(_BorderColour)), New Rectangle(0, 0, Width, Height))
  515.         End With
  516.         MyBase.OnPaint(e)
  517.         G.Dispose()
  518.         e.Graphics.InterpolationMode = 7
  519.         e.Graphics.DrawImageUnscaled(B, 0, 0)
  520.         B.Dispose()
  521.     End Sub
  522. #End Region
  523.  
  524. End Class
  525.  
  526. Public Class FacebookGroupBox
  527.     Inherits ContainerControl
  528.  
  529. #Region "Declarations"
  530.     Private _MainColour As Color = Color.FromArgb(237, 239, 244)
  531.     Private _HeaderColour As Color = Color.FromArgb(109, 132, 180)
  532.     Private _TextColour As Color = Color.FromArgb(255, 255, 255)
  533.     Private _CircleColour As Color = Color.FromArgb(93, 170, 64)
  534.     Private _BorderColour As Color = Color.FromArgb(14, 44, 109)
  535.     Private _DrawCircle As Boolean = True
  536. #End Region
  537.  
  538. #Region "Colour & Other Properties"
  539.     <Category("Colours")>
  540.     Public Property MainColour As Color
  541.         Get
  542.             Return _MainColour
  543.         End Get
  544.         Set(value As Color)
  545.             _MainColour = value
  546.         End Set
  547.     End Property
  548.     <Category("Colours")>
  549.     Public Property HeaderColour As Color
  550.         Get
  551.             Return _HeaderColour
  552.         End Get
  553.         Set(value As Color)
  554.             _HeaderColour = value
  555.         End Set
  556.     End Property
  557.     <Category("Colours")>
  558.     Public Property TextColour As Color
  559.         Get
  560.             Return _TextColour
  561.         End Get
  562.         Set(value As Color)
  563.             _TextColour = value
  564.         End Set
  565.     End Property
  566.     <Category("Colours")>
  567.     Public Property CircleColour As Color
  568.         Get
  569.             Return _CircleColour
  570.         End Get
  571.         Set(value As Color)
  572.             _CircleColour = value
  573.         End Set
  574.     End Property
  575.     <Category("Colours")>
  576.     Public Property BorderColour As Color
  577.         Get
  578.             Return _BorderColour
  579.         End Get
  580.         Set(value As Color)
  581.             _BorderColour = value
  582.         End Set
  583.     End Property
  584.     <Category("Misc")>
  585.     Public Property DrawCircle As Boolean
  586.         Get
  587.             Return _DrawCircle
  588.         End Get
  589.         Set(value As Boolean)
  590.             _DrawCircle = value
  591.         End Set
  592.     End Property
  593. #End Region
  594.  
  595. #Region "Draw Control"
  596.     Sub New()
  597.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or _
  598.                ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer Or _
  599.                ControlStyles.SupportsTransparentBackColor, True)
  600.         DoubleBuffered = True
  601.         BackColor = Color.Transparent
  602.         Size = New Size(160, 110)
  603.         Font = New Font("Segoe UI", 10, FontStyle.Bold)
  604.     End Sub
  605.  
  606.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  607.         Dim B As New Bitmap(Width, Height)
  608.         Dim G = Graphics.FromImage(B)
  609.         Dim Base As New Rectangle(0, 0, Width - 1, Height - 1)
  610.         Dim Circle As New Rectangle(8, 8, 10, 10)
  611.         With G
  612.             .TextRenderingHint = TextRenderingHint.ClearTypeGridFit
  613.             .SmoothingMode = SmoothingMode.HighQuality
  614.             .PixelOffsetMode = PixelOffsetMode.HighQuality
  615.             .Clear(BackColor)
  616.             .FillRectangle(New SolidBrush(_MainColour), Base)
  617.             .FillRectangle(New SolidBrush(_HeaderColour), New Rectangle(0, 0, Width - 1, 26))
  618.             .DrawRectangle(New Pen(New SolidBrush(_BorderColour)), New Rectangle(0, 0, Width, Height))
  619.             If _DrawCircle Then
  620.                 .FillEllipse(New SolidBrush(_CircleColour), Circle)
  621.                 .DrawString(Text, Font, New SolidBrush(_TextColour), New Rectangle(23, 4, Width, Height), New StringFormat With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Near})
  622.             Else
  623.                 .DrawString(Text, Font, New SolidBrush(_TextColour), New Rectangle(5, 4, Width, Height), New StringFormat With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Near})
  624.             End If
  625.         End With
  626.         MyBase.OnPaint(e)
  627.         G.Dispose()
  628.         e.Graphics.InterpolationMode = 7
  629.         e.Graphics.DrawImageUnscaled(B, 0, 0)
  630.         B.Dispose()
  631.     End Sub
  632. #End Region
  633.  
  634. End Class
  635.  
  636. Public Class FacebookCloseButton
  637.     Inherits Control
  638.  
  639. #Region "Declarations"
  640.     Private State As MouseState = MouseState.None
  641.     Private x As Integer
  642.     Private _BackColour As Color = Color.FromArgb(67, 96, 156)
  643. #End Region
  644.  
  645. #Region "Mouse States"
  646.  
  647.     Protected Overrides Sub OnMouseEnter(e As EventArgs)
  648.         MyBase.OnMouseEnter(e)
  649.         State = MouseState.Over : Invalidate()
  650.     End Sub
  651.     Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
  652.         MyBase.OnMouseDown(e)
  653.         State = MouseState.Down : Invalidate()
  654.     End Sub
  655.     Protected Overrides Sub OnMouseLeave(e As EventArgs)
  656.         MyBase.OnMouseLeave(e)
  657.         State = MouseState.None : Invalidate()
  658.     End Sub
  659.     Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
  660.         MyBase.OnMouseUp(e)
  661.         State = MouseState.Over : Invalidate()
  662.     End Sub
  663.     Protected Overrides Sub OnMouseMove(e As MouseEventArgs)
  664.         MyBase.OnMouseMove(e)
  665.         x = e.X : Invalidate()
  666.     End Sub
  667.  
  668.     Protected Overrides Sub OnClick(e As EventArgs)
  669.         MyBase.OnClick(e)
  670.         Environment.Exit(0)
  671.     End Sub
  672.  
  673. #End Region
  674.  
  675. #Region "Colour Properties"
  676.     <Category("Colors")> _
  677.     Public Property BaseColour As Color
  678.         Get
  679.             Return _BackColour
  680.         End Get
  681.         Set(value As Color)
  682.             _BackColour = value
  683.         End Set
  684.     End Property
  685. #End Region
  686.  
  687. #Region "Draw Control"
  688.     Sub New()
  689.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or _
  690.                  ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer, True)
  691.         DoubleBuffered = True
  692.         BackColor = Color.White
  693.         Size = New Size(20, 20)
  694.         Anchor = AnchorStyles.Top Or AnchorStyles.Right
  695.         Font = New Font("Marlett", 20)
  696.     End Sub
  697.  
  698.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  699.         Dim B As New Bitmap(Width, Height)
  700.         Dim G As Graphics = Graphics.FromImage(B)
  701.         Dim Base As New Rectangle(0, 0, Width, Height)
  702.         With G
  703.             .SmoothingMode = 2
  704.             .PixelOffsetMode = 2
  705.             .TextRenderingHint = 5
  706.             .Clear(BackColor)
  707.             .FillRectangle(New SolidBrush(_BackColour), Base)
  708.             Select Case State
  709.                 Case MouseState.None
  710.                     .DrawString("r", Font, New SolidBrush(Color.FromArgb(211, 218, 233)), New Rectangle(0, 0, Width, Height), New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
  711.                 Case MouseState.Over
  712.                     .DrawString("r", Font, New SolidBrush(Color.FromArgb(151, 158, 172)), New Rectangle(0, 0, Width, Height), New StringFormat With {.LineAlignment = StringAlignment.Near, .Alignment = StringAlignment.Center})
  713.             End Select
  714.         End With
  715.         MyBase.OnPaint(e)
  716.         G.Dispose()
  717.         e.Graphics.InterpolationMode = 7
  718.         e.Graphics.DrawImageUnscaled(B, 0, 0)
  719.         B.Dispose()
  720.     End Sub
  721. #End Region
  722.  
  723. End Class
  724.  
  725. Public Class FacebookTabControlVertical
  726.     Inherits TabControl
  727.  
  728. #Region "Declarations"
  729.     Private _PressedTabColour As Color = Color.FromArgb(200, 215, 237)
  730.     Private _HoverColour As Color = Color.FromArgb(109, 132, 180)
  731.     Private _NormalColour As Color = Color.FromArgb(237, 239, 244)
  732.     Private _BorderColour As Color = Color.FromArgb(139, 162, 210)
  733.     Private _TextColour As Color = Color.FromArgb(58, 66, 73)
  734.     Private HoverIndex As Integer = -1
  735. #End Region
  736.  
  737. #Region "Colour & Other Properties"
  738.     <Category("Colours")>
  739.     Public Property NormalColour As Color
  740.         Get
  741.             Return _NormalColour
  742.         End Get
  743.         Set(value As Color)
  744.             _NormalColour = value
  745.         End Set
  746.     End Property
  747.     <Category("Colours")>
  748.     Public Property HoverColour As Color
  749.         Get
  750.             Return _HoverColour
  751.         End Get
  752.         Set(value As Color)
  753.             _HoverColour = value
  754.         End Set
  755.     End Property
  756.     <Category("Colours")>
  757.     Public Property PressedTabColour As Color
  758.         Get
  759.             Return _PressedTabColour
  760.         End Get
  761.         Set(value As Color)
  762.             _PressedTabColour = value
  763.         End Set
  764.     End Property
  765.     <Category("Colours")>
  766.     Public Property BorderColour As Color
  767.         Get
  768.             Return _BorderColour
  769.         End Get
  770.         Set(value As Color)
  771.             _BorderColour = value
  772.         End Set
  773.     End Property
  774.     <Category("Colours")>
  775.     Public Property TextColour As Color
  776.         Get
  777.             Return _TextColour
  778.         End Get
  779.         Set(value As Color)
  780.             _TextColour = value
  781.         End Set
  782.     End Property
  783. #End Region
  784.  
  785. #Region "Draw Control"
  786.     Sub New()
  787.         DoubleBuffered = True
  788.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.UserPaint, True)
  789.         SizeMode = TabSizeMode.Fixed
  790.         ItemSize = New Size(44, 95)
  791.         Font = New Font("Segoe UI", 9, FontStyle.Regular)
  792.         DrawMode = TabDrawMode.OwnerDrawFixed
  793.     End Sub
  794.  
  795.     Protected Overrides Sub CreateHandle()
  796.         MyBase.CreateHandle()
  797.         Alignment = TabAlignment.Left
  798.     End Sub
  799.  
  800.     Protected Overrides Sub OnControlAdded(ByVal e As ControlEventArgs)
  801.         If TypeOf e.Control Is TabPage Then
  802.             For Each i As TabPage In Me.Controls
  803.                 i = New TabPage
  804.             Next
  805.             e.Control.BackColor = Color.FromArgb(255, 255, 255)
  806.         End If
  807.         MyBase.OnControlAdded(e)
  808.     End Sub
  809.  
  810.     Protected Overrides Sub OnMouseMove(ByVal e As MouseEventArgs)
  811.         For I As Integer = 0 To TabPages.Count - 1
  812.             If GetTabRect(I).Contains(e.Location) Then
  813.                 HoverIndex = I
  814.                 Exit For
  815.             End If
  816.         Next
  817.         Invalidate()
  818.         MyBase.OnMouseMove(e)
  819.     End Sub
  820.  
  821.     Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
  822.         HoverIndex = -1
  823.         Invalidate()
  824.         MyBase.OnMouseLeave(e)
  825.  
  826.     End Sub
  827.  
  828.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  829.         Dim B As New Bitmap(Width, Height)
  830.         Dim G = Graphics.FromImage(B)
  831.         G.TextRenderingHint = TextRenderingHint.ClearTypeGridFit
  832.         G.SmoothingMode = SmoothingMode.HighQuality
  833.         G.PixelOffsetMode = PixelOffsetMode.HighQuality
  834.         G.Clear(BackColor)
  835.         Try : SelectedTab.BackColor = _NormalColour : Catch : End Try
  836.         With G
  837.             .FillRectangle(New SolidBrush(_NormalColour), New Rectangle(-2, 0, ItemSize.Height + 4, Height + 22))
  838.             For i As Integer = 0 To TabCount - 1
  839.                 If i = SelectedIndex Then
  840.                     Dim x2 As Rectangle = New Rectangle(New Point(GetTabRect(i).Location.X - 2, GetTabRect(i).Location.Y - 2), New Size(GetTabRect(i).Width + 3, GetTabRect(i).Height - 1))
  841.                     .FillRectangle(New SolidBrush(_NormalColour), x2)
  842.                     Dim tabRect As New Rectangle(GetTabRect(i).Location.X - 3, GetTabRect(i).Location.Y + 2, GetTabRect(i).Size.Width + 10, GetTabRect(i).Size.Height - 11)
  843.                     .FillRectangle(New SolidBrush(_PressedTabColour), New Rectangle(tabRect.X + 1, tabRect.Y + 1, tabRect.Width - 1, tabRect.Height - 2))
  844.                     .DrawRectangle(New Pen(_BorderColour), tabRect)
  845.                     .SmoothingMode = SmoothingMode.AntiAlias
  846.                 Else
  847.                     Dim x2 As Rectangle = New Rectangle(New Point(GetTabRect(i).Location.X - 2, GetTabRect(i).Location.Y - 2), New Size(GetTabRect(i).Width - 1, GetTabRect(i).Height - 11))
  848.                     .FillRectangle(New SolidBrush(_NormalColour), x2)
  849.                     If HoverIndex = i Then
  850.                         Dim x21 As Rectangle = New Rectangle(New Point(GetTabRect(i).Location.X - 2, GetTabRect(i).Location.Y + 2), New Size(GetTabRect(i).Width, GetTabRect(i).Height - 11))
  851.                         .FillRectangle(New SolidBrush(Color.FromArgb(199, 201, 207)), x21)
  852.                     End If
  853.                 End If
  854.                 Dim tabRect1 As New Rectangle(GetTabRect(i).Location.X + 3, GetTabRect(i).Location.Y + 3, GetTabRect(i).Size.Width - 20, GetTabRect(i).Size.Height - 11)
  855.                 .DrawString(TabPages(i).Text, Font, New SolidBrush(_TextColour), tabRect1, New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
  856.                 .FillRectangle(New SolidBrush(_NormalColour), New Rectangle(97, 0, Width - 97, Height))
  857.                 .DrawLine(New Pen((_BorderColour), 1), New Point(96, 0), New Point(96, Height))
  858.             Next
  859.         End With
  860.         G.Dispose()
  861.         e.Graphics.InterpolationMode = 7
  862.         e.Graphics.DrawImageUnscaled(B, 0, 0)
  863.         B.Dispose()
  864.     End Sub
  865. #End Region
  866.  
  867. End Class
  868.  
  869. Public Class FacebookChatRightBubble
  870.     Inherits Control
  871. #Region "Declarations"
  872.     Private _TextColour As Color = Color.FromArgb(65, 73, 80)
  873.     Private _BorderColour As Color = Color.FromArgb(163, 182, 208)
  874.     Private _BaseColour As Color = Color.FromArgb(214, 231, 254)
  875.     Private _ShowArrow As Boolean = True
  876.     Private _ArrowFixed As Boolean = True
  877. #End Region
  878.  
  879. #Region "Colour & Other Properties"
  880.     <Category("Colours")>
  881.     Public Property BaseColour As Color
  882.         Get
  883.             Return _BaseColour
  884.         End Get
  885.         Set(value As Color)
  886.             _BaseColour = value
  887.         End Set
  888.     End Property
  889.     <Category("Colours")>
  890.     Public Property TextColour As Color
  891.         Get
  892.             Return _TextColour
  893.         End Get
  894.         Set(value As Color)
  895.             _TextColour = value
  896.         End Set
  897.     End Property
  898.     <Category("Colours")>
  899.     Public Property BorderColour As Color
  900.         Get
  901.             Return _BorderColour
  902.         End Get
  903.         Set(value As Color)
  904.             _BorderColour = value
  905.         End Set
  906.     End Property
  907.     <Category("Misc")>
  908.     Public Property ShowArrow As Boolean
  909.         Get
  910.             Return _ShowArrow
  911.         End Get
  912.         Set(value As Boolean)
  913.             _ShowArrow = value
  914.         End Set
  915.     End Property
  916.     <Category("Misc")>
  917.     Public Property ArrowFixed As Boolean
  918.         Get
  919.             Return _ArrowFixed
  920.         End Get
  921.         Set(value As Boolean)
  922.             _ArrowFixed = value
  923.         End Set
  924.     End Property
  925.     '--Need to sort out
  926. #Region ""
  927.     'Private _Multiline As Boolean
  928.     '<Category("Options")>
  929.     'Property Multiline() As Boolean
  930.     '    Get
  931.     '        Return _Multiline
  932.     '    End Get
  933.     '    Set(ByVal value As Boolean)
  934.     '        _Multiline = value
  935.     '        If TB IsNot Nothing Then
  936.     '            TB.Multiline = value
  937.  
  938.     '            If value Then
  939.     '                TB.Height = Height - 11
  940.     '            Else
  941.     '                Height = TB.Height + 11
  942.     '            End If
  943.  
  944.     '        End If
  945.     '    End Set
  946.     'End Property
  947.     '<Category("Options")>
  948.     'Overrides Property Text As String
  949.     '    Get
  950.     '        Return MyBase.Text
  951.     '    End Get
  952.     '    Set(ByVal value As String)
  953.     '        MyBase.Text = value
  954.     '        If TB IsNot Nothing Then
  955.     '            TB.Text = value
  956.     '        End If
  957.     '    End Set
  958.     'End Property
  959.     '<Category("Options")>
  960.     'Overrides Property Font As Font
  961.     '    Get
  962.     '        Return MyBase.Font
  963.     '    End Get
  964.     '    Set(ByVal value As Font)
  965.     '        MyBase.Font = value
  966.     '        If TB IsNot Nothing Then
  967.     '            TB.Font = value
  968.     '            TB.Location = New Point(3, 5)
  969.     '            TB.Width = Width - 6
  970.  
  971.     '            If Not _Multiline Then
  972.     '                Height = TB.Height + 11
  973.     '            End If
  974.     '        End If
  975.     '    End Set
  976.     'End Property
  977. #End Region
  978.  
  979. #End Region
  980.  
  981. #Region "Draw Control"
  982.     Sub New()
  983.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or _
  984.                ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer Or _
  985.                ControlStyles.SupportsTransparentBackColor, True)
  986.         DoubleBuffered = True
  987.         Size = New Size(135, 32)
  988.         BackColor = Color.Transparent
  989.         Font = New Font("Klavika", 9)
  990.     End Sub
  991.  
  992.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  993.         Dim B As New Bitmap(Width, Height)
  994.         Dim G = Graphics.FromImage(B)
  995.         Dim GP, GP1 As New GraphicsPath
  996.         With G
  997.             .TextRenderingHint = TextRenderingHint.ClearTypeGridFit
  998.             .SmoothingMode = SmoothingMode.HighQuality
  999.             .PixelOffsetMode = PixelOffsetMode.HighQuality
  1000.             .Clear(BackColor)
  1001.             If _ShowArrow Then
  1002.                 Dim Base As New Rectangle(0, 0, Width - 8, Height - 1)
  1003.                 Dim BorderBase As New Rectangle(0, 0, Width - 7, Height)
  1004.                 GP = DrawHelpers.RoundRec(Base, 2)
  1005.                 GP1 = DrawHelpers.RoundRec(BorderBase, 4)
  1006.                 .FillPath(New SolidBrush(_BaseColour), GP)
  1007.                 .DrawPath(New Pen(New SolidBrush(_BorderColour)), GP1)
  1008.                 .DrawString(Text, Font, New SolidBrush(_TextColour), (New Rectangle(6, 4, Width - 15, Height)))
  1009.                 If _ArrowFixed Then
  1010.                     Dim p() As Point = {New Point(Width - 8, 11), New Point(Width, 17), New Point(Width - 8, 22)}
  1011.                     .FillPolygon(New SolidBrush(_BaseColour), p)
  1012.                     .DrawPolygon(New Pen(New SolidBrush(_BaseColour)), p)
  1013.                     .DrawLine(New Pen(New SolidBrush(_BorderColour)), New Point(Width - 7, 11), New Point(Width, 17))
  1014.                     .DrawLine(New Pen(New SolidBrush(_BorderColour)), New Point(Width, 17), New Point(Width - 7, 22))
  1015.                 Else
  1016.                     Dim p() As Point = {New Point(Width - 8, Height - 19), New Point(Width, Height - 25), New Point(Width - 8, Height - 30)}
  1017.                     .FillPolygon(New SolidBrush(_BaseColour), p)
  1018.                     .DrawPolygon(New Pen(New SolidBrush(_BaseColour)), p)
  1019.                     .DrawLine(New Pen(New SolidBrush(_BorderColour)), New Point(Width - 7, Height - 19), New Point(Width, Height - 25))
  1020.                     .DrawLine(New Pen(New SolidBrush(_BorderColour)), New Point(Width, Height - 25), New Point(Width - 7, Height - 30))
  1021.                 End If
  1022.             Else
  1023.                 Dim Base As New Rectangle(0, 0, Width - 1, Height - 1)
  1024.                 Dim BorderBase As New Rectangle(0, 0, Width, Height)
  1025.                 GP = DrawHelpers.RoundRec(Base, 2)
  1026.                 GP1 = DrawHelpers.RoundRec(BorderBase, 4)
  1027.                 .FillPath(New SolidBrush(_BaseColour), GP)
  1028.                 .DrawPath(New Pen(New SolidBrush(_BorderColour)), GP1)
  1029.                 .DrawString(Text, Font, New SolidBrush(_TextColour), (New Rectangle(6, 4, Width - 10, Height)))
  1030.             End If
  1031.         End With
  1032.         MyBase.OnPaint(e)
  1033.         G.Dispose()
  1034.         e.Graphics.InterpolationMode = 7
  1035.         e.Graphics.DrawImageUnscaled(B, 0, 0)
  1036.         B.Dispose()
  1037.     End Sub
  1038. #End Region
  1039.  
  1040. End Class
  1041.  
  1042. Public Class FacebookChatLeftBubble
  1043.     Inherits Control
  1044.  
  1045. #Region "Declarations"
  1046.     Private _TextColour As Color = Color.FromArgb(65, 73, 80)
  1047.     Private _BorderColour As Color = Color.FromArgb(198, 198, 198)
  1048.     Private _BaseColour As Color = Color.FromArgb(250, 250, 250)
  1049.     Private _ShowArrow As Boolean = True
  1050.     Private _ArrowFixed As Boolean = True
  1051. #End Region
  1052.  
  1053. #Region "Colour & Other Properties"
  1054.     <Category("Colours")>
  1055.     Public Property BaseColour As Color
  1056.         Get
  1057.             Return _BaseColour
  1058.         End Get
  1059.         Set(value As Color)
  1060.             _BaseColour = value
  1061.         End Set
  1062.     End Property
  1063.     <Category("Colours")>
  1064.     Public Property TextColour As Color
  1065.         Get
  1066.             Return _TextColour
  1067.         End Get
  1068.         Set(value As Color)
  1069.             _TextColour = value
  1070.         End Set
  1071.     End Property
  1072.     <Category("Colours")>
  1073.     Public Property BorderColour As Color
  1074.         Get
  1075.             Return _BorderColour
  1076.         End Get
  1077.         Set(value As Color)
  1078.             _BorderColour = value
  1079.         End Set
  1080.     End Property
  1081.     <Category("Misc")>
  1082.     Public Property ShowArrow As Boolean
  1083.         Get
  1084.             Return _ShowArrow
  1085.         End Get
  1086.         Set(value As Boolean)
  1087.             _ShowArrow = value
  1088.         End Set
  1089.     End Property
  1090.     <Category("Misc")>
  1091.     Public Property ArrowFixed As Boolean
  1092.         Get
  1093.             Return _ArrowFixed
  1094.         End Get
  1095.         Set(value As Boolean)
  1096.             _ArrowFixed = value
  1097.         End Set
  1098.     End Property
  1099.     '--Need to sort out
  1100. #Region ""
  1101.     'Private _Multiline As Boolean
  1102.     '<Category("Options")>
  1103.     'Property Multiline() As Boolean
  1104.     '    Get
  1105.     '        Return _Multiline
  1106.     '    End Get
  1107.     '    Set(ByVal value As Boolean)
  1108.     '        _Multiline = value
  1109.     '        If TB IsNot Nothing Then
  1110.     '            TB.Multiline = value
  1111.  
  1112.     '            If value Then
  1113.     '                TB.Height = Height - 11
  1114.     '            Else
  1115.     '                Height = TB.Height + 11
  1116.     '            End If
  1117.  
  1118.     '        End If
  1119.     '    End Set
  1120.     'End Property
  1121.     '<Category("Options")>
  1122.     'Overrides Property Text As String
  1123.     '    Get
  1124.     '        Return MyBase.Text
  1125.     '    End Get
  1126.     '    Set(ByVal value As String)
  1127.     '        MyBase.Text = value
  1128.     '        If TB IsNot Nothing Then
  1129.     '            TB.Text = value
  1130.     '        End If
  1131.     '    End Set
  1132.     'End Property
  1133.     '<Category("Options")>
  1134.     'Overrides Property Font As Font
  1135.     '    Get
  1136.     '        Return MyBase.Font
  1137.     '    End Get
  1138.     '    Set(ByVal value As Font)
  1139.     '        MyBase.Font = value
  1140.     '        If TB IsNot Nothing Then
  1141.     '            TB.Font = value
  1142.     '            TB.Location = New Point(3, 5)
  1143.     '            TB.Width = Width - 6
  1144.  
  1145.     '            If Not _Multiline Then
  1146.     '                Height = TB.Height + 11
  1147.     '            End If
  1148.     '        End If
  1149.     '    End Set
  1150.     'End Property
  1151. #End Region
  1152.  
  1153. #End Region
  1154.  
  1155. #Region "Draw Control"
  1156.     Sub New()
  1157.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or _
  1158.                ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer Or _
  1159.                ControlStyles.SupportsTransparentBackColor, True)
  1160.         DoubleBuffered = True
  1161.         Size = New Size(135, 32)
  1162.         BackColor = Color.Transparent
  1163.         Font = New Font("Klavika", 9)
  1164.     End Sub
  1165.  
  1166.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  1167.         Dim B As New Bitmap(Width, Height)
  1168.         Dim G = Graphics.FromImage(B)
  1169.         Dim GP, GP1 As New GraphicsPath
  1170.         With G
  1171.             .TextRenderingHint = TextRenderingHint.ClearTypeGridFit
  1172.             .SmoothingMode = SmoothingMode.HighQuality
  1173.             .PixelOffsetMode = PixelOffsetMode.HighQuality
  1174.             .Clear(BackColor)
  1175.             If _ShowArrow Then
  1176.                 Dim Base As New Rectangle(7, 0, Width - 7, Height - 1)
  1177.                 Dim BorderBase As New Rectangle(8, 0, Width - 8, Height)
  1178.                 GP = DrawHelpers.RoundRec(Base, 2)
  1179.                 GP1 = DrawHelpers.RoundRec(BorderBase, 4)
  1180.                 .FillPath(New SolidBrush(_BaseColour), GP)
  1181.                 .DrawPath(New Pen(New SolidBrush(_BorderColour)), GP1)
  1182.                 .DrawString(Text, Font, New SolidBrush(_TextColour), New Rectangle(15, 4, Width - 17, Height - 5))
  1183.                 If _ArrowFixed Then
  1184.                     Dim p() As Point = {New Point(9, 11), New Point(0, 17), New Point(9, 22)}
  1185.                     .FillPolygon(New SolidBrush(_BaseColour), p)
  1186.                     .DrawPolygon(New Pen(New SolidBrush(_BaseColour)), p)
  1187.                     .DrawLine(New Pen(New SolidBrush(_BorderColour)), New Point(8, 11), New Point(0, 17))
  1188.                     .DrawLine(New Pen(New SolidBrush(_BorderColour)), New Point(0, 17), New Point(8, 22))
  1189.                 Else
  1190.                     Dim p() As Point = {New Point(9, Height - 19), New Point(0, Height - 25), New Point(9, Height - 30)}
  1191.                     .FillPolygon(New SolidBrush(_BaseColour), p)
  1192.                     .DrawPolygon(New Pen(New SolidBrush(_BaseColour)), p)
  1193.                     .DrawLine(New Pen(New SolidBrush(_BorderColour)), New Point(8, Height - 19), New Point(0, Height - 25))
  1194.                     .DrawLine(New Pen(New SolidBrush(_BorderColour)), New Point(0, Height - 25), New Point(8, Height - 30))
  1195.                 End If
  1196.             Else
  1197.                 Dim Base As New Rectangle(0, 0, Width - 1, Height - 1)
  1198.                 Dim BorderBase As New Rectangle(0, 0, Width, Height)
  1199.                 GP = DrawHelpers.RoundRec(Base, 2)
  1200.                 GP1 = DrawHelpers.RoundRec(BorderBase, 4)
  1201.                 .FillPath(New SolidBrush(_BaseColour), GP)
  1202.                 .DrawPath(New Pen(New SolidBrush(_BorderColour)), GP1)
  1203.                 .DrawString(Text, Font, New SolidBrush(_TextColour), New Rectangle(6, 4, Width - 17, Height - 5))
  1204.             End If
  1205.         End With
  1206.         MyBase.OnPaint(e)
  1207.         G.Dispose()
  1208.         e.Graphics.InterpolationMode = 7
  1209.         e.Graphics.DrawImageUnscaled(B, 0, 0)
  1210.         B.Dispose()
  1211.     End Sub
  1212. #End Region
  1213.  
  1214. End Class
  1215.  
  1216. <DefaultEvent("CheckedChanged")>
  1217. Public Class FacebookRadioButton
  1218.     Inherits Control
  1219.  
  1220. #Region "Declarations"
  1221.     Private _Checked As Boolean
  1222.     Private State As MouseState = MouseState.None
  1223.     Private _HighColour As Color = Color.FromArgb(125, 200, 255)
  1224.     Private _SecondBorderColour As Color = Color.FromArgb(114, 207, 249)
  1225.     Private _CheckedColour As Color = Color.FromArgb(103, 215, 243)
  1226.     Private _BorderColour As Color = Color.FromArgb(207, 211, 220)
  1227.     Private _BackColour As Color = Color.FromArgb(237, 239, 244)
  1228.     Private _TextColour As Color = Color.FromArgb(65, 73, 80)
  1229. #End Region
  1230.  
  1231. #Region "Colour & Other Properties"
  1232.  
  1233.     <Category("Colours")>
  1234.     Public Property HighlightColour As Color
  1235.         Get
  1236.             Return _HighColour
  1237.         End Get
  1238.         Set(value As Color)
  1239.             _HighColour = value
  1240.         End Set
  1241.     End Property
  1242.  
  1243.     <Category("Colours")>
  1244.     Public Property BaseColour As Color
  1245.         Get
  1246.             Return _BackColour
  1247.         End Get
  1248.         Set(value As Color)
  1249.             _BackColour = value
  1250.         End Set
  1251.     End Property
  1252.  
  1253.     <Category("Colours")>
  1254.     Public Property BorderColour As Color
  1255.         Get
  1256.             Return _BorderColour
  1257.         End Get
  1258.         Set(value As Color)
  1259.             _BorderColour = value
  1260.         End Set
  1261.     End Property
  1262.  
  1263.     <Category("Colours")>
  1264.     Public Property CheckedColour As Color
  1265.         Get
  1266.             Return _CheckedColour
  1267.         End Get
  1268.         Set(value As Color)
  1269.             _CheckedColour = value
  1270.         End Set
  1271.     End Property
  1272.  
  1273.     <Category("Colours")>
  1274.     Public Property SecondCircleColour As Color
  1275.         Get
  1276.             Return _SecondBorderColour
  1277.         End Get
  1278.         Set(value As Color)
  1279.             _SecondBorderColour = value
  1280.         End Set
  1281.     End Property
  1282.  
  1283.     <Category("Colours")>
  1284.     Public Property FontColour As Color
  1285.         Get
  1286.             Return _TextColour
  1287.         End Get
  1288.         Set(value As Color)
  1289.             _TextColour = value
  1290.         End Set
  1291.     End Property
  1292.  
  1293.     Event CheckedChanged(ByVal sender As Object)
  1294.     Property Checked() As Boolean
  1295.         Get
  1296.             Return _Checked
  1297.         End Get
  1298.         Set(value As Boolean)
  1299.             _Checked = value
  1300.             InvalidateControls()
  1301.             RaiseEvent CheckedChanged(Me)
  1302.             Invalidate()
  1303.         End Set
  1304.     End Property
  1305.  
  1306.     Protected Overrides Sub OnClick(e As EventArgs)
  1307.         If Not _Checked Then Checked = True
  1308.         MyBase.OnClick(e)
  1309.     End Sub
  1310.     Private Sub InvalidateControls()
  1311.         If Not IsHandleCreated OrElse Not _Checked Then Return
  1312.         For Each C As Control In Parent.Controls
  1313.             If C IsNot Me AndAlso TypeOf C Is FacebookRadioButton Then
  1314.                 DirectCast(C, FacebookRadioButton).Checked = False
  1315.                 Invalidate()
  1316.             End If
  1317.         Next
  1318.     End Sub
  1319.     Protected Overrides Sub OnCreateControl()
  1320.         MyBase.OnCreateControl()
  1321.         InvalidateControls()
  1322.     End Sub
  1323.     Protected Overrides Sub OnResize(e As EventArgs)
  1324.         MyBase.OnResize(e)
  1325.         Height = 22
  1326.     End Sub
  1327. #End Region
  1328.  
  1329. #Region "Mouse States"
  1330.  
  1331.     Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
  1332.         MyBase.OnMouseDown(e)
  1333.         State = MouseState.Down : Invalidate()
  1334.     End Sub
  1335.     Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
  1336.         MyBase.OnMouseUp(e)
  1337.         State = MouseState.Over : Invalidate()
  1338.     End Sub
  1339.     Protected Overrides Sub OnMouseEnter(e As EventArgs)
  1340.         MyBase.OnMouseEnter(e)
  1341.         State = MouseState.Over : Invalidate()
  1342.     End Sub
  1343.     Protected Overrides Sub OnMouseLeave(e As EventArgs)
  1344.         MyBase.OnMouseLeave(e)
  1345.         State = MouseState.None : Invalidate()
  1346.     End Sub
  1347.  
  1348. #End Region
  1349.  
  1350. #Region "Draw Control"
  1351.     Sub New()
  1352.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or _
  1353.                    ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer, True)
  1354.         DoubleBuffered = True
  1355.         Cursor = Cursors.Hand
  1356.         Size = New Size(100, 22)
  1357.     End Sub
  1358.  
  1359.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  1360.         Dim B As New Bitmap(Width, Height)
  1361.         Dim G = Graphics.FromImage(B)
  1362.         Dim Base As New Rectangle(1, 0, Height - 2, Height - 2)
  1363.         Dim Circle As New Rectangle(7, 6, Height - 14, Height - 14)
  1364.         Dim SecondBorder As New Rectangle(4, 3, 14, 14)
  1365.         With G
  1366.             .TextRenderingHint = TextRenderingHint.ClearTypeGridFit
  1367.             .SmoothingMode = SmoothingMode.HighQuality
  1368.             .PixelOffsetMode = PixelOffsetMode.HighQuality
  1369.             .Clear(BackColor)
  1370.             .FillEllipse(New SolidBrush(_BackColour), Base)
  1371.             .DrawEllipse(New Pen(_BorderColour), Base)
  1372.             Select Case State
  1373.                 Case MouseState.Over
  1374.                     .DrawEllipse(New Pen(_HighColour), Base)
  1375.                 Case MouseState.Down
  1376.                     .DrawEllipse(New Pen(_HighColour), Base)
  1377.             End Select
  1378.             If Checked Then
  1379.                 .FillEllipse(New SolidBrush(_CheckedColour), Circle)
  1380.                 .DrawEllipse(New Pen(_HighColour), Base)
  1381.                 .DrawEllipse(New Pen(_SecondBorderColour), SecondBorder)
  1382.             End If
  1383.             .DrawString(Text, Font, New SolidBrush(_TextColour), New Rectangle(24, 4, Width, Height), New StringFormat With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Near})
  1384.         End With
  1385.         MyBase.OnPaint(e)
  1386.         G.Dispose()
  1387.         e.Graphics.InterpolationMode = 7
  1388.         e.Graphics.DrawImageUnscaled(B, 0, 0)
  1389.         B.Dispose()
  1390.     End Sub
  1391. #End Region
  1392.  
  1393. End Class
  1394.  
  1395. <DefaultEvent("CheckedChanged")>
  1396. Public Class FacebookCheckBox
  1397.     Inherits Control
  1398.  
  1399. #Region "Declarations"
  1400.     Private _Checked As Boolean
  1401.     Private State As MouseState = MouseState.None
  1402.     Private _HighColour As Color = Color.FromArgb(125, 200, 255)
  1403.     Private _CheckedColour As Color = Color.FromArgb(103, 215, 243)
  1404.     Private _BorderColour As Color = Color.FromArgb(207, 211, 220)
  1405.     Private _BackColour As Color = Color.FromArgb(237, 239, 244)
  1406.     Private _TextColour As Color = Color.FromArgb(65, 73, 80)
  1407. #End Region
  1408.  
  1409. #Region "Colour & Other Properties"
  1410.  
  1411.     <Category("Colours")>
  1412.     Public Property HighlightColour As Color
  1413.         Get
  1414.             Return _HighColour
  1415.         End Get
  1416.         Set(value As Color)
  1417.             _HighColour = value
  1418.         End Set
  1419.     End Property
  1420.  
  1421.     <Category("Colours")>
  1422.     Public Property BaseColour As Color
  1423.         Get
  1424.             Return _BackColour
  1425.         End Get
  1426.         Set(value As Color)
  1427.             _BackColour = value
  1428.         End Set
  1429.     End Property
  1430.  
  1431.     <Category("Colours")>
  1432.     Public Property BorderColour As Color
  1433.         Get
  1434.             Return _BorderColour
  1435.         End Get
  1436.         Set(value As Color)
  1437.             _BorderColour = value
  1438.         End Set
  1439.     End Property
  1440.  
  1441.     <Category("Colours")>
  1442.     Public Property CheckedColour As Color
  1443.         Get
  1444.             Return _CheckedColour
  1445.         End Get
  1446.         Set(value As Color)
  1447.             _CheckedColour = value
  1448.         End Set
  1449.     End Property
  1450.  
  1451.     <Category("Colours")>
  1452.     Public Property FontColour As Color
  1453.         Get
  1454.             Return _TextColour
  1455.         End Get
  1456.         Set(value As Color)
  1457.             _TextColour = value
  1458.         End Set
  1459.     End Property
  1460.  
  1461.     Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
  1462.         MyBase.OnTextChanged(e)
  1463.         Invalidate()
  1464.     End Sub
  1465.  
  1466.     Property Checked() As Boolean
  1467.         Get
  1468.             Return _Checked
  1469.         End Get
  1470.         Set(ByVal value As Boolean)
  1471.             _Checked = value
  1472.             Invalidate()
  1473.         End Set
  1474.     End Property
  1475.  
  1476.     Event CheckedChanged(ByVal sender As Object)
  1477.     Protected Overrides Sub OnClick(ByVal e As System.EventArgs)
  1478.         _Checked = Not _Checked
  1479.         RaiseEvent CheckedChanged(Me)
  1480.         MyBase.OnClick(e)
  1481.     End Sub
  1482.  
  1483.     Protected Overrides Sub OnResize(e As EventArgs)
  1484.         MyBase.OnResize(e)
  1485.         Height = 22
  1486.     End Sub
  1487. #End Region
  1488.  
  1489. #Region "Mouse States"
  1490.  
  1491.     Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
  1492.         MyBase.OnMouseDown(e)
  1493.         State = MouseState.Down : Invalidate()
  1494.     End Sub
  1495.     Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
  1496.         MyBase.OnMouseUp(e)
  1497.         State = MouseState.Over : Invalidate()
  1498.     End Sub
  1499.     Protected Overrides Sub OnMouseEnter(e As EventArgs)
  1500.         MyBase.OnMouseEnter(e)
  1501.         State = MouseState.Over : Invalidate()
  1502.     End Sub
  1503.     Protected Overrides Sub OnMouseLeave(e As EventArgs)
  1504.         MyBase.OnMouseLeave(e)
  1505.         State = MouseState.None : Invalidate()
  1506.     End Sub
  1507.  
  1508. #End Region
  1509.  
  1510. #Region "Draw Control"
  1511.     Sub New()
  1512.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or _
  1513.                    ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer, True)
  1514.         DoubleBuffered = True
  1515.         Cursor = Cursors.Hand
  1516.         Size = New Size(100, 22)
  1517.     End Sub
  1518.  
  1519.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  1520.         Dim B As New Bitmap(Width, Height)
  1521.         Dim G = Graphics.FromImage(B)
  1522.         Dim Base As New Rectangle(0, 0, 22, 22)
  1523.         With G
  1524.             .TextRenderingHint = TextRenderingHint.ClearTypeGridFit
  1525.             .SmoothingMode = SmoothingMode.HighQuality
  1526.             .PixelOffsetMode = PixelOffsetMode.HighQuality
  1527.             .Clear(BackColor)
  1528.             .FillRectangle(New SolidBrush(_BackColour), Base)
  1529.             .DrawRectangle(New Pen(_BorderColour), New Rectangle(1, 1, 20, 20))
  1530.             Select Case State
  1531.                 Case MouseState.Over
  1532.                     .DrawRectangle(New Pen(_HighColour), New Rectangle(1, 1, 20, 20))
  1533.                 Case MouseState.Down
  1534.                     .DrawRectangle(New Pen(_HighColour), New Rectangle(1, 1, 20, 20))
  1535.             End Select
  1536.             If Checked Then
  1537.                 .FillRectangle(New SolidBrush(_CheckedColour), New Rectangle(3, 3, 16, 16))
  1538.                 .DrawRectangle(New Pen(_HighColour), New Rectangle(1, 1, 20, 20))
  1539.             End If
  1540.             .DrawString(Text, Font, New SolidBrush(_TextColour), New Rectangle(24, 4, Width, Height), New StringFormat With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Near})
  1541.         End With
  1542.         MyBase.OnPaint(e)
  1543.         G.Dispose()
  1544.         e.Graphics.InterpolationMode = 7
  1545.         e.Graphics.DrawImageUnscaled(B, 0, 0)
  1546.         B.Dispose()
  1547.     End Sub
  1548. #End Region
  1549.  
  1550. End Class
  1551.  
  1552. Public Class FacebookProgressBar
  1553.     Inherits Control
  1554.  
  1555. #Region "Declarations"
  1556.     Private _ProgressColour As Color = Color.LightBlue
  1557.     Private _GlowColour As Color = Color.FromArgb(73, 185, 213)
  1558.     Private _BorderColour As Color = Color.FromArgb(187, 191, 200)
  1559.     Private _BaseColour As Color = Color.FromArgb(237, 237, 237)
  1560.     Private _FontColour As Color = Color.FromArgb(50, 50, 50)
  1561.     Private _Value As Integer = 0
  1562.     Private _Maximum As Integer = 100
  1563. #End Region
  1564.  
  1565. #Region "Properties"
  1566.  
  1567.     <Category("Control")>
  1568.     Public Property Maximum() As Integer
  1569.         Get
  1570.             Return _Maximum
  1571.         End Get
  1572.         Set(V As Integer)
  1573.             Select Case V
  1574.                 Case Is < _Value
  1575.                     _Value = V
  1576.             End Select
  1577.             _Maximum = V
  1578.             Invalidate()
  1579.         End Set
  1580.     End Property
  1581.  
  1582.     <Category("Control")>
  1583.     Public Property Value() As Integer
  1584.         Get
  1585.             Select Case _Value
  1586.                 Case 0
  1587.                     Return 0
  1588.                     Invalidate()
  1589.                 Case Else
  1590.                     Return _Value
  1591.                     Invalidate()
  1592.             End Select
  1593.         End Get
  1594.         Set(V As Integer)
  1595.             Select Case V
  1596.                 Case Is > _Maximum
  1597.                     V = _Maximum
  1598.                     Invalidate()
  1599.             End Select
  1600.             _Value = V
  1601.             Invalidate()
  1602.         End Set
  1603.     End Property
  1604.  
  1605.     <Category("Colours")>
  1606.     Public Property ProgressColour As Color
  1607.         Get
  1608.             Return _ProgressColour
  1609.         End Get
  1610.         Set(value As Color)
  1611.             _ProgressColour = value
  1612.         End Set
  1613.     End Property
  1614.  
  1615.     <Category("Colours")>
  1616.     Public Property BaseColour As Color
  1617.         Get
  1618.             Return _BaseColour
  1619.         End Get
  1620.         Set(value As Color)
  1621.             _BaseColour = value
  1622.         End Set
  1623.     End Property
  1624.  
  1625.     <Category("Colours")>
  1626.     Public Property BorderColour As Color
  1627.         Get
  1628.             Return _BorderColour
  1629.         End Get
  1630.         Set(value As Color)
  1631.             _BorderColour = value
  1632.         End Set
  1633.     End Property
  1634.  
  1635.     <Category("Colours")>
  1636.     Public Property GlowColour As Color
  1637.         Get
  1638.             Return _GlowColour
  1639.         End Get
  1640.         Set(value As Color)
  1641.             _GlowColour = value
  1642.         End Set
  1643.     End Property
  1644.  
  1645.     <Category("Colours")>
  1646.     Public Property FontColour As Color
  1647.         Get
  1648.             Return _FontColour
  1649.         End Get
  1650.         Set(value As Color)
  1651.             _FontColour = value
  1652.         End Set
  1653.     End Property
  1654.  
  1655. #End Region
  1656.  
  1657. #Region "Events"
  1658.  
  1659.     Protected Overrides Sub OnResize(e As EventArgs)
  1660.         MyBase.OnResize(e)
  1661.         Height = 25
  1662.     End Sub
  1663.  
  1664.     Protected Overrides Sub CreateHandle()
  1665.         MyBase.CreateHandle()
  1666.         Height = 25
  1667.     End Sub
  1668.  
  1669.     Public Sub Increment(ByVal Amount As Integer)
  1670.         Value += Amount
  1671.     End Sub
  1672.  
  1673. #End Region
  1674.  
  1675. #Region "Draw Control"
  1676.     Sub New()
  1677.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or _
  1678.                  ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer, True)
  1679.         DoubleBuffered = True
  1680.         BackColor = Color.FromArgb(60, 70, 73)
  1681.     End Sub
  1682.  
  1683.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  1684.         Dim B = New Bitmap(Width, Height)
  1685.         Dim G As Graphics = Graphics.FromImage(B)
  1686.         Dim Base As New Rectangle(0, 0, Width, Height)
  1687.         With G
  1688.             .TextRenderingHint = TextRenderingHint.ClearTypeGridFit
  1689.             .SmoothingMode = SmoothingMode.HighQuality
  1690.             .PixelOffsetMode = PixelOffsetMode.HighQuality
  1691.             .Clear(BackColor)
  1692.             Dim ProgVal As Integer = CInt(_Value / _Maximum * (Width - 40))
  1693.             Select Case Value
  1694.                 Case 0
  1695.                     .FillRectangle(New SolidBrush(_BaseColour), Base)
  1696.                     .DrawLine(New Pen(_BorderColour), New Point(Width - 40, 0), New Point(Width - 40, Height))
  1697.                     .FillRectangle(New SolidBrush(_ProgressColour), New Rectangle(0, 0, ProgVal - 1, Height))
  1698.                     .DrawRectangle(New Pen(_BorderColour), Base)
  1699.                     .DrawString(String.Format("{0}%", _Value), Font, New SolidBrush(_FontColour), New Point(Width - 37, 4))
  1700.                 Case _Maximum
  1701.                     .FillRectangle(New SolidBrush(_BaseColour), Base)
  1702.                     .FillRectangle(New SolidBrush(_ProgressColour), New Rectangle(0, 0, ProgVal - 1, Height))
  1703.                     .DrawRectangle(New Pen(_GlowColour), Base)
  1704.                     .DrawLine(New Pen(_GlowColour), New Point(Width - 40, 0), New Point(Width - 40, Height))
  1705.                     .DrawString(String.Format("{0}%", _Value), Font, New SolidBrush(_FontColour), New Point(Width - 37, 4))
  1706.                 Case Else
  1707.                     .FillRectangle(New SolidBrush(_BaseColour), Base)
  1708.                     .FillRectangle(New SolidBrush(_ProgressColour), New Rectangle(0, 0, ProgVal - 1, Height))
  1709.                     .DrawRectangle(New Pen(_BorderColour), Base)
  1710.                     .DrawLine(New Pen(_BorderColour), New Point(Width - 40, 0), New Point(Width - 40, Height))
  1711.                     .DrawString(String.Format("{0}%", _Value), Font, New SolidBrush(_FontColour), New Point(Width - 37, 4))
  1712.             End Select
  1713.         End With
  1714.         MyBase.OnPaint(e)
  1715.         G.Dispose()
  1716.         e.Graphics.InterpolationMode = 7
  1717.         e.Graphics.DrawImageUnscaled(B, 0, 0)
  1718.         B.Dispose()
  1719.     End Sub
  1720.  
  1721. #End Region
  1722.  
  1723. End Class
  1724.  
  1725. Public Class FacebookComboBox
  1726.     Inherits ComboBox
  1727.  
  1728. #Region "Declarations"
  1729.     Private _StartIndex As Integer = 0
  1730.     Private _BorderColour As Color = Color.FromArgb(73, 185, 213)
  1731.     Private _BaseColour As Color = Color.White
  1732.     Private _FontColour As Color = Color.FromArgb(50, 50, 50)
  1733. #End Region
  1734.  
  1735. #Region "Properties & Events"
  1736.  
  1737.     <Category("Colours")>
  1738.     Public Property BorderColour As Color
  1739.         Get
  1740.             Return _BorderColour
  1741.         End Get
  1742.         Set(value As Color)
  1743.             _BorderColour = value
  1744.         End Set
  1745.     End Property
  1746.  
  1747.     <Category("Colours")>
  1748.     Public Property BaseColour As Color
  1749.         Get
  1750.             Return _BaseColour
  1751.         End Get
  1752.         Set(value As Color)
  1753.             _BaseColour = value
  1754.         End Set
  1755.     End Property
  1756.  
  1757.     <Category("Colours")>
  1758.     Public Property FontColour As Color
  1759.         Get
  1760.             Return _FontColour
  1761.         End Get
  1762.         Set(value As Color)
  1763.             _FontColour = value
  1764.         End Set
  1765.     End Property
  1766.  
  1767.     Public Property StartIndex As Integer
  1768.         Get
  1769.             Return _StartIndex
  1770.         End Get
  1771.         Set(ByVal value As Integer)
  1772.             _StartIndex = value
  1773.             Try
  1774.                 MyBase.SelectedIndex = value
  1775.             Catch
  1776.             End Try
  1777.             Invalidate()
  1778.         End Set
  1779.     End Property
  1780.  
  1781.     Sub ReplaceItem(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles Me.DrawItem
  1782.         e.DrawBackground()
  1783.         e.Graphics.TextRenderingHint = TextRenderingHint.ClearTypeGridFit
  1784.         Dim Rect As New Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width + 1, e.Bounds.Height + 1)
  1785.         Try
  1786.             With e.Graphics
  1787.                 If (e.State And DrawItemState.Selected) = DrawItemState.Selected Then
  1788.                     .FillRectangle(Brushes.LightSteelBlue, Rect)
  1789.                     .DrawString(MyBase.GetItemText(MyBase.Items(e.Index)), Font, New SolidBrush(_FontColour), 1, e.Bounds.Top + 2)
  1790.                 Else
  1791.                     .FillRectangle(New SolidBrush(Color.White), Rect)
  1792.                     .DrawString(MyBase.GetItemText(MyBase.Items(e.Index)), Font, New SolidBrush(_FontColour), 1, e.Bounds.Top + 2)
  1793.                 End If
  1794.             End With
  1795.         Catch
  1796.         End Try
  1797.         e.DrawFocusRectangle()
  1798.         Me.Invalidate()
  1799.  
  1800.     End Sub
  1801.  
  1802.     Protected Overrides Sub OnTextChanged(e As System.EventArgs)
  1803.         MyBase.OnTextChanged(e)
  1804.         Invalidate()
  1805.     End Sub
  1806.  
  1807.     Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  1808.         MyBase.Invalidate()
  1809.         MyBase.OnMouseClick(e)
  1810.     End Sub
  1811.  
  1812.     Protected Overrides Sub OnMouseUp(e As System.Windows.Forms.MouseEventArgs)
  1813.         MyBase.Invalidate()
  1814.         MyBase.OnMouseUp(e)
  1815.     End Sub
  1816.  
  1817. #End Region
  1818.  
  1819. #Region "Draw Control"
  1820.  
  1821.     Sub New()
  1822.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or _
  1823.                ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer Or _
  1824.                ControlStyles.SupportsTransparentBackColor, True)
  1825.         DoubleBuffered = True
  1826.         BackColor = Color.Transparent
  1827.         DrawMode = Windows.Forms.DrawMode.OwnerDrawFixed
  1828.         DropDownStyle = ComboBoxStyle.DropDownList
  1829.         Me.Width = 163
  1830.         Font = New Font("Segoe UI", 10)
  1831.     End Sub
  1832.  
  1833.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  1834.         Dim B As New Bitmap(Width, Height)
  1835.         Dim G = Graphics.FromImage(B)
  1836.         With G
  1837.             .TextRenderingHint = TextRenderingHint.ClearTypeGridFit
  1838.             .SmoothingMode = SmoothingMode.HighQuality
  1839.             .PixelOffsetMode = PixelOffsetMode.HighQuality
  1840.             .Clear(BackColor)
  1841.             Try
  1842.                 Dim Square As New Rectangle(Width - 22, 0, Width, Height)
  1843.                 .FillRectangle(New SolidBrush(Color.FromArgb(237, 237, 237)), Square)
  1844.                 .FillRectangle(New SolidBrush(_BaseColour), New Rectangle(0, 0, Width - 22, Height))
  1845.                 .DrawLine(New Pen(_BorderColour), New Point(Width - 23, 0), New Point(Width - 23, Height))
  1846.                 Try
  1847.                     .DrawString(Text, Font, New SolidBrush(_FontColour), New Rectangle(3, 0, Width - 20, Height), New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Near})
  1848.                 Catch : End Try
  1849.                 .DrawLine(New Pen(_BorderColour), 0, 0, 0, 0)
  1850.                 .DrawRectangle(New Pen(_BorderColour), New Rectangle(0, 0, Width, Height))
  1851.                 Dim P() As Point = {New Point(Width - 18, 9), New Point(Width - 12, 18), New Point(Width - 6, 9)}
  1852.                 .FillPolygon(New SolidBrush(_BorderColour), P)
  1853.                 .DrawPolygon(New Pen(Color.Gainsboro), P)
  1854.             Catch
  1855.             End Try
  1856.         End With
  1857.         MyBase.OnPaint(e)
  1858.         G.Dispose()
  1859.         e.Graphics.InterpolationMode = 7
  1860.         e.Graphics.DrawImageUnscaled(B, 0, 0)
  1861.         B.Dispose()
  1862.     End Sub
  1863.  
  1864. #End Region
  1865.  
  1866.  
  1867. End Class
  1868.  
  1869. Public Class Facebook2ndProgressBar
  1870.     Inherits Control
  1871.  
  1872. #Region "Declarations"
  1873.     Private _ProgressColour As Color = Color.FromArgb(109, 131, 179)
  1874.     Private _GlowColour As Color = Color.FromArgb(73, 185, 213)
  1875.     Private _BorderColour As Color = Color.FromArgb(64, 89, 134)
  1876.     Private _BaseColour As Color = Color.FromArgb(237, 237, 237)
  1877.     Private _Value As Integer = 0
  1878.     Private _Maximum As Integer = 100
  1879. #End Region
  1880.  
  1881. #Region "Properties"
  1882.  
  1883.     <Category("Control")>
  1884.             Public Property Maximum() As Integer
  1885.         Get
  1886.             Return _Maximum
  1887.         End Get
  1888.         Set(V As Integer)
  1889.             Select Case V
  1890.                 Case Is < _Value
  1891.                     _Value = V
  1892.             End Select
  1893.             _Maximum = V
  1894.             Invalidate()
  1895.         End Set
  1896.     End Property
  1897.  
  1898.     <Category("Control")>
  1899.     Public Property Value() As Integer
  1900.         Get
  1901.             Select Case _Value
  1902.                 Case 0
  1903.                     Return 0
  1904.                     Invalidate()
  1905.                 Case Else
  1906.                     Return _Value
  1907.                     Invalidate()
  1908.             End Select
  1909.         End Get
  1910.         Set(V As Integer)
  1911.             Select Case V
  1912.                 Case Is > _Maximum
  1913.                     V = _Maximum
  1914.                     Invalidate()
  1915.             End Select
  1916.             _Value = V
  1917.             Invalidate()
  1918.         End Set
  1919.     End Property
  1920.  
  1921.     <Category("Colours")>
  1922.     Public Property ProgressColour As Color
  1923.         Get
  1924.             Return _ProgressColour
  1925.         End Get
  1926.         Set(value As Color)
  1927.             _ProgressColour = value
  1928.         End Set
  1929.     End Property
  1930.  
  1931.     <Category("Colours")>
  1932.     Public Property BaseColour As Color
  1933.         Get
  1934.             Return _BaseColour
  1935.         End Get
  1936.         Set(value As Color)
  1937.             _BaseColour = value
  1938.         End Set
  1939.     End Property
  1940.  
  1941.     <Category("Colours")>
  1942.     Public Property BorderColour As Color
  1943.         Get
  1944.             Return _BorderColour
  1945.         End Get
  1946.         Set(value As Color)
  1947.             _BorderColour = value
  1948.         End Set
  1949.     End Property
  1950.  
  1951.     <Category("Colours")>
  1952.     Public Property GlowColour As Color
  1953.         Get
  1954.             Return _GlowColour
  1955.         End Get
  1956.         Set(value As Color)
  1957.             _GlowColour = value
  1958.         End Set
  1959.     End Property
  1960. #End Region
  1961.  
  1962. #Region "Events"
  1963.  
  1964.     Protected Overrides Sub OnResize(e As EventArgs)
  1965.         MyBase.OnResize(e)
  1966.         Height = 10
  1967.     End Sub
  1968.  
  1969.     Protected Overrides Sub CreateHandle()
  1970.         MyBase.CreateHandle()
  1971.         Height = 10
  1972.     End Sub
  1973.  
  1974.     Public Sub Increment(ByVal Amount As Integer)
  1975.         Value += Amount
  1976.     End Sub
  1977.  
  1978. #End Region
  1979.  
  1980. #Region "Draw Control"
  1981.     Sub New()
  1982.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or _
  1983.                  ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer, True)
  1984.         DoubleBuffered = True
  1985.         BackColor = Color.FromArgb(60, 70, 73)
  1986.     End Sub
  1987.  
  1988.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  1989.         Dim B = New Bitmap(Width, Height)
  1990.         Dim G As Graphics = Graphics.FromImage(B)
  1991.         Dim Base As New Rectangle(0, 0, Width, Height)
  1992.         With G
  1993.             .SmoothingMode = SmoothingMode.HighQuality
  1994.             .PixelOffsetMode = PixelOffsetMode.HighQuality
  1995.             .Clear(BackColor)
  1996.             Dim ProgVal As Integer = CInt(_Value / _Maximum * Width)
  1997.             Select Case Value
  1998.                 Case 0
  1999.                     .FillRectangle(New SolidBrush(_BaseColour), Base)
  2000.                      .FillRectangle(New SolidBrush(_ProgressColour), New Rectangle(0, 0, ProgVal - 1, Height))
  2001.                     .DrawRectangle(New Pen(_BorderColour, 2), Base)
  2002.                       Case _Maximum
  2003.                     .FillRectangle(New SolidBrush(_BaseColour), Base)
  2004.                     .FillRectangle(New SolidBrush(_ProgressColour), New Rectangle(0, 0, ProgVal - 1, Height))
  2005.                     .DrawRectangle(New Pen(_BorderColour, 2), Base)
  2006.                    Case Else
  2007.                     .FillRectangle(New SolidBrush(_BaseColour), Base)
  2008.                     .FillRectangle(New SolidBrush(_ProgressColour), New Rectangle(0, 0, ProgVal - 1, Height))
  2009.                     .DrawRectangle(New Pen(_BorderColour, 2), Base)
  2010.                      End Select
  2011.         End With
  2012.         MyBase.OnPaint(e)
  2013.         G.Dispose()
  2014.         e.Graphics.InterpolationMode = 7
  2015.         e.Graphics.DrawImageUnscaled(B, 0, 0)
  2016.         B.Dispose()
  2017.     End Sub
  2018. #End Region
  2019.  
  2020. End Class
  2021.  
  2022. Public Class FacebookSeperator
  2023.     Inherits Control
  2024.  
  2025. #Region "Declarations"
  2026.     Private _SeperatorColour As Color = Color.FromArgb(14, 44, 109)
  2027.     Private _Alignment As Style = Style.Horizontal
  2028. #End Region
  2029.  
  2030. #Region "Properties"
  2031.  
  2032.     Enum Style
  2033.         Horizontal
  2034.         Verticle
  2035.     End Enum
  2036.     <Category("Control")>
  2037.     Public Property Alignment As Style
  2038.         Get
  2039.             Return _Alignment
  2040.         End Get
  2041.         Set(value As Style)
  2042.             _Alignment = value
  2043.         End Set
  2044.     End Property
  2045.  
  2046.     <Category("Colours")>
  2047.     Public Property SeperatorColour As Color
  2048.         Get
  2049.             Return _SeperatorColour
  2050.         End Get
  2051.         Set(value As Color)
  2052.             _SeperatorColour = value
  2053.         End Set
  2054.     End Property
  2055.  
  2056. #End Region
  2057.  
  2058. #Region "Draw Control"
  2059.     Sub New()
  2060.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or _
  2061.                  ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer Or _
  2062.                  ControlStyles.SupportsTransparentBackColor, True)
  2063.         DoubleBuffered = True
  2064.         BackColor = Color.Transparent
  2065.         Size = New Size(30, 30)
  2066.     End Sub
  2067.  
  2068.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  2069.         Dim B As New Bitmap(Width, Height)
  2070.         Dim G = Graphics.FromImage(B)
  2071.         Dim Base As New Rectangle(0, 0, Width - 1, Height - 1)
  2072.         With G
  2073.             .SmoothingMode = SmoothingMode.HighQuality
  2074.             .PixelOffsetMode = PixelOffsetMode.HighQuality
  2075.             Select Case _Alignment
  2076.                 Case Style.Horizontal
  2077.                     .DrawLine(New Pen(_SeperatorColour, 0.5), New Point(0, Height / 2), New Point(Width, Height / 2))
  2078.                 Case Style.Verticle
  2079.                     .DrawLine(New Pen(_SeperatorColour, 0.5), New Point(Width / 2, 0), New Point(Width / 2, Height))
  2080.             End Select
  2081.         End With
  2082.         MyBase.OnPaint(e)
  2083.         G.Dispose()
  2084.         e.Graphics.InterpolationMode = 7
  2085.         e.Graphics.DrawImageUnscaled(B, 0, 0)
  2086.         B.Dispose()
  2087.     End Sub
  2088. #End Region
  2089.  
  2090.  
  2091.  
  2092. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement