Advertisement
Finessed

iTalk Theme

Jan 4th, 2016
493
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 149.87 KB | None | 0 0
  1. #Region " Imports "
  2.  
  3. Imports System.Drawing.Drawing2D
  4. Imports System.ComponentModel
  5. Imports System.Runtime.InteropServices
  6. Imports System.Drawing.Text
  7.  
  8. #End Region
  9.  
  10. '|------DO-NOT-REMOVE------|
  11. ' Get more free themes at ThemesVB.NET
  12. ' Creator: HazelDev
  13. ' Site   : HazelDev.com
  14. ' Created: 23.Jul.2014
  15. ' Changed: 29.Sep.2014
  16. ' Version: 1.3.0
  17. '
  18. '|------DO-NOT-REMOVE------|
  19.  
  20. Namespace iTalk
  21.  
  22. #Region " RoundRect "
  23.  
  24.     ' [CREDIT][DO NOT REMOVE]
  25.     '
  26.     ' This module was written by Aeonhack
  27.     '
  28.     ' [CREDIT][DO NOT REMOVE]
  29.  
  30.     Module RoundRectangle
  31.         Public Function RoundRect(ByVal Rectangle As Rectangle, ByVal Curve As Integer) As GraphicsPath
  32.             Dim GP As GraphicsPath = New GraphicsPath()
  33.             Dim EndArcWidth As Integer = Curve * 2
  34.             GP.AddArc(New Rectangle(Rectangle.X, Rectangle.Y, EndArcWidth, EndArcWidth), -180, 90)
  35.             GP.AddArc(New Rectangle(Rectangle.Width - EndArcWidth + Rectangle.X, Rectangle.Y, EndArcWidth, EndArcWidth), -90, 90)
  36.             GP.AddArc(New Rectangle(Rectangle.Width - EndArcWidth + Rectangle.X, Rectangle.Height - EndArcWidth + Rectangle.Y, EndArcWidth, EndArcWidth), 0, 90)
  37.             GP.AddArc(New Rectangle(Rectangle.X, Rectangle.Height - EndArcWidth + Rectangle.Y, EndArcWidth, EndArcWidth), 90, 90)
  38.             GP.AddLine(New Point(Rectangle.X, Rectangle.Height - EndArcWidth + Rectangle.Y), New Point(Rectangle.X, Curve + Rectangle.Y))
  39.             Return GP
  40.         End Function
  41. ' Get more free themes at ThemesVB.NET
  42.         Public Function RoundRect(ByVal X As Integer, ByVal Y As Integer, ByVal Width As Integer, ByVal Height As Integer, ByVal Curve As Integer) As GraphicsPath
  43.             Dim Rectangle As Rectangle = New Rectangle(X, Y, Width, Height)
  44.             Dim GP As GraphicsPath = New GraphicsPath()
  45.             Dim EndArcWidth As Integer = Curve * 2
  46.             GP.AddArc(New Rectangle(Rectangle.X, Rectangle.Y, EndArcWidth, EndArcWidth), -180, 90)
  47.             GP.AddArc(New Rectangle(Rectangle.Width - EndArcWidth + Rectangle.X, Rectangle.Y, EndArcWidth, EndArcWidth), -90, 90)
  48.             GP.AddArc(New Rectangle(Rectangle.Width - EndArcWidth + Rectangle.X, Rectangle.Height - EndArcWidth + Rectangle.Y, EndArcWidth, EndArcWidth), 0, 90)
  49.             GP.AddArc(New Rectangle(Rectangle.X, Rectangle.Height - EndArcWidth + Rectangle.Y, EndArcWidth, EndArcWidth), 90, 90)
  50.             GP.AddLine(New Point(Rectangle.X, Rectangle.Height - EndArcWidth + Rectangle.Y), New Point(Rectangle.X, Curve + Rectangle.Y))
  51.             Return GP
  52.         End Function
  53.     End Module
  54.  
  55. #End Region
  56.  
  57. #Region " Control Renderer "
  58.  
  59. #Region " Color Table "
  60.  
  61.     Public MustInherit Class xColorTable
  62.         Public MustOverride ReadOnly Property TextColor As Color
  63.         Public MustOverride ReadOnly Property Background As Color
  64.         Public MustOverride ReadOnly Property SelectionBorder As Color
  65.         Public MustOverride ReadOnly Property SelectionTopGradient As Color
  66.         Public MustOverride ReadOnly Property SelectionMidGradient As Color
  67.         Public MustOverride ReadOnly Property SelectionBottomGradient As Color
  68.         Public MustOverride ReadOnly Property PressedBackground As Color
  69.         Public MustOverride ReadOnly Property CheckedBackground As Color
  70.         Public MustOverride ReadOnly Property CheckedSelectedBackground As Color
  71.         Public MustOverride ReadOnly Property DropdownBorder As Color
  72.         Public MustOverride ReadOnly Property Arrow As Color
  73.         Public MustOverride ReadOnly Property OverflowBackground As Color
  74.     End Class
  75. ' Get more free themes at ThemesVB.NET
  76.     Public MustInherit Class ColorTable
  77.         Public MustOverride ReadOnly Property CommonColorTable As xColorTable
  78.         Public MustOverride ReadOnly Property BackgroundTopGradient As Color
  79.         Public MustOverride ReadOnly Property BackgroundBottomGradient As Color
  80.         Public MustOverride ReadOnly Property DroppedDownItemBackground As Color
  81.         Public MustOverride ReadOnly Property DropdownTopGradient As Color
  82.         Public MustOverride ReadOnly Property DropdownBottomGradient As Color
  83.         Public MustOverride ReadOnly Property Separator As Color
  84.         Public MustOverride ReadOnly Property ImageMargin As Color
  85.     End Class
  86.  
  87.     Public Class MSColorTable
  88.         Inherits ColorTable
  89.  
  90.         Private _CommonColorTable As xColorTable
  91.  
  92.         Public Sub New()
  93.             _CommonColorTable = New DefaultCColorTable()
  94.         End Sub
  95.  
  96.         Public Overrides ReadOnly Property CommonColorTable As xColorTable
  97.             Get
  98.                 Return _CommonColorTable
  99.             End Get
  100.         End Property
  101.  
  102.         Public Overrides ReadOnly Property BackgroundTopGradient As System.Drawing.Color
  103.             Get
  104.                 Return Color.FromArgb(246, 246, 246)
  105.             End Get
  106.         End Property
  107.  
  108.         Public Overrides ReadOnly Property BackgroundBottomGradient As System.Drawing.Color
  109.             Get
  110.                 Return Color.FromArgb(226, 226, 226)
  111.             End Get
  112.         End Property
  113.  
  114.         Public Overrides ReadOnly Property DropdownTopGradient As System.Drawing.Color
  115.             Get
  116.                 Return Color.FromArgb(246, 246, 246)
  117.             End Get
  118.         End Property
  119.  
  120.         Public Overrides ReadOnly Property DropdownBottomGradient As System.Drawing.Color
  121.             Get
  122.                 Return Color.FromArgb(246, 246, 246)
  123.             End Get
  124.         End Property
  125.  
  126.         Public Overrides ReadOnly Property DroppedDownItemBackground As System.Drawing.Color
  127.             Get
  128.                 Return Color.FromArgb(240, 240, 240)
  129.             End Get
  130.         End Property
  131.  
  132.         Public Overrides ReadOnly Property Separator As System.Drawing.Color
  133.             Get
  134.                 Return Color.FromArgb(190, 195, 203)
  135.             End Get
  136.         End Property
  137.  
  138.         Public Overrides ReadOnly Property ImageMargin As System.Drawing.Color
  139.             Get
  140.                 Return Color.FromArgb(240, 240, 240)
  141.             End Get
  142.         End Property
  143.     End Class
  144.  
  145.     Public Class DefaultCColorTable
  146.         Inherits xColorTable
  147.  
  148.         Public Overrides ReadOnly Property CheckedBackground As System.Drawing.Color
  149.             Get
  150.                 Return Color.FromArgb(230, 230, 230)
  151.             End Get
  152.         End Property
  153.  
  154.         Public Overrides ReadOnly Property CheckedSelectedBackground As System.Drawing.Color
  155.             Get
  156.                 Return Color.FromArgb(230, 230, 230)
  157.             End Get
  158.         End Property
  159.  
  160.         Public Overrides ReadOnly Property SelectionBorder As System.Drawing.Color
  161.             Get
  162.                 Return Color.FromArgb(180, 180, 180)
  163.             End Get
  164.         End Property
  165.  
  166.         Public Overrides ReadOnly Property SelectionTopGradient As System.Drawing.Color
  167.             Get
  168.                 Return Color.FromArgb(240, 240, 240)
  169.             End Get
  170.         End Property
  171.  
  172.         Public Overrides ReadOnly Property SelectionMidGradient As System.Drawing.Color
  173.             Get
  174.                 Return Color.FromArgb(235, 235, 235)
  175.             End Get
  176.         End Property
  177.  
  178.         Public Overrides ReadOnly Property SelectionBottomGradient As System.Drawing.Color
  179.             Get
  180.                 Return Color.FromArgb(230, 230, 230)
  181.             End Get
  182.         End Property
  183.  
  184.         Public Overrides ReadOnly Property PressedBackground As System.Drawing.Color
  185.             Get
  186.                 Return Color.FromArgb(232, 232, 232)
  187.             End Get
  188.         End Property
  189.  
  190.         Public Overrides ReadOnly Property TextColor As System.Drawing.Color
  191.             Get
  192.                 Return Color.FromArgb(80, 80, 80)
  193.             End Get
  194.         End Property
  195.  
  196.         Public Overrides ReadOnly Property Background As System.Drawing.Color
  197.             Get
  198.                 Return Color.FromArgb(188, 199, 216)
  199.             End Get
  200.         End Property
  201.  
  202.         Public Overrides ReadOnly Property DropdownBorder As System.Drawing.Color
  203.             Get
  204.                 Return Color.LightGray
  205.             End Get
  206.         End Property
  207.  
  208.         Public Overrides ReadOnly Property Arrow As System.Drawing.Color
  209.             Get
  210.                 Return Color.Black
  211.             End Get
  212.         End Property
  213.  
  214.         Public Overrides ReadOnly Property OverflowBackground As System.Drawing.Color
  215.             Get
  216.                 Return Color.FromArgb(213, 220, 232)
  217.             End Get
  218.         End Property
  219.     End Class
  220.  
  221. #End Region
  222. #Region " Renderer "
  223.  
  224.     Public Class ControlRenderer
  225.         Inherits ToolStripProfessionalRenderer
  226.  
  227.         Public Sub New()
  228.             Me.New(New MSColorTable())
  229.         End Sub
  230.  
  231.         Public Sub New(ByVal ColorTable As ColorTable)
  232.             Me.ColorTable = ColorTable
  233.         End Sub
  234.  
  235.         Private _ColorTable As ColorTable
  236.         Public Overloads Property ColorTable() As ColorTable
  237.             Get
  238.                 If _ColorTable Is Nothing Then
  239.                     _ColorTable = New MSColorTable()
  240.                 End If
  241.                 Return _ColorTable
  242.             End Get
  243.             Set(ByVal value As ColorTable)
  244.                 _ColorTable = value
  245.             End Set
  246.         End Property
  247.  
  248.         Protected Overrides Sub OnRenderToolStripBackground(ByVal e As System.Windows.Forms.ToolStripRenderEventArgs)
  249.             MyBase.OnRenderToolStripBackground(e)
  250.  
  251.             ' Menu strip bar gradient
  252.             Using LGB As New LinearGradientBrush(e.AffectedBounds, Me.ColorTable.BackgroundTopGradient, Me.ColorTable.BackgroundBottomGradient, LinearGradientMode.Vertical)
  253.                 e.Graphics.FillRectangle(LGB, e.AffectedBounds)
  254.             End Using
  255.         End Sub
  256.  
  257.         Protected Overrides Sub OnRenderToolStripBorder(ByVal e As System.Windows.Forms.ToolStripRenderEventArgs)
  258.             If e.ToolStrip.Parent Is Nothing Then
  259.                 ' Draw border around the menu drop-down
  260.                 Dim Rect As New Rectangle(0, 0, e.ToolStrip.Width - 1, e.ToolStrip.Height - 1)
  261.                 Using P1 As New Pen(Me.ColorTable.CommonColorTable.DropdownBorder)
  262.                     e.Graphics.DrawRectangle(P1, Rect)
  263.                 End Using
  264.  
  265.                 ' Fill the gap between menu drop-down and owner item
  266.                 Using B1 As New SolidBrush(Me.ColorTable.DroppedDownItemBackground)
  267.                     e.Graphics.FillRectangle(B1, e.ConnectedArea)
  268.                 End Using
  269.             End If
  270.         End Sub
  271.  
  272.         Protected Overrides Sub OnRenderMenuItemBackground(ByVal e As System.Windows.Forms.ToolStripItemRenderEventArgs)
  273.             If e.Item.Enabled Then
  274.                 If e.Item.Selected Then
  275.                     If Not e.Item.IsOnDropDown Then
  276.                         Dim SelRect As New Rectangle(0, 0, e.Item.Width - 1, e.Item.Height - 1)
  277.                         RectDrawing.DrawSelection(e.Graphics, Me.ColorTable.CommonColorTable, SelRect)
  278.                     Else
  279.                         Dim SelRect As New Rectangle(2, 0, e.Item.Width - 4, e.Item.Height - 1)
  280.                         RectDrawing.DrawSelection(e.Graphics, Me.ColorTable.CommonColorTable, SelRect)
  281.                     End If
  282.                 End If
  283.  
  284.                 If CType(e.Item, ToolStripMenuItem).DropDown.Visible AndAlso Not e.Item.IsOnDropDown Then
  285.                     Dim BorderRect As New Rectangle(0, 0, e.Item.Width - 1, e.Item.Height)
  286.                     ' Fill the background
  287.                     Dim BackgroundRect As New Rectangle(1, 1, e.Item.Width - 2, e.Item.Height + 2)
  288.                     Using B1 As New SolidBrush(Me.ColorTable.DroppedDownItemBackground)
  289.                         e.Graphics.FillRectangle(B1, BackgroundRect)
  290.                     End Using
  291.  
  292.                     ' Draw border
  293.                     Using P1 As New Pen(Me.ColorTable.CommonColorTable.DropdownBorder)
  294.                         RectDrawing.DrawRoundedRectangle(e.Graphics, P1, BorderRect.X, BorderRect.Y, BorderRect.Width, BorderRect.Height, 2)
  295.                     End Using
  296.                 End If
  297.                 e.Item.ForeColor = Me.ColorTable.CommonColorTable.TextColor
  298.             End If
  299.         End Sub
  300.  
  301.         Protected Overrides Sub OnRenderItemText(ByVal e As System.Windows.Forms.ToolStripItemTextRenderEventArgs)
  302.             e.TextColor = Me.ColorTable.CommonColorTable.TextColor
  303.             MyBase.OnRenderItemText(e)
  304.         End Sub
  305.  
  306.         Protected Overrides Sub OnRenderItemCheck(ByVal e As System.Windows.Forms.ToolStripItemImageRenderEventArgs)
  307.             MyBase.OnRenderItemCheck(e)
  308.  
  309.             Dim rect As New Rectangle(3, 1, e.Item.Height - 3, e.Item.Height - 3)
  310.             Dim c As Color
  311.  
  312.             If e.Item.Selected Then
  313.                 c = Me.ColorTable.CommonColorTable.CheckedSelectedBackground
  314.             Else
  315.                 c = Me.ColorTable.CommonColorTable.CheckedBackground
  316.             End If
  317.  
  318.             Using b As New SolidBrush(c)
  319.                 e.Graphics.FillRectangle(b, rect)
  320.             End Using
  321.  
  322.             Using p As New Pen(Me.ColorTable.CommonColorTable.SelectionBorder)
  323.                 e.Graphics.DrawRectangle(p, rect)
  324.             End Using
  325.  
  326.             e.Graphics.DrawString("ΓΌ", New Font("Wingdings", 13, FontStyle.Regular), Brushes.Black, New Point(4, 2))
  327.         End Sub
  328.  
  329.         Protected Overrides Sub OnRenderSeparator(ByVal e As System.Windows.Forms.ToolStripSeparatorRenderEventArgs)
  330.             MyBase.OnRenderSeparator(e)
  331.             Dim PT1 As Integer = 28
  332.             Dim PT2 As Integer = e.Item.Width
  333.             Dim Y As Integer = 3
  334.             Using P1 As New Pen(Me.ColorTable.Separator)
  335.                 e.Graphics.DrawLine(P1, PT1, Y, PT2, Y)
  336.             End Using
  337.         End Sub
  338.  
  339.         Protected Overrides Sub OnRenderImageMargin(ByVal e As System.Windows.Forms.ToolStripRenderEventArgs)
  340.             MyBase.OnRenderImageMargin(e)
  341.  
  342.             Dim BackgroundRect As New Rectangle(0, -1, e.ToolStrip.Width, e.ToolStrip.Height + 1)
  343.             Using LGB As New LinearGradientBrush(BackgroundRect,
  344.                                                Me.ColorTable.DropdownTopGradient,
  345.                                                Me.ColorTable.DropdownBottomGradient,
  346.                                                LinearGradientMode.Vertical)
  347.                 e.Graphics.FillRectangle(LGB, BackgroundRect)
  348.             End Using
  349.  
  350.             Using B1 As New SolidBrush(Me.ColorTable.ImageMargin)
  351.                 e.Graphics.FillRectangle(B1, e.AffectedBounds)
  352.             End Using
  353.         End Sub
  354.  
  355.         Protected Overrides Sub OnRenderButtonBackground(ByVal e As System.Windows.Forms.ToolStripItemRenderEventArgs)
  356.             Dim rect As New Rectangle(0, 0, e.Item.Width - 1, e.Item.Height - 1)
  357.             Dim checked As Boolean = CType(e.Item, ToolStripButton).Checked
  358.             Dim drawBorder As Boolean = False
  359.  
  360.             If checked Then
  361.                 drawBorder = True
  362.  
  363.                 If e.Item.Selected AndAlso Not e.Item.Pressed Then
  364.                     Using b As New SolidBrush(Me.ColorTable.CommonColorTable.CheckedSelectedBackground)
  365.                         e.Graphics.FillRectangle(b, rect)
  366.                     End Using
  367.                 Else
  368.                     Using b As New SolidBrush(Me.ColorTable.CommonColorTable.CheckedBackground)
  369.                         e.Graphics.FillRectangle(b, rect)
  370.                     End Using
  371.                 End If
  372.  
  373.             Else
  374.  
  375.                 If e.Item.Pressed Then
  376.                     drawBorder = True
  377.                     Using b As New SolidBrush(Me.ColorTable.CommonColorTable.PressedBackground)
  378.                         e.Graphics.FillRectangle(b, rect)
  379.                     End Using
  380.                 ElseIf e.Item.Selected Then
  381.                     drawBorder = True
  382.                     RectDrawing.DrawSelection(e.Graphics, Me.ColorTable.CommonColorTable, rect)
  383.                 End If
  384.  
  385.             End If
  386.  
  387.             If drawBorder Then
  388.                 Using p As New Pen(Me.ColorTable.CommonColorTable.SelectionBorder)
  389.                     e.Graphics.DrawRectangle(p, rect)
  390.                 End Using
  391.             End If
  392.         End Sub
  393.  
  394.         Protected Overrides Sub OnRenderDropDownButtonBackground(ByVal e As System.Windows.Forms.ToolStripItemRenderEventArgs)
  395.             Dim rect As New Rectangle(0, 0, e.Item.Width - 1, e.Item.Height - 1)
  396.             Dim drawBorder As Boolean = False
  397.  
  398.             If e.Item.Pressed Then
  399.                 drawBorder = True
  400.                 Using b As New SolidBrush(Me.ColorTable.CommonColorTable.PressedBackground)
  401.                     e.Graphics.FillRectangle(b, rect)
  402.                 End Using
  403.             ElseIf e.Item.Selected Then
  404.                 drawBorder = True
  405.                 RectDrawing.DrawSelection(e.Graphics, Me.ColorTable.CommonColorTable, rect)
  406.             End If
  407.  
  408.             If drawBorder Then
  409.                 Using p As New Pen(Me.ColorTable.CommonColorTable.SelectionBorder)
  410.                     e.Graphics.DrawRectangle(p, rect)
  411.                 End Using
  412.             End If
  413.         End Sub
  414.  
  415.         Protected Overrides Sub OnRenderSplitButtonBackground(ByVal e As System.Windows.Forms.ToolStripItemRenderEventArgs)
  416.             MyBase.OnRenderSplitButtonBackground(e)
  417.  
  418.             Dim drawBorder As Boolean = False
  419.             Dim drawSeparator As Boolean = True
  420.  
  421.             Dim item = DirectCast(e.Item, ToolStripSplitButton)
  422.  
  423.             Dim btnRect As New Rectangle(0, 0, item.ButtonBounds.Width - 1, item.ButtonBounds.Height - 1)
  424.             Dim borderRect As New Rectangle(0, 0, item.Bounds.Width - 1, item.Bounds.Height - 1)
  425.  
  426.             If item.DropDownButtonPressed Then
  427.                 drawBorder = True
  428.                 drawSeparator = False
  429.                 Using b As New SolidBrush(Me.ColorTable.CommonColorTable.PressedBackground)
  430.                     e.Graphics.FillRectangle(b, borderRect)
  431.                 End Using
  432.             ElseIf item.DropDownButtonSelected Then
  433.                 drawBorder = True
  434.                 RectDrawing.DrawSelection(e.Graphics, Me.ColorTable.CommonColorTable, borderRect)
  435.             End If
  436.  
  437.             If item.ButtonPressed Then
  438.                 Using b As New SolidBrush(Me.ColorTable.CommonColorTable.PressedBackground)
  439.                     e.Graphics.FillRectangle(b, btnRect)
  440.                 End Using
  441.             End If
  442.  
  443.             If drawBorder Then
  444.                 Using p As New Pen(Me.ColorTable.CommonColorTable.SelectionBorder)
  445.                     e.Graphics.DrawRectangle(p, borderRect)
  446.                     If drawSeparator Then e.Graphics.DrawRectangle(p, btnRect)
  447.                 End Using
  448.  
  449.                 Me.DrawCustomArrow(e.Graphics, item)
  450.             End If
  451.         End Sub
  452.  
  453.         Private Sub DrawCustomArrow(ByVal g As Graphics, ByVal item As ToolStripSplitButton)
  454.             Dim dropWidth As Integer = item.DropDownButtonBounds.Width - 1
  455.             Dim dropHeight As Integer = item.DropDownButtonBounds.Height - 1
  456.             Dim triangleWidth As Single = dropWidth / 2.0F + 1
  457.             Dim triangleLeft As Single = item.DropDownButtonBounds.Left + (dropWidth - triangleWidth) / 2.0F
  458.             Dim triangleHeight As Single = triangleWidth / 2.0F
  459.             Dim triangleTop As Single = item.DropDownButtonBounds.Top + (dropHeight - triangleHeight) / 2.0F + 1
  460.             Dim arrowRect As New RectangleF(triangleLeft, triangleTop, triangleWidth, triangleHeight)
  461.  
  462.             Me.DrawCustomArrow(g, item, Rectangle.Round(arrowRect))
  463.         End Sub
  464.  
  465.         Private Sub DrawCustomArrow(ByVal g As Graphics, ByVal item As ToolStripItem, ByVal rect As Rectangle)
  466.             Dim arrowEventArgs As New ToolStripArrowRenderEventArgs(g, _
  467.                                                         item, _
  468.                                                         rect, _
  469.                                                         Me.ColorTable.CommonColorTable.Arrow, _
  470.                                                         ArrowDirection.Down)
  471.             MyBase.OnRenderArrow(arrowEventArgs)
  472.         End Sub
  473.  
  474.         Protected Overrides Sub OnRenderOverflowButtonBackground(ByVal e As System.Windows.Forms.ToolStripItemRenderEventArgs)
  475.             Dim rect, rectEnd As Rectangle
  476.             rect = New Rectangle(0, 0, e.Item.Width - 1, e.Item.Height - 2)
  477.             rectEnd = New Rectangle(rect.X - 5, rect.Y, rect.Width - 5, rect.Height)
  478.  
  479.             If e.Item.Pressed Then
  480.                 Using b As New SolidBrush(Me.ColorTable.CommonColorTable.PressedBackground)
  481.                     e.Graphics.FillRectangle(b, rect)
  482.                 End Using
  483.             ElseIf e.Item.Selected Then
  484.                 RectDrawing.DrawSelection(e.Graphics, Me.ColorTable.CommonColorTable, rect)
  485.             Else
  486.                 Using b As New SolidBrush(Me.ColorTable.CommonColorTable.OverflowBackground)
  487.                     e.Graphics.FillRectangle(b, rect)
  488.                 End Using
  489.             End If
  490.  
  491.             Using P1 As New Pen(Me.ColorTable.CommonColorTable.Background)
  492.                 RectDrawing.DrawRoundedRectangle(e.Graphics, P1, rectEnd.X, rectEnd.Y, rectEnd.Width, rectEnd.Height, 3)
  493.             End Using
  494.  
  495.             ' Icon
  496.             Dim w As Integer = rect.Width - 1
  497.             Dim h As Integer = rect.Height - 1
  498.             Dim triangleWidth As Single = w / 2.0F + 1
  499.             Dim triangleLeft As Single = rect.Left + (w - triangleWidth) / 2.0F + 3
  500.             Dim triangleHeight As Single = triangleWidth / 2.0F
  501.             Dim triangleTop As Single = rect.Top + (h - triangleHeight) / 2.0F + 7
  502.             Dim arrowRect As New RectangleF(triangleLeft, triangleTop, triangleWidth, triangleHeight)
  503.             Me.DrawCustomArrow(e.Graphics, e.Item, Rectangle.Round(arrowRect))
  504.  
  505.             Using p As New Pen(Me.ColorTable.CommonColorTable.Arrow)
  506.                 e.Graphics.DrawLine(p, triangleLeft + 2, triangleTop - 2, triangleLeft + triangleWidth - 2, triangleTop - 2)
  507.             End Using
  508.         End Sub
  509.     End Class
  510.  
  511. #End Region
  512. #Region " Drawing "
  513.  
  514.     Public Class RectDrawing
  515.  
  516.         Public Shared Sub DrawSelection(ByVal G As Graphics, _
  517.                                         ByVal ColorTable As xColorTable, _
  518.                                         ByVal Rect As Rectangle)
  519.             Dim TopRect As Rectangle
  520.             Dim BottomRect As Rectangle
  521.             Dim FillRect As New Rectangle(Rect.X + 1, Rect.Y + 1, Rect.Width - 1, Rect.Height - 1)
  522.  
  523.             TopRect = FillRect
  524.             TopRect.Height -= CInt(TopRect.Height / 2)
  525.             BottomRect = New Rectangle(TopRect.X, TopRect.Bottom, TopRect.Width, FillRect.Height - TopRect.Height)
  526.  
  527.             ' Top gradient
  528.             Using LGB As New LinearGradientBrush(TopRect, ColorTable.SelectionTopGradient, ColorTable.SelectionMidGradient, LinearGradientMode.Vertical)
  529.                 G.FillRectangle(LGB, TopRect)
  530.             End Using
  531.  
  532.             ' Bottom
  533.             Using B1 As New SolidBrush(ColorTable.SelectionBottomGradient)
  534.                 G.FillRectangle(B1, BottomRect)
  535.             End Using
  536.  
  537.             ' Border
  538.             Using P1 As New Pen(ColorTable.SelectionBorder)
  539.                 RectDrawing.DrawRoundedRectangle(G, P1, Rect.X, Rect.Y, Rect.Width, Rect.Height, 2)
  540.             End Using
  541.         End Sub
  542.  
  543.         Public Shared Sub DrawRoundedRectangle(ByVal G As Graphics, _
  544.                                         ByVal P As Pen, _
  545.                                         ByVal X As Single, _
  546.                                         ByVal Y As Single, _
  547.                                         ByVal W As Single, _
  548.                                         ByVal H As Single, _
  549.                                         ByVal Rad As Single)
  550.  
  551.             Using gp As New GraphicsPath()
  552.                 gp.AddLine(X + Rad, Y, X + W - (Rad * 2), Y)
  553.                 gp.AddArc(X + W - (Rad * 2), Y, Rad * 2, Rad * 2, 270, 90)
  554.                 gp.AddLine(X + W, Y + Rad, X + W, Y + H - (Rad * 2))
  555.                 gp.AddArc(X + W - (Rad * 2), Y + H - (Rad * 2), Rad * 2, Rad * 2, 0, 90)
  556.                 gp.AddLine(X + W - (Rad * 2), Y + H, X + Rad, Y + H)
  557.                 gp.AddArc(X, Y + H - (Rad * 2), Rad * 2, Rad * 2, 90, 90)
  558.                 gp.AddLine(X, Y + H - (Rad * 2), X, Y + Rad)
  559.                 gp.AddArc(X, Y, Rad * 2, Rad * 2, 180, 90)
  560.                 gp.CloseFigure()
  561.  
  562.                 G.SmoothingMode = SmoothingMode.AntiAlias
  563.                 G.DrawPath(P, gp)
  564.                 G.SmoothingMode = SmoothingMode.Default
  565.             End Using
  566.         End Sub
  567.     End Class
  568.  
  569. #End Region
  570.  
  571. #End Region
  572. #Region " ThemeContainer "
  573.  
  574.     Public Class iTalk_ThemeContainer
  575.         Inherits ContainerControl
  576.  
  577.  
  578. #Region " Variables "
  579.  
  580.         Private MouseP As Point = New Point(0, 0)
  581.         Private Cap As Boolean = False
  582.         Private MoveHeight As Integer
  583.         Private _TextBottom As String = Nothing
  584.         Const BorderCurve As Integer = 7
  585.         Protected State As MouseState
  586.         Private HasShown As Boolean
  587.         Private HeaderRect As Rectangle
  588.  
  589. #End Region
  590. #Region " Enums "
  591.  
  592.         Enum MouseState As Byte
  593.             None = 0
  594.             Over = 1
  595.             Down = 2
  596.         End Enum
  597.  
  598. #End Region
  599. #Region " Properties "
  600.  
  601.         Private _Sizable As Boolean = True
  602.         Property Sizable() As Boolean
  603.             Get
  604.                 Return _Sizable
  605.             End Get
  606.             Set(ByVal value As Boolean)
  607.                 _Sizable = value
  608.             End Set
  609.         End Property
  610.  
  611.         Private _SmartBounds As Boolean = False
  612.         Property SmartBounds() As Boolean
  613.             Get
  614.                 Return _SmartBounds
  615.             End Get
  616.             Set(ByVal value As Boolean)
  617.                 _SmartBounds = value
  618.             End Set
  619.         End Property
  620.  
  621.         Private _IsParentForm As Boolean
  622.         Protected ReadOnly Property IsParentForm As Boolean
  623.             Get
  624.                 Return _IsParentForm
  625.             End Get
  626.         End Property
  627.  
  628.         Protected ReadOnly Property IsParentMdi As Boolean
  629.             Get
  630.                 If Parent Is Nothing Then Return False
  631.                 Return Parent.Parent IsNot Nothing
  632.             End Get
  633.         End Property
  634.  
  635.         Private _ControlMode As Boolean
  636.         Protected Property ControlMode() As Boolean
  637.             Get
  638.                 Return _ControlMode
  639.             End Get
  640.             Set(ByVal v As Boolean)
  641.                 _ControlMode = v
  642.                 Invalidate()
  643.             End Set
  644.         End Property
  645.  
  646.         Private _StartPosition As FormStartPosition
  647.         Property StartPosition As FormStartPosition
  648.             Get
  649.                 If _IsParentForm AndAlso Not _ControlMode Then Return ParentForm.StartPosition Else Return _StartPosition
  650.             End Get
  651.             Set(ByVal value As FormStartPosition)
  652.                 _StartPosition = value
  653.  
  654.                 If _IsParentForm AndAlso Not _ControlMode Then
  655.                     ParentForm.StartPosition = value
  656.                 End If
  657.             End Set
  658.         End Property
  659.  
  660. #End Region
  661. #Region " EventArgs "
  662.  
  663.         Protected NotOverridable Overrides Sub OnParentChanged(ByVal e As EventArgs)
  664.             MyBase.OnParentChanged(e)
  665.  
  666.             If Parent Is Nothing Then Return
  667.             _IsParentForm = TypeOf Parent Is Form
  668.  
  669.             If Not _ControlMode Then
  670.                 InitializeMessages()
  671.  
  672.                 If _IsParentForm Then
  673.                     Me.ParentForm.FormBorderStyle = FormBorderStyle.None
  674.                     Me.ParentForm.TransparencyKey = Color.Fuchsia
  675.  
  676.                     If Not DesignMode Then
  677.                         AddHandler ParentForm.Shown, AddressOf FormShown
  678.                     End If
  679.                 End If
  680.                 Parent.BackColor = BackColor
  681.                 Parent.MinimumSize = New Size(126, 39)
  682.             End If
  683.         End Sub
  684.  
  685.         Protected NotOverridable Overrides Sub OnSizeChanged(ByVal e As EventArgs)
  686.             MyBase.OnSizeChanged(e)
  687.             If Not _ControlMode Then HeaderRect = New Rectangle(0, 0, Width - 14, MoveHeight - 7)
  688.             Invalidate()
  689.         End Sub
  690.  
  691.         Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  692.             MyBase.OnMouseDown(e)
  693.             If e.Button = Windows.Forms.MouseButtons.Left Then SetState(MouseState.Down)
  694.             If Not (_IsParentForm AndAlso ParentForm.WindowState = FormWindowState.Maximized OrElse _ControlMode) Then
  695.                 If HeaderRect.Contains(e.Location) Then
  696.                     Capture = False
  697.                     WM_LMBUTTONDOWN = True
  698.                     DefWndProc(Messages(0))
  699.                 ElseIf _Sizable AndAlso Not Previous = 0 Then
  700.                     Capture = False
  701.                     WM_LMBUTTONDOWN = True
  702.                     DefWndProc(Messages(Previous))
  703.                 End If
  704.             End If
  705.         End Sub
  706.  
  707.         Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
  708.             MyBase.OnMouseUp(e)
  709.             Cap = False
  710.         End Sub
  711.  
  712.         Protected Overrides Sub OnMouseMove(ByVal e As System.Windows.Forms.MouseEventArgs)
  713.             MyBase.OnMouseMove(e)
  714.             If Not (_IsParentForm AndAlso ParentForm.WindowState = FormWindowState.Maximized) Then
  715.                 If _Sizable AndAlso Not _ControlMode Then InvalidateMouse()
  716.             End If
  717.             If Cap Then
  718.                 Parent.Location = MousePosition - MouseP
  719.             End If
  720.         End Sub
  721.  
  722.         Protected Overrides Sub OnInvalidated(ByVal e As System.Windows.Forms.InvalidateEventArgs)
  723.             MyBase.OnInvalidated(e)
  724.             ParentForm.Text = Text
  725.         End Sub
  726.  
  727.         Protected Overrides Sub OnPaintBackground(e As PaintEventArgs)
  728.             MyBase.OnPaintBackground(e)
  729.         End Sub
  730.  
  731.         Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
  732.             MyBase.OnTextChanged(e)
  733.             Invalidate()
  734.         End Sub
  735.  
  736.         Private Sub FormShown(ByVal sender As Object, ByVal e As EventArgs)
  737.             If _ControlMode OrElse HasShown Then Return
  738.  
  739.             If _StartPosition = FormStartPosition.CenterParent OrElse _StartPosition = FormStartPosition.CenterScreen Then
  740.                 Dim SB As Rectangle = Screen.PrimaryScreen.Bounds
  741.                 Dim CB As Rectangle = ParentForm.Bounds
  742.                 ParentForm.Location = New Point(SB.Width \ 2 - CB.Width \ 2, SB.Height \ 2 - CB.Width \ 2)
  743.             End If
  744.             HasShown = True
  745.         End Sub
  746.  
  747. #End Region
  748. #Region " Mouse & Size "
  749.  
  750.         Private Sub SetState(ByVal current As MouseState)
  751.             State = current
  752.             Invalidate()
  753.         End Sub
  754.  
  755.         Private GetIndexPoint As Point
  756.         Private B1x, B2x, B3, B4 As Boolean
  757.         Private Function GetIndex() As Integer
  758.             GetIndexPoint = PointToClient(MousePosition)
  759.             B1x = GetIndexPoint.X < 7
  760.             B2x = GetIndexPoint.X > Width - 7
  761.             B3 = GetIndexPoint.Y < 7
  762.             B4 = GetIndexPoint.Y > Height - 7
  763.  
  764.             If B1x AndAlso B3 Then Return 4
  765.             If B1x AndAlso B4 Then Return 7
  766.             If B2x AndAlso B3 Then Return 5
  767.             If B2x AndAlso B4 Then Return 8
  768.             If B1x Then Return 1
  769.             If B2x Then Return 2
  770.             If B3 Then Return 3
  771.             If B4 Then Return 6
  772.             Return 0
  773.         End Function
  774.  
  775.         Private Current, Previous As Integer
  776.         Private Sub InvalidateMouse()
  777.             Current = GetIndex()
  778.             If Current = Previous Then Return
  779.  
  780.             Previous = Current
  781.             Select Case Previous
  782.                 Case 0
  783.                     Cursor = Cursors.Default
  784.                 Case 6
  785.                     Cursor = Cursors.SizeNS
  786.                 Case 8
  787.                     Cursor = Cursors.SizeNWSE
  788.                 Case 7
  789.                     Cursor = Cursors.SizeNESW
  790.             End Select
  791.         End Sub
  792.  
  793.         Private Messages(8) As Message
  794.         Private Sub InitializeMessages()
  795.             Messages(0) = Message.Create(Parent.Handle, 161, New IntPtr(2), IntPtr.Zero)
  796.             For I As Integer = 1 To 8
  797.                 Messages(I) = Message.Create(Parent.Handle, 161, New IntPtr(I + 9), IntPtr.Zero)
  798.             Next
  799.         End Sub
  800.  
  801.         Private Sub CorrectBounds(ByVal bounds As Rectangle)
  802.             If Parent.Width > bounds.Width Then Parent.Width = bounds.Width
  803.             If Parent.Height > bounds.Height Then Parent.Height = bounds.Height
  804.  
  805.             Dim X As Integer = Parent.Location.X
  806.             Dim Y As Integer = Parent.Location.Y
  807.  
  808.             If X < bounds.X Then X = bounds.X
  809.             If Y < bounds.Y Then Y = bounds.Y
  810.  
  811.             Dim Width As Integer = bounds.X + bounds.Width
  812.             Dim Height As Integer = bounds.Y + bounds.Height
  813.  
  814.             If X + Parent.Width > Width Then X = Width - Parent.Width
  815.             If Y + Parent.Height > Height Then Y = Height - Parent.Height
  816.  
  817.             Parent.Location = New Point(X, Y)
  818.         End Sub
  819.  
  820.         Private WM_LMBUTTONDOWN As Boolean
  821.         Protected Overrides Sub WndProc(ByRef m As Message)
  822.             MyBase.WndProc(m)
  823.  
  824.             If WM_LMBUTTONDOWN AndAlso m.Msg = 513 Then
  825.                 WM_LMBUTTONDOWN = False
  826.  
  827.                 SetState(MouseState.Over)
  828.                 If Not _SmartBounds Then Return
  829.  
  830.                 If IsParentMdi Then
  831.                     CorrectBounds(New Rectangle(Point.Empty, Parent.Parent.Size))
  832.                 Else
  833.                     CorrectBounds(Screen.FromControl(Parent).WorkingArea)
  834.                 End If
  835.             End If
  836.         End Sub
  837.  
  838. #End Region
  839.  
  840.         Protected Overrides Sub OnCreateControl()
  841.             MyBase.OnCreateControl()
  842.             Me.ParentForm.FormBorderStyle = FormBorderStyle.None
  843.             Me.ParentForm.TransparencyKey = Color.Fuchsia
  844.         End Sub
  845.  
  846.         Protected Overrides Sub CreateHandle()
  847.             MyBase.CreateHandle()
  848.         End Sub
  849.  
  850.         Sub New()
  851.             MyBase.New()
  852.             SetStyle(DirectCast(139270, ControlStyles), True)
  853.             Dock = DockStyle.Fill
  854.             MoveHeight = 25
  855.             Padding = New Padding(3, 28, 3, 28)
  856.             Font = New Font("Segoe UI", 8, FontStyle.Regular)
  857.             ForeColor = Color.FromArgb(142, 142, 142)
  858.             BackColor = Color.FromArgb(246, 246, 246)
  859.             DoubleBuffered = True
  860.         End Sub
  861.  
  862.         Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  863.             MyBase.OnPaint(e)
  864.  
  865.             Dim B As New Bitmap(Width, Height)
  866.             Dim G As Graphics = Graphics.FromImage(B)
  867.             Dim ClientRectangle As New Rectangle(0, 0, Width - 1, Height - 1)
  868.             Dim TransparencyKey As Color = Me.ParentForm.TransparencyKey
  869.  
  870.             G.SmoothingMode = SmoothingMode.Default
  871.             G.Clear(TransparencyKey)
  872.  
  873.             ' Draw the container borders
  874.             G.FillPath(New SolidBrush(Color.FromArgb(52, 52, 52)), RoundRectangle.RoundRect(ClientRectangle, BorderCurve))
  875.             ' Draw a rectangle in which the controls should be added on
  876.             G.FillPath(New SolidBrush(Color.FromArgb(246, 246, 246)), RoundRectangle.RoundRect(New Rectangle(2, 20, Width - 5, Height - 42), BorderCurve))
  877.  
  878.             ' Patch the header with a rectangle that has a curve so its border will remain within container bounds
  879.             G.FillPath(New SolidBrush(Color.FromArgb(52, 52, 52)), RoundRectangle.RoundRect(New Rectangle(2, 2, Width / 2 + 2, 16), BorderCurve))
  880.             G.FillPath(New SolidBrush(Color.FromArgb(52, 52, 52)), RoundRectangle.RoundRect(New Rectangle(Width / 2 - 3, 2, Width / 2, 16), BorderCurve))
  881.             ' Fill the header rectangle below the patch
  882.             G.FillRectangle(New SolidBrush(Color.FromArgb(52, 52, 52)), New Rectangle(2, 15, Width - 5, 10))
  883.  
  884.             ' Increase the thickness of the container borders
  885.             G.DrawPath(New Pen(Color.FromArgb(52, 52, 52)), RoundRectangle.RoundRect(New Rectangle(2, 2, Width - 5, Height - 5), BorderCurve))
  886.             G.DrawPath(New Pen(Color.FromArgb(52, 52, 52)), RoundRectangle.RoundRect(ClientRectangle, BorderCurve))
  887.  
  888.             ' Draw the string from the specified 'Text' property on the header rectangle
  889.             G.DrawString(Text, New Font("Trebuchet MS", 10, FontStyle.Bold), New SolidBrush(Color.FromArgb(221, 221, 221)), New Rectangle(BorderCurve, BorderCurve - 4, Width - 1, 22), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Near})
  890.  
  891.  
  892.             ' Draws a rectangle at the bottom of the container
  893.             G.FillRectangle(New SolidBrush(Color.FromArgb(52, 52, 52)), 0, Height - 25, Width - 3, 22 - 2)
  894.             G.DrawLine(New Pen(Color.FromArgb(52, 52, 52)), 5, Height - 5, Width - 6, Height - 5)
  895.             G.DrawLine(New Pen(Color.FromArgb(52, 52, 52)), 7, Height - 4, Width - 7, Height - 4)
  896.  
  897.             G.DrawString(_TextBottom, New Font("Trebuchet MS", 10, FontStyle.Bold), New SolidBrush(Color.FromArgb(221, 221, 221)), 5, Height - 23)
  898.  
  899.             e.Graphics.DrawImage(B.Clone(), 0, 0)
  900.             G.Dispose()
  901.             B.Dispose()
  902.         End Sub
  903.     End Class
  904.  
  905. #End Region
  906. #Region " ControlBox "
  907.  
  908.     Public Class iTalk_ControlBox
  909.         Inherits Control
  910.  
  911. #Region " Enums "
  912.  
  913.         Enum MouseState As Byte
  914.             None = 0
  915.             Over = 1
  916.             Down = 2
  917.             Block = 3
  918.         End Enum
  919.  
  920. #End Region
  921. #Region " Variables "
  922.  
  923.         Dim State As MouseState = MouseState.None
  924.         Dim i As Integer
  925.         Dim CloseRect As New Rectangle(28, 0, 47, 18)
  926.         Dim MinimizeRect As New Rectangle(0, 0, 28, 18)
  927.  
  928. #End Region
  929. #Region " EventArgs "
  930.  
  931.         Protected Overrides Sub OnMouseClick(e As MouseEventArgs)
  932.             MyBase.OnMouseClick(e)
  933.  
  934.             If i > 0 And i < 28 Then
  935.                 FindForm.WindowState = FormWindowState.Minimized
  936.             ElseIf i > 30 And i < 75 Then
  937.                 FindForm.Close()
  938.             End If
  939.  
  940.             State = MouseState.Down
  941.         End Sub
  942.  
  943.         Protected Overrides Sub OnMouseEnter(ByVal e As System.EventArgs)
  944.             MyBase.OnMouseEnter(e)
  945.             State = MouseState.Over
  946.             Invalidate()
  947.         End Sub
  948.  
  949.         Protected Overrides Sub OnMouseLeave(ByVal e As System.EventArgs)
  950.             MyBase.OnMouseLeave(e)
  951.             State = MouseState.None
  952.             Invalidate()
  953.         End Sub
  954.  
  955.         Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
  956.             MyBase.OnMouseUp(e)
  957.             State = MouseState.Over
  958.             Invalidate()
  959.         End Sub
  960.  
  961.         Protected Overrides Sub OnMouseMove(ByVal e As System.Windows.Forms.MouseEventArgs)
  962.             MyBase.OnMouseMove(e)
  963.             i = e.Location.X
  964.             Invalidate()
  965.         End Sub
  966.  
  967.         Protected Overrides Sub OnResize(e As EventArgs)
  968.             MyBase.OnResize(e)
  969.             Width = 77
  970.             Height = 19
  971.         End Sub
  972.  
  973. #End Region
  974.  
  975.         Sub New()
  976.             SetStyle(ControlStyles.SupportsTransparentBackColor Or ControlStyles.UserPaint, True)
  977.             BackColor = Color.Transparent
  978.             DoubleBuffered = True
  979.             Anchor = AnchorStyles.Top Or AnchorStyles.Right
  980.         End Sub
  981.         Protected Overrides Sub OnCreateControl()
  982.             MyBase.OnCreateControl()
  983.             Location = New Point(FindForm.Width - 81, -1) ' Auto-decide control location on the theme container
  984.         End Sub
  985.  
  986.         Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  987.             MyBase.OnPaint(e)
  988.  
  989.             Dim B As New Bitmap(Width, Height)
  990.             Dim G As Graphics = Graphics.FromImage(B)
  991.             Dim GP_MinimizeRect As New GraphicsPath
  992.             Dim GP_CloseRect As New GraphicsPath
  993.  
  994.             GP_MinimizeRect.AddRectangle(MinimizeRect)
  995.             GP_CloseRect.AddRectangle(CloseRect)
  996.             G.Clear(BackColor)
  997.  
  998.             Select Case State
  999.                 Case MouseState.None
  1000. NonePoint:          Dim MinimizeGradient As New LinearGradientBrush(MinimizeRect, Color.FromArgb(73, 73, 73), Color.FromArgb(58, 58, 58), 90S)
  1001.                     G.FillPath(MinimizeGradient, GP_MinimizeRect)
  1002.                     G.DrawPath(New Pen(Color.FromArgb(40, 40, 40)), GP_MinimizeRect)
  1003.                     G.DrawString("0", New Font("Marlett", 11, FontStyle.Regular), New SolidBrush(Color.FromArgb(221, 221, 221)), MinimizeRect.Width - 22, MinimizeRect.Height - 16)
  1004.  
  1005.                     Dim CloseGradient As New LinearGradientBrush(CloseRect, Color.FromArgb(73, 73, 73), Color.FromArgb(58, 58, 58), 90S)
  1006.                     G.FillPath(CloseGradient, GP_CloseRect)
  1007.                     G.DrawPath(New Pen(Color.FromArgb(40, 40, 40)), GP_CloseRect)
  1008.                     G.DrawString("r", New Font("Marlett", 11, FontStyle.Regular), New SolidBrush(Color.FromArgb(221, 221, 221)), CloseRect.Width - 4, CloseRect.Height - 16)
  1009.                 Case MouseState.Over
  1010.                     If i > 0 And i < 28 Then
  1011.                         Dim MinimizeGradient As New LinearGradientBrush(MinimizeRect, Color.FromArgb(76, 76, 76, 76), Color.FromArgb(48, 48, 48), 90S)
  1012.                         G.FillPath(MinimizeGradient, GP_MinimizeRect)
  1013.                         G.DrawPath(New Pen(Color.FromArgb(40, 40, 40)), GP_MinimizeRect)
  1014.                         G.DrawString("0", New Font("Marlett", 11, FontStyle.Regular), New SolidBrush(Color.FromArgb(221, 221, 221)), MinimizeRect.Width - 22, MinimizeRect.Height - 16)
  1015.  
  1016.                         Dim CloseGradient As New LinearGradientBrush(CloseRect, Color.FromArgb(73, 73, 73), Color.FromArgb(58, 58, 58), 90S)
  1017.                         G.FillPath(CloseGradient, GP_CloseRect)
  1018.                         G.DrawPath(New Pen(Color.FromArgb(40, 40, 40)), GP_CloseRect)
  1019.                         G.DrawString("r", New Font("Marlett", 11, FontStyle.Regular), New SolidBrush(Color.FromArgb(221, 221, 221)), CloseRect.Width - 4, CloseRect.Height - 16)
  1020.                     ElseIf i > 30 And i < 75 Then
  1021.                         Dim CloseGradient As New LinearGradientBrush(CloseRect, Color.FromArgb(76, 76, 76, 76), Color.FromArgb(48, 48, 48), 90S)
  1022.                         G.FillPath(CloseGradient, GP_CloseRect)
  1023.                         G.DrawPath(New Pen(Color.FromArgb(40, 40, 40)), GP_CloseRect)
  1024.                         G.DrawString("r", New Font("Marlett", 11, FontStyle.Regular), New SolidBrush(Color.FromArgb(221, 221, 221)), CloseRect.Width - 4, CloseRect.Height - 16)
  1025.  
  1026.                         Dim MinimizeGradient As New LinearGradientBrush(MinimizeRect, Color.FromArgb(73, 73, 73), Color.FromArgb(58, 58, 58), 90S)
  1027.                         G.FillPath(MinimizeGradient, RoundRectangle.RoundRect(MinimizeRect, 1))
  1028.                         G.DrawPath(New Pen(Color.FromArgb(40, 40, 40)), GP_MinimizeRect)
  1029.                         G.DrawString("0", New Font("Marlett", 11, FontStyle.Regular), New SolidBrush(Color.FromArgb(221, 221, 221)), MinimizeRect.Width - 22, MinimizeRect.Height - 16)
  1030.                     Else
  1031.                         GoTo NonePoint ' Return to [MouseState = None]
  1032.                     End If
  1033.             End Select
  1034.  
  1035.             e.Graphics.DrawImage(B.Clone(), 0, 0)
  1036.             G.Dispose()
  1037.             GP_CloseRect.Dispose()
  1038.             GP_MinimizeRect.Dispose()
  1039.             B.Dispose()
  1040.         End Sub
  1041.     End Class
  1042.  
  1043. #End Region
  1044. #Region " Button 1 "
  1045.  
  1046.     Class iTalk_Button_1
  1047.         Inherits Control
  1048.  
  1049. #Region " Variables "
  1050.  
  1051.         Private MouseState As Integer
  1052.         Private Shape As GraphicsPath
  1053.         Private InactiveGB, PressedGB, PressedContourGB As LinearGradientBrush
  1054.         Private R1 As Rectangle
  1055.         Private P1, P3 As Pen
  1056.         Private _Image As Image
  1057.         Private _ImageSize As Size
  1058.         Private _TextAlignment As StringAlignment = StringAlignment.Center
  1059.         Private _TextColor As Color = Color.FromArgb(150, 150, 150)
  1060.         Private _ImageAlign As ContentAlignment = ContentAlignment.MiddleLeft
  1061.  
  1062. #End Region
  1063. #Region " Image Designer "
  1064.  
  1065.         Private Shared Function ImageLocation(ByVal SF As StringFormat, ByVal Area As SizeF, ByVal ImageArea As SizeF) As PointF
  1066.             Dim MyPoint As PointF
  1067.             Select Case SF.Alignment
  1068.                 Case StringAlignment.Center
  1069.                     MyPoint.X = CSng((Area.Width - ImageArea.Width) / 2)
  1070.                 Case StringAlignment.Near
  1071.                     MyPoint.X = 2
  1072.                 Case StringAlignment.Far
  1073.                     MyPoint.X = Area.Width - ImageArea.Width - 2
  1074.  
  1075.             End Select
  1076.  
  1077.             Select Case SF.LineAlignment
  1078.                 Case StringAlignment.Center
  1079.                     MyPoint.Y = CSng((Area.Height - ImageArea.Height) / 2)
  1080.                 Case StringAlignment.Near
  1081.                     MyPoint.Y = 2
  1082.                 Case StringAlignment.Far
  1083.                     MyPoint.Y = Area.Height - ImageArea.Height - 2
  1084.             End Select
  1085.             Return MyPoint
  1086.         End Function
  1087.  
  1088.         Private Function GetStringFormat(ByVal _ContentAlignment As ContentAlignment) As StringFormat
  1089.             Dim SF As StringFormat = New StringFormat()
  1090.             Select Case _ContentAlignment
  1091.                 Case ContentAlignment.MiddleCenter
  1092.                     SF.LineAlignment = StringAlignment.Center
  1093.                     SF.Alignment = StringAlignment.Center
  1094.                 Case ContentAlignment.MiddleLeft
  1095.                     SF.LineAlignment = StringAlignment.Center
  1096.                     SF.Alignment = StringAlignment.Near
  1097.                 Case ContentAlignment.MiddleRight
  1098.                     SF.LineAlignment = StringAlignment.Center
  1099.                     SF.Alignment = StringAlignment.Far
  1100.                 Case ContentAlignment.TopCenter
  1101.                     SF.LineAlignment = StringAlignment.Near
  1102.                     SF.Alignment = StringAlignment.Center
  1103.                 Case ContentAlignment.TopLeft
  1104.                     SF.LineAlignment = StringAlignment.Near
  1105.                     SF.Alignment = StringAlignment.Near
  1106.                 Case ContentAlignment.TopRight
  1107.                     SF.LineAlignment = StringAlignment.Near
  1108.                     SF.Alignment = StringAlignment.Far
  1109.                 Case ContentAlignment.BottomCenter
  1110.                     SF.LineAlignment = StringAlignment.Far
  1111.                     SF.Alignment = StringAlignment.Center
  1112.                 Case ContentAlignment.BottomLeft
  1113.                     SF.LineAlignment = StringAlignment.Far
  1114.                     SF.Alignment = StringAlignment.Near
  1115.                 Case ContentAlignment.BottomRight
  1116.                     SF.LineAlignment = StringAlignment.Far
  1117.                     SF.Alignment = StringAlignment.Far
  1118.             End Select
  1119.             Return SF
  1120.         End Function
  1121.  
  1122. #End Region
  1123. #Region " Properties "
  1124.  
  1125.         Property Image() As Image
  1126.             Get
  1127.                 Return _Image
  1128.             End Get
  1129.             Set(ByVal value As Image)
  1130.                 If value Is Nothing Then
  1131.                     _ImageSize = Size.Empty
  1132.                 Else
  1133.                     _ImageSize = value.Size
  1134.                 End If
  1135.  
  1136.                 _Image = value
  1137.                 Invalidate()
  1138.             End Set
  1139.         End Property
  1140.  
  1141.         Protected ReadOnly Property ImageSize() As Size
  1142.             Get
  1143.                 Return _ImageSize
  1144.             End Get
  1145.         End Property
  1146.  
  1147.         Public Property ImageAlign() As ContentAlignment
  1148.             Get
  1149.                 Return _ImageAlign
  1150.             End Get
  1151.             Set(ByVal Value As ContentAlignment)
  1152.                 _ImageAlign = Value
  1153.                 Invalidate()
  1154.             End Set
  1155.         End Property
  1156.  
  1157.         Public Property TextAlignment As StringAlignment
  1158.             Get
  1159.                 Return Me._TextAlignment
  1160.             End Get
  1161.             Set(ByVal value As StringAlignment)
  1162.                 Me._TextAlignment = value
  1163.                 Me.Invalidate()
  1164.             End Set
  1165.         End Property
  1166.  
  1167.         Public Overrides Property ForeColor As Color
  1168.             Get
  1169.                 Return Me._TextColor
  1170.             End Get
  1171.             Set(ByVal value As Color)
  1172.                 Me._TextColor = value
  1173.                 Me.Invalidate()
  1174.             End Set
  1175.         End Property
  1176.  
  1177. #End Region
  1178. #Region " EventArgs "
  1179.  
  1180.         Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  1181.             MouseState = 0
  1182.             Invalidate()
  1183.             MyBase.OnMouseUp(e)
  1184.         End Sub
  1185.         Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  1186.             MouseState = 1
  1187.             Invalidate()
  1188.             MyBase.OnMouseDown(e)
  1189.         End Sub
  1190.  
  1191.         Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
  1192.             MouseState = 0
  1193.             Invalidate()
  1194.             MyBase.OnMouseLeave(e)
  1195.         End Sub
  1196.  
  1197.         Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
  1198.             Invalidate()
  1199.             MyBase.OnTextChanged(e)
  1200.         End Sub
  1201.  
  1202. #End Region
  1203.  
  1204.         Sub New()
  1205.             SetStyle(ControlStyles.AllPaintingInWmPaint Or _
  1206.                      ControlStyles.OptimizedDoubleBuffer Or _
  1207.                      ControlStyles.ResizeRedraw Or _
  1208.                      ControlStyles.SupportsTransparentBackColor Or _
  1209.                      ControlStyles.UserPaint, True)
  1210.  
  1211.             BackColor = Color.Transparent
  1212.             DoubleBuffered = True
  1213.             Font = New Font("Segoe UI", 12)
  1214.             ForeColor = Color.FromArgb(150, 150, 150)
  1215.             Size = New Size(166, 40)
  1216.             _TextAlignment = StringAlignment.Center
  1217.             P1 = New Pen(Color.FromArgb(190, 190, 190)) ' P1 = Border color
  1218.         End Sub
  1219.  
  1220.         Protected Overrides Sub OnResize(ByVal e As System.EventArgs)
  1221.             If Width > 0 AndAlso Height > 0 Then
  1222.  
  1223.                 Shape = New GraphicsPath
  1224.                 R1 = New Rectangle(0, 0, Width, Height)
  1225.  
  1226.                 InactiveGB = New LinearGradientBrush(New Rectangle(0, 0, Width, Height), Color.FromArgb(251, 251, 251), Color.FromArgb(225, 225, 225), 90.0F)
  1227.                 PressedGB = New LinearGradientBrush(New Rectangle(0, 0, Width, Height), Color.FromArgb(235, 235, 235), Color.FromArgb(223, 223, 223), 90.0F)
  1228.                 PressedContourGB = New LinearGradientBrush(New Rectangle(0, 0, Width, Height), Color.FromArgb(167, 167, 167), Color.FromArgb(167, 167, 167), 90.0F)
  1229.  
  1230.                 P3 = New Pen(PressedContourGB)
  1231.             End If
  1232.  
  1233.             With Shape
  1234.                 .AddArc(0, 0, 10, 10, 180, 90)
  1235.                 .AddArc(Width - 11, 0, 10, 10, -90, 90)
  1236.                 .AddArc(Width - 11, Height - 11, 10, 10, 0, 90)
  1237.                 .AddArc(0, Height - 11, 10, 10, 90, 90)
  1238.                 .CloseAllFigures()
  1239.             End With
  1240.  
  1241.             Invalidate()
  1242.             MyBase.OnResize(e)
  1243.         End Sub
  1244.  
  1245.         Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  1246.             With e.Graphics
  1247.                 .SmoothingMode = SmoothingMode.HighQuality
  1248.                 Dim ipt As PointF = ImageLocation(GetStringFormat(ImageAlign), Size, ImageSize)
  1249.  
  1250.                 Select Case MouseState
  1251.                     Case 0 'Inactive
  1252.                         .FillPath(InactiveGB, Shape) ' Fill button body with InactiveGB color gradient
  1253.                         .DrawPath(P1, Shape) ' Draw button border [InactiveGB]
  1254.                         If IsNothing(Image) Then
  1255.                             ' If an image is not specified, only draw the string on the button
  1256.                             .DrawString(Text, Font, New SolidBrush(ForeColor), R1, New StringFormat() With {.Alignment = _TextAlignment, .LineAlignment = StringAlignment.Center})
  1257.                         Else
  1258.                             ' If an image is specified, the image and draw the string on the button
  1259.                             .DrawImage(_Image, ipt.X, ipt.Y, ImageSize.Width, ImageSize.Height)
  1260.                             .DrawString(Text, Font, New SolidBrush(ForeColor), R1, New StringFormat() With {.Alignment = _TextAlignment, .LineAlignment = StringAlignment.Center})
  1261.                         End If
  1262.                     Case 1 'Pressed
  1263.                         .FillPath(PressedGB, Shape) ' Fill button body with PressedGB color gradient
  1264.                         .DrawPath(P3, Shape) ' Draw button border [PressedGB]
  1265.  
  1266.                         If IsNothing(Image) Then
  1267.                             ' If an image is not specified, only draw the string on the button
  1268.                             .DrawString(Text, Font, New SolidBrush(ForeColor), R1, New StringFormat() With {.Alignment = _TextAlignment, .LineAlignment = StringAlignment.Center})
  1269.                         Else
  1270.                             ' If an image is specified, the image and draw the string on the button
  1271.                             .DrawImage(_Image, ipt.X, ipt.Y, ImageSize.Width, ImageSize.Height)
  1272.                             .DrawString(Text, Font, New SolidBrush(ForeColor), R1, New StringFormat() With {.Alignment = _TextAlignment, .LineAlignment = StringAlignment.Center})
  1273.                         End If
  1274.                 End Select
  1275.             End With
  1276.             MyBase.OnPaint(e)
  1277.         End Sub
  1278.     End Class
  1279.  
  1280. #End Region
  1281. #Region " Button 2 "
  1282.  
  1283.     Class iTalk_Button_2
  1284.         Inherits Control
  1285.  
  1286. #Region " Variables "
  1287.  
  1288.         Private MouseState As Integer
  1289.         Private Shape As GraphicsPath
  1290.         Private InactiveGB, PressedGB, PressedContourGB As LinearGradientBrush
  1291.         Private R1 As Rectangle
  1292.         Private P1, P3 As Pen
  1293.         Private _Image As Image
  1294.         Private _ImageSize As Size
  1295.         Private _TextAlignment As StringAlignment = StringAlignment.Center
  1296.         Private _ImageAlign As ContentAlignment = ContentAlignment.MiddleLeft
  1297.  
  1298. #End Region
  1299. #Region " Image Designer "
  1300.  
  1301.         Private Shared Function ImageLocation(ByVal SF As StringFormat, ByVal Area As SizeF, ByVal ImageArea As SizeF) As PointF
  1302.             Dim MyPoint As PointF
  1303.             Select Case SF.Alignment
  1304.                 Case StringAlignment.Center
  1305.                     MyPoint.X = CSng((Area.Width - ImageArea.Width) / 2)
  1306.                 Case StringAlignment.Near
  1307.                     MyPoint.X = 2
  1308.                 Case StringAlignment.Far
  1309.                     MyPoint.X = Area.Width - ImageArea.Width - 2
  1310.             End Select
  1311.  
  1312.             Select Case SF.LineAlignment
  1313.                 Case StringAlignment.Center
  1314.                     MyPoint.Y = CSng((Area.Height - ImageArea.Height) / 2)
  1315.                 Case StringAlignment.Near
  1316.                     MyPoint.Y = 2
  1317.                 Case StringAlignment.Far
  1318.                     MyPoint.Y = Area.Height - ImageArea.Height - 2
  1319.             End Select
  1320.             Return MyPoint
  1321.         End Function
  1322.  
  1323.         Private Function GetStringFormat(ByVal _ContentAlignment As ContentAlignment) As StringFormat
  1324.             Dim SF As StringFormat = New StringFormat()
  1325.             Select Case _ContentAlignment
  1326.                 Case ContentAlignment.MiddleCenter
  1327.                     SF.LineAlignment = StringAlignment.Center
  1328.                     SF.Alignment = StringAlignment.Center
  1329.                 Case ContentAlignment.MiddleLeft
  1330.                     SF.LineAlignment = StringAlignment.Center
  1331.                     SF.Alignment = StringAlignment.Near
  1332.                 Case ContentAlignment.MiddleRight
  1333.                     SF.LineAlignment = StringAlignment.Center
  1334.                     SF.Alignment = StringAlignment.Far
  1335.                 Case ContentAlignment.TopCenter
  1336.                     SF.LineAlignment = StringAlignment.Near
  1337.                     SF.Alignment = StringAlignment.Center
  1338.                 Case ContentAlignment.TopLeft
  1339.                     SF.LineAlignment = StringAlignment.Near
  1340.                     SF.Alignment = StringAlignment.Near
  1341.                 Case ContentAlignment.TopRight
  1342.                     SF.LineAlignment = StringAlignment.Near
  1343.                     SF.Alignment = StringAlignment.Far
  1344.                 Case ContentAlignment.BottomCenter
  1345.                     SF.LineAlignment = StringAlignment.Far
  1346.                     SF.Alignment = StringAlignment.Center
  1347.                 Case ContentAlignment.BottomLeft
  1348.                     SF.LineAlignment = StringAlignment.Far
  1349.                     SF.Alignment = StringAlignment.Near
  1350.                 Case ContentAlignment.BottomRight
  1351.                     SF.LineAlignment = StringAlignment.Far
  1352.                     SF.Alignment = StringAlignment.Far
  1353.             End Select
  1354.             Return SF
  1355.         End Function
  1356.  
  1357. #End Region
  1358. #Region " Properties "
  1359.  
  1360.         Property Image() As Image
  1361.             Get
  1362.                 Return _Image
  1363.             End Get
  1364.             Set(ByVal value As Image)
  1365.                 If value Is Nothing Then
  1366.                     _ImageSize = Size.Empty
  1367.                 Else
  1368.                     _ImageSize = value.Size
  1369.                 End If
  1370.  
  1371.                 _Image = value
  1372.                 Invalidate()
  1373.             End Set
  1374.         End Property
  1375.  
  1376.         Public Property TextAlignment As StringAlignment
  1377.             Get
  1378.                 Return Me._TextAlignment
  1379.             End Get
  1380.             Set(ByVal value As StringAlignment)
  1381.                 Me._TextAlignment = value
  1382.                 Me.Invalidate()
  1383.             End Set
  1384.         End Property
  1385.  
  1386.         Protected ReadOnly Property ImageSize() As Size
  1387.             Get
  1388.                 Return _ImageSize
  1389.             End Get
  1390.         End Property
  1391.  
  1392.         Public Property ImageAlign() As ContentAlignment
  1393.             Get
  1394.                 Return _ImageAlign
  1395.             End Get
  1396.             Set(ByVal Value As ContentAlignment)
  1397.                 _ImageAlign = Value
  1398.                 Invalidate()
  1399.             End Set
  1400.         End Property
  1401.  
  1402. #End Region
  1403. #Region "  EventArgs "
  1404.  
  1405.         Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  1406.             MouseState = 0
  1407.             Invalidate()
  1408.             MyBase.OnMouseUp(e)
  1409.         End Sub
  1410.         Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  1411.             MouseState = 1
  1412.             Invalidate()
  1413.             MyBase.OnMouseDown(e)
  1414.         End Sub
  1415.  
  1416.         Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
  1417.             MouseState = 0
  1418.             Invalidate()
  1419.             MyBase.OnMouseLeave(e)
  1420.         End Sub
  1421.  
  1422.         Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
  1423.             Invalidate()
  1424.             MyBase.OnTextChanged(e)
  1425.         End Sub
  1426.  
  1427. #End Region
  1428.  
  1429.         Sub New()
  1430.             SetStyle(ControlStyles.AllPaintingInWmPaint Or _
  1431.                      ControlStyles.OptimizedDoubleBuffer Or _
  1432.                      ControlStyles.ResizeRedraw Or _
  1433.                      ControlStyles.SupportsTransparentBackColor Or _
  1434.                      ControlStyles.UserPaint, True)
  1435.  
  1436.             BackColor = Color.Transparent
  1437.             DoubleBuffered = True
  1438.             Font = New Font("Segoe UI", 14)
  1439.             ForeColor = Color.White
  1440.             Size = New Size(166, 40)
  1441.             _TextAlignment = StringAlignment.Center
  1442.             P1 = New Pen(Color.FromArgb(0, 118, 176)) ' P1 = Border color
  1443.         End Sub
  1444.  
  1445.         Protected Overrides Sub OnResize(ByVal e As System.EventArgs)
  1446.             If Width > 0 AndAlso Height > 0 Then
  1447.  
  1448.                 Shape = New GraphicsPath
  1449.                 R1 = New Rectangle(0, 0, Width, Height)
  1450.  
  1451.                 InactiveGB = New LinearGradientBrush(New Rectangle(0, 0, Width, Height), Color.FromArgb(0, 176, 231), Color.FromArgb(0, 152, 224), 90.0F)
  1452.                 PressedGB = New LinearGradientBrush(New Rectangle(0, 0, Width, Height), Color.FromArgb(0, 118, 176), Color.FromArgb(0, 149, 222), 90.0F)
  1453.                 PressedContourGB = New LinearGradientBrush(New Rectangle(0, 0, Width, Height), Color.FromArgb(0, 118, 176), Color.FromArgb(0, 118, 176), 90.0F)
  1454.  
  1455.                 P3 = New Pen(PressedContourGB)
  1456.             End If
  1457.  
  1458.             With Shape
  1459.                 .AddArc(0, 0, 10, 10, 180, 90)
  1460.                 .AddArc(Width - 11, 0, 10, 10, -90, 90)
  1461.                 .AddArc(Width - 11, Height - 11, 10, 10, 0, 90)
  1462.                 .AddArc(0, Height - 11, 10, 10, 90, 90)
  1463.                 .CloseAllFigures()
  1464.             End With
  1465.  
  1466.             Invalidate()
  1467.             MyBase.OnResize(e)
  1468.         End Sub
  1469.  
  1470.         Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  1471.             With e.Graphics
  1472.                 .SmoothingMode = SmoothingMode.HighQuality
  1473.  
  1474.                 Dim ipt As PointF = ImageLocation(GetStringFormat(ImageAlign), Size, ImageSize)
  1475.  
  1476.                 Select Case MouseState
  1477.                     Case 0 'Inactive
  1478.                         .FillPath(InactiveGB, Shape) ' Fill button body with InactiveGB color gradient
  1479.                         .DrawPath(P1, Shape) ' Draw button border [InactiveGB]
  1480.                         If IsNothing(Image) Then
  1481.                             ' If an image is not specified, only draw the string on the button
  1482.                             .DrawString(Text, Font, New SolidBrush(ForeColor), R1, New StringFormat() With {.Alignment = _TextAlignment, .LineAlignment = StringAlignment.Center})
  1483.                         Else
  1484.                             ' If an image is specified, the image and draw the string on the button
  1485.                             .DrawImage(_Image, ipt.X, ipt.Y, ImageSize.Width, ImageSize.Height)
  1486.                             .DrawString(Text, Font, New SolidBrush(ForeColor), R1, New StringFormat() With {.Alignment = _TextAlignment, .LineAlignment = StringAlignment.Center})
  1487.                         End If
  1488.                     Case 1 'Pressed
  1489.                         .FillPath(PressedGB, Shape) ' Fill button body with PressedGB color gradient
  1490.                         .DrawPath(P3, Shape) ' Draw button border [PressedGB]
  1491.                         If IsNothing(Image) Then
  1492.                             ' If an image is not specified, only draw the string on the button
  1493.                             .DrawString(Text, Font, New SolidBrush(ForeColor), R1, New StringFormat() With {.Alignment = _TextAlignment, .LineAlignment = StringAlignment.Center})
  1494.                         Else
  1495.                             ' If an image is specified, the image and draw the string on the button
  1496.                             .DrawImage(_Image, ipt.X, ipt.Y, ImageSize.Width, ImageSize.Height)
  1497.                             .DrawString(Text, Font, New SolidBrush(ForeColor), R1, New StringFormat() With {.Alignment = _TextAlignment, .LineAlignment = StringAlignment.Center})
  1498.                         End If
  1499.                 End Select
  1500.             End With
  1501.             MyBase.OnPaint(e)
  1502.         End Sub
  1503.     End Class
  1504.  
  1505. #End Region
  1506. #Region " Toggle Button "
  1507.  
  1508.     <DefaultEvent("ToggledChanged")> Class iTalk_Toggle
  1509.         Inherits Control
  1510.  
  1511. #Region " Designer "
  1512.  
  1513.         '|------DO-NOT-REMOVE------|
  1514.         '|---------CREDITS---------|
  1515.  
  1516.         ' Pill class and functions were originally created by Tedd
  1517.         ' Last edited by Tedd on: 12/20/2013
  1518.         ' Modified by HazelDev on: 1/4/2014
  1519.  
  1520.         '|---------CREDITS---------|
  1521.         '|------DO-NOT-REMOVE------|
  1522.  
  1523.         Class PillStyle
  1524.             Public Left As Boolean
  1525.             Public Right As Boolean
  1526.         End Class
  1527.  
  1528.         Public Function Pill(ByVal Rectangle As Rectangle, ByVal PillStyle As PillStyle) As GraphicsPath
  1529.             Pill = New GraphicsPath()
  1530.  
  1531.             If PillStyle.Left Then
  1532.                 Pill.AddArc(New Rectangle(Rectangle.X, Rectangle.Y, Rectangle.Height, Rectangle.Height), -270, 180)
  1533.             Else
  1534.                 Pill.AddLine(Rectangle.X, Rectangle.Y + Rectangle.Height, Rectangle.X, Rectangle.Y)
  1535.             End If
  1536.  
  1537.             If PillStyle.Right Then
  1538.                 Pill.AddArc(New Rectangle(Rectangle.X + Rectangle.Width - Rectangle.Height, Rectangle.Y, Rectangle.Height, Rectangle.Height), -90, 180)
  1539.             Else
  1540.                 Pill.AddLine(Rectangle.X + Rectangle.Width, Rectangle.Y, Rectangle.X + Rectangle.Width, Rectangle.Y + Rectangle.Height)
  1541.             End If
  1542.             Pill.CloseAllFigures()
  1543.             Return Pill
  1544.         End Function
  1545.  
  1546.         Public Function Pill(ByVal X As Integer, ByVal Y As Integer, ByVal Width As Integer, ByVal Height As Integer, ByVal PillStyle As PillStyle)
  1547.             Return Pill(New Rectangle(X, Y, Width, Height), PillStyle)
  1548.         End Function
  1549.  
  1550. #End Region
  1551. #Region " Enums "
  1552.  
  1553.         Enum _Type
  1554.             YesNo
  1555.             OnOff
  1556.             IO
  1557.         End Enum
  1558.  
  1559. #End Region
  1560. #Region " Variables "
  1561.  
  1562.         Private WithEvents AnimationTimer As Timer = New Timer With {.Interval = 1}
  1563.         Private ToggleLocation As Integer = 0
  1564.         Event ToggledChanged()
  1565.         Private _Toggled As Boolean
  1566.         Private ToggleType As _Type
  1567.         Private Bar As Rectangle
  1568.         Private cHandle As Size = New Size(15, 20)
  1569.  
  1570. #End Region
  1571. #Region " Properties "
  1572.  
  1573.         Public Property Toggled() As Boolean
  1574.             Get
  1575.                 Return _Toggled
  1576.             End Get
  1577.             Set(ByVal value As Boolean)
  1578.                 _Toggled = value
  1579.                 Invalidate()
  1580.                 RaiseEvent ToggledChanged()
  1581.             End Set
  1582.         End Property
  1583.  
  1584.         Public Property Type As _Type
  1585.             Get
  1586.                 Return ToggleType
  1587.             End Get
  1588.             Set(value As _Type)
  1589.                 ToggleType = value
  1590.                 Invalidate()
  1591.             End Set
  1592.         End Property
  1593.  
  1594. #End Region
  1595. #Region " EventArgs "
  1596.  
  1597.         Protected Overrides Sub OnResize(e As EventArgs)
  1598.             MyBase.OnResize(e)
  1599.             Width = 41
  1600.             Height = 23
  1601.         End Sub
  1602.  
  1603.         Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
  1604.             MyBase.OnMouseUp(e)
  1605.             Toggled = Not Toggled
  1606.         End Sub
  1607.  
  1608. #End Region
  1609.  
  1610.         Sub New()
  1611.             SetStyle(ControlStyles.AllPaintingInWmPaint Or _
  1612.                       ControlStyles.DoubleBuffer Or _
  1613.                       ControlStyles.ResizeRedraw Or _
  1614.                       ControlStyles.UserPaint, True)
  1615.         End Sub
  1616.         Protected Overrides Sub OnHandleCreated(e As EventArgs)
  1617.             MyBase.OnHandleCreated(e)
  1618.             AnimationTimer.Start() ' activate the animation timer
  1619.         End Sub
  1620.  
  1621.         Private Sub Animation() Handles AnimationTimer.Tick
  1622.             ' Create a slide animation when toggled on/off
  1623.             If _Toggled = True Then
  1624.                 If ToggleLocation < 100 Then
  1625.                     ToggleLocation += 10
  1626.                     Me.Invalidate(False)
  1627.                 End If
  1628.             Else
  1629.                 If ToggleLocation > 0 Then
  1630.                     ToggleLocation -= 10
  1631.                     Me.Invalidate(False)
  1632.                 End If
  1633.             End If
  1634.         End Sub
  1635.  
  1636.         Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  1637.             MyBase.OnPaint(e)
  1638.             Dim G As Graphics = e.Graphics
  1639.             Dim Gradient As LinearGradientBrush = New LinearGradientBrush(New Point(0, CInt((Height / 2) - (cHandle.Height / 2))), New Point(0, CInt((Height / 2) + (cHandle.Height / 2))), Color.FromArgb(250, 250, 250), Color.FromArgb(240, 240, 240))
  1640.             Bar = New Rectangle(8, 10, Width - 21, Height - 21)
  1641.  
  1642.             G.Clear(BackColor)
  1643.             G.SmoothingMode = SmoothingMode.AntiAlias
  1644.  
  1645.             ' Draw the control body and border
  1646.             G.FillPath(Gradient, Pill(0, CInt(Height / 2 - cHandle.Height / 2), Width - 1, cHandle.Height - 5, New PillStyle With {.Left = True, .Right = True}))
  1647.             G.DrawPath(New Pen(Color.FromArgb(177, 177, 176)), Pill(0, CInt(Height / 2 - cHandle.Height / 2), Width - 1, cHandle.Height - 5, New PillStyle With {.Left = True, .Right = True}))
  1648.  
  1649.             Gradient.Dispose() ' Dispose GradientBrush object
  1650.  
  1651.             ' Draw a string based on the toggle boolean value
  1652.             Select Case ToggleType
  1653.                 Case _Type.YesNo
  1654.                     If Toggled Then
  1655.                         G.DrawString("Yes", New Font("Segoe UI", 7, FontStyle.Regular), Brushes.Gray, Bar.X + 7, Bar.Y, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  1656.                     Else
  1657.                         G.DrawString("No", New Font("Segoe UI", 7, FontStyle.Regular), Brushes.Gray, Bar.X + 18, Bar.Y, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  1658.                     End If
  1659.                 Case _Type.OnOff
  1660.                     If Toggled Then
  1661.                         G.DrawString("On", New Font("Segoe UI", 7, FontStyle.Regular), Brushes.Gray, Bar.X + 7, Bar.Y, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  1662.                     Else
  1663.                         G.DrawString("Off", New Font("Segoe UI", 7, FontStyle.Regular), Brushes.Gray, Bar.X + 18, Bar.Y, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  1664.                     End If
  1665.                 Case _Type.IO
  1666.                     If Toggled Then
  1667.                         G.DrawString("I", New Font("Segoe UI", 7, FontStyle.Regular), Brushes.Gray, Bar.X + 7, Bar.Y, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  1668.                     Else
  1669.                         G.DrawString("O", New Font("Segoe UI", 7, FontStyle.Regular), Brushes.Gray, Bar.X + 18, Bar.Y, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  1670.                     End If
  1671.             End Select
  1672.  
  1673.             ' Draw the toggle handle
  1674.             G.FillEllipse(New SolidBrush(Color.FromArgb(249, 249, 249)), Bar.X + CInt(Bar.Width * (ToggleLocation / 80)) - CInt(cHandle.Width / 2), Bar.Y + CInt((Bar.Height / 2)) - CInt(cHandle.Height / 2 - 1), cHandle.Width, cHandle.Height - 5)
  1675.             G.DrawEllipse(New Pen(Color.FromArgb(177, 177, 176)), Bar.X + CInt(Bar.Width * (ToggleLocation / 80) - CInt(cHandle.Width / 2)), Bar.Y + CInt((Bar.Height / 2)) - CInt(cHandle.Height / 2 - 1), cHandle.Width, cHandle.Height - 5)
  1676.         End Sub
  1677.     End Class
  1678.  
  1679. #End Region
  1680. #Region " Label "
  1681.  
  1682.     Class iTalk_Label
  1683.         Inherits Label
  1684.  
  1685.         Sub New()
  1686.             Font = New Font("Segoe UI", 8)
  1687.             ForeColor = Color.FromArgb(142, 142, 142)
  1688.             BackColor = Color.Transparent
  1689.         End Sub
  1690.     End Class
  1691.  
  1692. #End Region
  1693. #Region " Link Label "
  1694.     Class iTalk_LinkLabel
  1695.         Inherits LinkLabel
  1696.  
  1697.         Sub New()
  1698.             Font = New Font("Segoe UI", 8, FontStyle.Regular)
  1699.             BackColor = Color.Transparent
  1700.             LinkColor = Color.FromArgb(51, 153, 225)
  1701.             ActiveLinkColor = Color.FromArgb(0, 101, 202)
  1702.             VisitedLinkColor = Color.FromArgb(0, 101, 202)
  1703.             LinkBehavior = Windows.Forms.LinkBehavior.NeverUnderline
  1704.         End Sub
  1705.     End Class
  1706.  
  1707. #End Region
  1708. #Region " Header Label "
  1709.  
  1710.     Class iTalk_HeaderLabel
  1711.         Inherits Label
  1712.  
  1713.         Sub New()
  1714.             Font = New Font("Segoe UI", 25, FontStyle.Regular)
  1715.             ForeColor = Color.FromArgb(80, 80, 80)
  1716.             BackColor = Color.Transparent
  1717.         End Sub
  1718.     End Class
  1719.  
  1720. #End Region
  1721. #Region " Big TextBox "
  1722.  
  1723.     <DefaultEvent("TextChanged")> Class iTalk_TextBox_Big
  1724.         Inherits Control
  1725.  
  1726. #Region " Variables "
  1727.  
  1728.         Public WithEvents iTalkTB As New TextBox
  1729.         Private Shape As GraphicsPath
  1730.         Private _maxchars As Integer = 32767
  1731.         Private _ReadOnly As Boolean
  1732.         Private _Multiline As Boolean
  1733.         Private _Image As Image
  1734.         Private _ImageSize As Size
  1735.         Private ALNType As HorizontalAlignment
  1736.         Private isPasswordMasked As Boolean = False
  1737.         Private P1 As Pen
  1738.         Private B1 As SolidBrush
  1739.  
  1740. #End Region
  1741. #Region " Properties "
  1742. ' Get more free themes at ThemesVB.NET
  1743.         Public Shadows Property TextAlignment() As HorizontalAlignment
  1744.             Get
  1745.                 Return ALNType
  1746.             End Get
  1747.             Set(ByVal Val As HorizontalAlignment)
  1748.                 ALNType = Val
  1749.                 Invalidate()
  1750.             End Set
  1751.         End Property
  1752.         Public Shadows Property MaxLength() As Integer
  1753.             Get
  1754.                 Return _maxchars
  1755.             End Get
  1756.             Set(ByVal Val As Integer)
  1757.                 _maxchars = Val
  1758.                 iTalkTB.MaxLength = MaxLength
  1759.                 Invalidate()
  1760.             End Set
  1761.         End Property
  1762.  
  1763.         Public Shadows Property UseSystemPasswordChar() As Boolean
  1764.             Get
  1765.                 Return isPasswordMasked
  1766.             End Get
  1767.             Set(ByVal Val As Boolean)
  1768.                 iTalkTB.UseSystemPasswordChar = UseSystemPasswordChar
  1769.                 isPasswordMasked = Val
  1770.                 Invalidate()
  1771.             End Set
  1772.         End Property
  1773.         Property [ReadOnly]() As Boolean
  1774.             Get
  1775.                 Return _ReadOnly
  1776.             End Get
  1777.             Set(ByVal value As Boolean)
  1778.                 _ReadOnly = value
  1779.                 If iTalkTB IsNot Nothing Then
  1780.                     iTalkTB.ReadOnly = value
  1781.                 End If
  1782.             End Set
  1783.         End Property
  1784.         Property Multiline() As Boolean
  1785.             Get
  1786.                 Return _Multiline
  1787.             End Get
  1788.             Set(ByVal value As Boolean)
  1789.                 _Multiline = value
  1790.                 If iTalkTB IsNot Nothing Then
  1791.                     iTalkTB.Multiline = value
  1792.  
  1793.                     If value Then
  1794.                         iTalkTB.Height = Height - 23
  1795.                     Else
  1796.                         Height = iTalkTB.Height + 23
  1797.                     End If
  1798.                 End If
  1799.             End Set
  1800.         End Property
  1801.  
  1802.         Property Image() As Image
  1803.             Get
  1804.                 Return _Image
  1805.             End Get
  1806.             Set(ByVal value As Image)
  1807.                 If value Is Nothing Then
  1808.                     _ImageSize = Size.Empty
  1809.                 Else
  1810.                     _ImageSize = value.Size
  1811.                 End If
  1812.  
  1813.                 _Image = value
  1814.  
  1815.                 If Image Is Nothing Then
  1816.                     iTalkTB.Location = New Point(8, 10)
  1817.                 Else
  1818.                     iTalkTB.Location = New Point(35, 11)
  1819.                 End If
  1820.                 Invalidate()
  1821.             End Set
  1822.         End Property
  1823.  
  1824.         Protected ReadOnly Property ImageSize() As Size
  1825.             Get
  1826.                 Return _ImageSize
  1827.             End Get
  1828.         End Property
  1829.  
  1830. #End Region
  1831. #Region " EventArgs "
  1832.  
  1833.         Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
  1834.             MyBase.OnTextChanged(e)
  1835.             Invalidate()
  1836.         End Sub
  1837.  
  1838.         Protected Overrides Sub OnForeColorChanged(ByVal e As System.EventArgs)
  1839.             MyBase.OnForeColorChanged(e)
  1840.             iTalkTB.ForeColor = ForeColor
  1841.             Invalidate()
  1842.         End Sub
  1843.  
  1844.         Protected Overrides Sub OnFontChanged(ByVal e As System.EventArgs)
  1845.             MyBase.OnFontChanged(e)
  1846.             iTalkTB.Font = Font
  1847.         End Sub
  1848.  
  1849.         Protected Overrides Sub OnPaintBackground(e As PaintEventArgs)
  1850.             MyBase.OnPaintBackground(e)
  1851.         End Sub
  1852.  
  1853.         Private Sub _OnKeyDown(ByVal Obj As Object, ByVal e As KeyEventArgs)
  1854.             If e.Control AndAlso e.KeyCode = Keys.A Then
  1855.                 iTalkTB.SelectAll()
  1856.                 e.SuppressKeyPress = True
  1857.             End If
  1858.             If e.Control AndAlso e.KeyCode = Keys.C Then
  1859.                 iTalkTB.Copy()
  1860.                 e.SuppressKeyPress = True
  1861.             End If
  1862.         End Sub
  1863.  
  1864.         Protected Overrides Sub OnResize(ByVal e As System.EventArgs)
  1865.             MyBase.OnResize(e)
  1866.             If _Multiline Then
  1867.                 iTalkTB.Height = Height - 23
  1868.             Else
  1869.                 Height = iTalkTB.Height + 23
  1870.             End If
  1871.  
  1872.             Shape = New GraphicsPath
  1873.             With Shape
  1874.                 .AddArc(0, 0, 10, 10, 180, 90)
  1875.                 .AddArc(Width - 11, 0, 10, 10, -90, 90)
  1876.                 .AddArc(Width - 11, Height - 11, 10, 10, 0, 90)
  1877.                 .AddArc(0, Height - 11, 10, 10, 90, 90)
  1878.                 .CloseAllFigures()
  1879.             End With
  1880.         End Sub
  1881.  
  1882.         Protected Overrides Sub OnGotFocus(ByVal e As System.EventArgs)
  1883.             MyBase.OnGotFocus(e)
  1884.             iTalkTB.Focus()
  1885.         End Sub
  1886.  
  1887.         Sub _TextChanged() Handles iTalkTB.TextChanged
  1888.             Text = iTalkTB.Text
  1889.         End Sub
  1890.  
  1891.         Sub _BaseTextChanged() Handles MyBase.TextChanged
  1892.             iTalkTB.Text = Text
  1893.         End Sub
  1894.  
  1895. #End Region
  1896.  
  1897.         Sub AddTextBox()
  1898.             With iTalkTB
  1899.                 .Location = New Point(7, 10)
  1900.                 .Text = String.Empty
  1901.                 .BorderStyle = BorderStyle.None
  1902.                 .TextAlign = HorizontalAlignment.Left
  1903.                 .Font = New Font("Tahoma", 11)
  1904.                 .UseSystemPasswordChar = UseSystemPasswordChar
  1905.                 .Multiline = False
  1906.             End With
  1907.             AddHandler iTalkTB.KeyDown, AddressOf _OnKeyDown
  1908.         End Sub
  1909.  
  1910.         Sub New()
  1911.             SetStyle(ControlStyles.SupportsTransparentBackColor, True)
  1912.             SetStyle(ControlStyles.UserPaint, True)
  1913.  
  1914.             AddTextBox()
  1915.             Controls.Add(iTalkTB)
  1916.  
  1917.             P1 = New Pen(Color.FromArgb(180, 180, 180))
  1918.             B1 = New SolidBrush(Color.White)
  1919.             BackColor = Color.Transparent
  1920.             ForeColor = Color.DimGray
  1921.  
  1922.             Text = Nothing
  1923.             Font = New Font("Tahoma", 11)
  1924.             Size = New Size(135, 43)
  1925.             DoubleBuffered = True
  1926.         End Sub
  1927.  
  1928.         Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  1929.             MyBase.OnPaint(e)
  1930.             Dim B As New Bitmap(Width, Height)
  1931.             Dim G As Graphics = Graphics.FromImage(B)
  1932.  
  1933.             G.SmoothingMode = SmoothingMode.AntiAlias
  1934.  
  1935.             With iTalkTB
  1936.  
  1937.                 If Image Is Nothing Then
  1938.                     .Width = Width - 18
  1939.                 Else
  1940.                     .Width = Width - 45
  1941.                 End If
  1942.  
  1943.                 .TextAlign = TextAlignment
  1944.                 .UseSystemPasswordChar = UseSystemPasswordChar
  1945.             End With
  1946.  
  1947.             G.Clear(Color.Transparent)
  1948.             G.FillPath(B1, Shape) ' Draw background
  1949.             G.DrawPath(P1, Shape) ' Draw border
  1950.  
  1951.             If Image IsNot Nothing Then
  1952.                 G.DrawImage(_Image, 5, 8, 24, 24)
  1953.                 ' 24x24 is the perfect size of the image
  1954.             End If
  1955.  
  1956.             e.Graphics.DrawImage(B.Clone(), 0, 0)
  1957.             G.Dispose() : B.Dispose()
  1958.         End Sub
  1959.     End Class
  1960.  
  1961. #End Region
  1962. #Region " Small TextBox "
  1963.  
  1964.     <DefaultEvent("TextChanged")> Class iTalk_TextBox_Small
  1965.         Inherits Control
  1966.  
  1967. #Region " Variables "
  1968.  
  1969.         Public WithEvents iTalkTB As New TextBox
  1970.         Private Shape As GraphicsPath
  1971.         Private _maxchars As Integer = 32767
  1972.         Private _ReadOnly As Boolean
  1973.         Private _Multiline As Boolean
  1974.         Private ALNType As HorizontalAlignment
  1975.         Private isPasswordMasked As Boolean = False
  1976.         Private P1 As Pen
  1977.         Private B1 As SolidBrush
  1978.  
  1979. #End Region
  1980. #Region " Properties "
  1981.  
  1982.         Public Shadows Property TextAlignment() As HorizontalAlignment
  1983.             Get
  1984.                 Return ALNType
  1985.             End Get
  1986.             Set(ByVal Val As HorizontalAlignment)
  1987.                 ALNType = Val
  1988.                 Invalidate()
  1989.             End Set
  1990.         End Property
  1991.         Public Shadows Property MaxLength() As Integer
  1992.             Get
  1993.                 Return _maxchars
  1994.             End Get
  1995.             Set(ByVal Val As Integer)
  1996.                 _maxchars = Val
  1997.                 iTalkTB.MaxLength = MaxLength
  1998.                 Invalidate()
  1999.             End Set
  2000.         End Property
  2001.  
  2002.         Public Shadows Property UseSystemPasswordChar() As Boolean
  2003.             Get
  2004.                 Return isPasswordMasked
  2005.             End Get
  2006.             Set(ByVal Val As Boolean)
  2007.                 iTalkTB.UseSystemPasswordChar = UseSystemPasswordChar
  2008.                 isPasswordMasked = Val
  2009.                 Invalidate()
  2010.             End Set
  2011.         End Property
  2012.         Property [ReadOnly]() As Boolean
  2013.             Get
  2014.                 Return _ReadOnly
  2015.             End Get
  2016.             Set(ByVal value As Boolean)
  2017.                 _ReadOnly = value
  2018.                 If iTalkTB IsNot Nothing Then
  2019.                     iTalkTB.ReadOnly = value
  2020.                 End If
  2021.             End Set
  2022.         End Property
  2023.         Property Multiline() As Boolean
  2024.             Get
  2025.                 Return _Multiline
  2026.             End Get
  2027.             Set(ByVal value As Boolean)
  2028.                 _Multiline = value
  2029.                 If iTalkTB IsNot Nothing Then
  2030.                     iTalkTB.Multiline = value
  2031.  
  2032.                     If value Then
  2033.                         iTalkTB.Height = Height - 10
  2034.                     Else
  2035.                         Height = iTalkTB.Height + 10
  2036.                     End If
  2037.                 End If
  2038.             End Set
  2039.         End Property
  2040.  
  2041. #End Region
  2042. #Region " EventArgs "
  2043.  
  2044.         Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
  2045.             MyBase.OnTextChanged(e)
  2046.             Invalidate()
  2047.         End Sub
  2048.  
  2049.         Protected Overrides Sub OnForeColorChanged(ByVal e As System.EventArgs)
  2050.             MyBase.OnForeColorChanged(e)
  2051.             iTalkTB.ForeColor = ForeColor
  2052.             Invalidate()
  2053.         End Sub
  2054.  
  2055.         Protected Overrides Sub OnFontChanged(ByVal e As System.EventArgs)
  2056.             MyBase.OnFontChanged(e)
  2057.             iTalkTB.Font = Font
  2058.         End Sub
  2059.         Protected Overrides Sub OnPaintBackground(e As PaintEventArgs)
  2060.             MyBase.OnPaintBackground(e)
  2061.         End Sub
  2062.  
  2063.         Private Sub _OnKeyDown(ByVal Obj As Object, ByVal e As KeyEventArgs)
  2064.             If e.Control AndAlso e.KeyCode = Keys.A Then
  2065.                 iTalkTB.SelectAll()
  2066.                 e.SuppressKeyPress = True
  2067.             End If
  2068.             If e.Control AndAlso e.KeyCode = Keys.C Then
  2069.                 iTalkTB.Copy()
  2070.                 e.SuppressKeyPress = True
  2071.             End If
  2072.         End Sub
  2073.  
  2074.         Protected Overrides Sub OnResize(ByVal e As System.EventArgs)
  2075.             MyBase.OnResize(e)
  2076.             If _Multiline Then
  2077.                 iTalkTB.Height = Height - 10
  2078.             Else
  2079.                 Height = iTalkTB.Height + 10
  2080.             End If
  2081.  
  2082.             Shape = New GraphicsPath
  2083.             With Shape
  2084.                 .AddArc(0, 0, 10, 10, 180, 90)
  2085.                 .AddArc(Width - 11, 0, 10, 10, -90, 90)
  2086.                 .AddArc(Width - 11, Height - 11, 10, 10, 0, 90)
  2087.                 .AddArc(0, Height - 11, 10, 10, 90, 90)
  2088.                 .CloseAllFigures()
  2089.             End With
  2090.         End Sub
  2091.  
  2092.         Protected Overrides Sub OnGotFocus(ByVal e As System.EventArgs)
  2093.             MyBase.OnGotFocus(e)
  2094.             iTalkTB.Focus()
  2095.         End Sub
  2096.  
  2097.         Sub _TextChanged() Handles iTalkTB.TextChanged
  2098.             Text = iTalkTB.Text
  2099.         End Sub
  2100.  
  2101.         Sub _BaseTextChanged() Handles MyBase.TextChanged
  2102.             iTalkTB.Text = Text
  2103.         End Sub
  2104.  
  2105. #End Region
  2106.  
  2107.         Sub AddTextBox()
  2108.             ' Initialize the TextBox
  2109.             With iTalkTB
  2110.                 .Size = New Size(Width - 10, 33)
  2111.                 .Location = New Point(7, 5)
  2112.                 .Text = String.Empty
  2113.                 .BorderStyle = BorderStyle.None
  2114.                 .TextAlign = HorizontalAlignment.Left
  2115.                 .Font = New Font("Tahoma", 9)
  2116.                 .UseSystemPasswordChar = UseSystemPasswordChar
  2117.                 .Multiline = False
  2118.             End With
  2119.             AddHandler iTalkTB.KeyDown, AddressOf _OnKeyDown
  2120.         End Sub
  2121.  
  2122.         Sub New()
  2123.             SetStyle(ControlStyles.SupportsTransparentBackColor, True)
  2124.             SetStyle(ControlStyles.UserPaint, True)
  2125.  
  2126.             AddTextBox()
  2127.             Controls.Add(iTalkTB)
  2128.  
  2129.             P1 = New Pen(Color.FromArgb(180, 180, 180))
  2130.             B1 = New SolidBrush(Color.White)
  2131.             BackColor = Color.Transparent
  2132.             ForeColor = Color.DimGray
  2133.  
  2134.             Text = Nothing
  2135.             Font = New Font("Tahoma", 11)
  2136.             Size = New Size(135, 33)
  2137.             DoubleBuffered = True
  2138.         End Sub
  2139.  
  2140.         Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  2141.             MyBase.OnPaint(e)
  2142.             Dim B As New Bitmap(Width, Height)
  2143.             Dim G As Graphics = Graphics.FromImage(B)
  2144.  
  2145.             G.SmoothingMode = SmoothingMode.AntiAlias
  2146.  
  2147.             With iTalkTB
  2148.                 .Width = Width - 10
  2149.                 .TextAlign = TextAlignment
  2150.                 .UseSystemPasswordChar = UseSystemPasswordChar
  2151.             End With
  2152.  
  2153.             G.Clear(Color.Transparent)
  2154.             G.FillPath(B1, Shape) ' Draw background
  2155.             G.DrawPath(P1, Shape) ' Draw border
  2156.  
  2157.             e.Graphics.DrawImage(B.Clone(), 0, 0)
  2158.             G.Dispose() : B.Dispose()
  2159.         End Sub
  2160.     End Class
  2161.  
  2162. #End Region
  2163. #Region " RichTextBox "
  2164.  
  2165.     <DefaultEvent("TextChanged")> Class iTalk_RichTextBox
  2166.         Inherits Control
  2167.  
  2168. #Region " Variables "
  2169.  
  2170.         Public WithEvents iTalkRTB As New RichTextBox
  2171.         Private _ReadOnly As Boolean
  2172.         Private _WordWrap As Boolean
  2173.         Private _AutoWordSelection As Boolean
  2174.         Private Shape As GraphicsPath
  2175.  
  2176. #End Region
  2177. #Region " Properties "
  2178.  
  2179.         Overrides Property Text As String
  2180.             Get
  2181.                 Return iTalkRTB.Text
  2182.             End Get
  2183.             Set(value As String)
  2184.                 iTalkRTB.Text = value
  2185.                 Invalidate()
  2186.             End Set
  2187.         End Property
  2188.         Property [ReadOnly]() As Boolean
  2189.             Get
  2190.                 Return _ReadOnly
  2191.             End Get
  2192.             Set(ByVal value As Boolean)
  2193.                 _ReadOnly = value
  2194.                 If iTalkRTB IsNot Nothing Then
  2195.                     iTalkRTB.ReadOnly = value
  2196.                 End If
  2197.             End Set
  2198.         End Property
  2199.         Property [WordWrap]() As Boolean
  2200.             Get
  2201.                 Return _WordWrap
  2202.             End Get
  2203.             Set(ByVal value As Boolean)
  2204.                 _WordWrap = value
  2205.                 If iTalkRTB IsNot Nothing Then
  2206.                     iTalkRTB.WordWrap = value
  2207.                 End If
  2208.             End Set
  2209.         End Property
  2210.         Property [AutoWordSelection]() As Boolean
  2211.             Get
  2212.                 Return _AutoWordSelection
  2213.             End Get
  2214.             Set(ByVal value As Boolean)
  2215.                 _AutoWordSelection = value
  2216.                 If iTalkRTB IsNot Nothing Then
  2217.                     iTalkRTB.AutoWordSelection = value
  2218.                 End If
  2219.             End Set
  2220.         End Property
  2221. #End Region
  2222. #Region " EventArgs "
  2223.  
  2224.         Protected Overrides Sub OnForeColorChanged(ByVal e As System.EventArgs)
  2225.             MyBase.OnForeColorChanged(e)
  2226.             iTalkRTB.ForeColor = ForeColor
  2227.             Invalidate()
  2228.         End Sub
  2229.  
  2230.         Protected Overrides Sub OnFontChanged(ByVal e As System.EventArgs)
  2231.             MyBase.OnFontChanged(e)
  2232.             iTalkRTB.Font = Font
  2233.         End Sub
  2234.         Protected Overrides Sub OnPaintBackground(e As PaintEventArgs)
  2235.             MyBase.OnPaintBackground(e)
  2236.         End Sub
  2237.  
  2238.         Protected Overrides Sub OnSizeChanged(ByVal e As System.EventArgs)
  2239.             MyBase.OnSizeChanged(e)
  2240.             iTalkRTB.Size = New Size(Width - 13, Height - 11)
  2241.         End Sub
  2242.  
  2243.  
  2244.         Protected Overrides Sub OnResize(ByVal e As System.EventArgs)
  2245.             MyBase.OnResize(e)
  2246.  
  2247.             Shape = New GraphicsPath
  2248.             With Shape
  2249.                 .AddArc(0, 0, 10, 10, 180, 90)
  2250.                 .AddArc(Width - 11, 0, 10, 10, -90, 90)
  2251.                 .AddArc(Width - 11, Height - 11, 10, 10, 0, 90)
  2252.                 .AddArc(0, Height - 11, 10, 10, 90, 90)
  2253.                 .CloseAllFigures()
  2254.             End With
  2255.         End Sub
  2256.  
  2257.         Sub _TextChanged() Handles MyBase.TextChanged
  2258.             iTalkRTB.Text = Text
  2259.         End Sub
  2260.  
  2261. #End Region
  2262.  
  2263.         Sub AddRichTextBox()
  2264.             With iTalkRTB
  2265.                 .BackColor = Color.White
  2266.                 .Size = New Size(Width - 10, 100)
  2267.                 .Location = New Point(7, 5)
  2268.                 .Text = String.Empty
  2269.                 .BorderStyle = BorderStyle.None
  2270.                 .Font = New Font("Tahoma", 10)
  2271.                 .Multiline = True
  2272.             End With
  2273.         End Sub
  2274.  
  2275.         Sub New()
  2276.             MyBase.New()
  2277.             SetStyle(ControlStyles.SupportsTransparentBackColor, True)
  2278.             SetStyle(ControlStyles.UserPaint, True)
  2279.  
  2280.             AddRichTextBox()
  2281.             Controls.Add(iTalkRTB)
  2282.             BackColor = Color.Transparent
  2283.             ForeColor = Color.DimGray
  2284.  
  2285.             Text = Nothing
  2286.             Font = New Font("Tahoma", 10)
  2287.             Size = New Size(150, 100)
  2288.             WordWrap = True
  2289.             AutoWordSelection = False
  2290.             DoubleBuffered = True
  2291.         End Sub
  2292.  
  2293.         Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  2294.             MyBase.OnPaint(e)
  2295.             Dim B As New Bitmap(Width, Height)
  2296.             Dim G = Graphics.FromImage(B)
  2297.  
  2298.             G.SmoothingMode = SmoothingMode.AntiAlias
  2299.  
  2300.             G.Clear(Color.Transparent) ' Set control background to transparent
  2301.             G.FillPath(Brushes.White, Shape) ' Draw RTB background
  2302.             G.DrawPath(New Pen(Color.FromArgb(180, 180, 180)), Shape) ' Draw border
  2303.  
  2304.             G.Dispose()
  2305.             e.Graphics.DrawImage(B.Clone(), 0, 0)
  2306.             B.Dispose()
  2307.         End Sub
  2308.     End Class
  2309.  
  2310. #End Region
  2311. #Region " NumericUpDown "
  2312.  
  2313.     Class iTalk_NumericUpDown
  2314.         Inherits Control
  2315.  
  2316. #Region " Enums "
  2317.  
  2318.         Enum _TextAlignment
  2319.             Near
  2320.             Center
  2321.         End Enum
  2322.  
  2323. #End Region
  2324. #Region " Variables "
  2325.  
  2326.         Private Shape As GraphicsPath
  2327.         Private P1 As Pen
  2328.         Private B1 As SolidBrush
  2329.  
  2330.         Private _Value, _Minimum, _Maximum As Long
  2331.         Private Xval, Yval As Integer
  2332.         Private KeyboardNum As Boolean
  2333.         Private MyStringAlignment As _TextAlignment
  2334.  
  2335. #End Region
  2336. #Region " Properties "
  2337.  
  2338.         Public Property Value As Long
  2339.             Get
  2340.                 Return _Value
  2341.             End Get
  2342.             Set(value As Long)
  2343.                 If value <= _Maximum And value >= _Minimum Then _Value = value
  2344.                 Invalidate()
  2345.             End Set
  2346.         End Property
  2347.  
  2348.         Public Property Minimum As Long
  2349.             Get
  2350.                 Return _Minimum
  2351.             End Get
  2352.             Set(value As Long)
  2353.                 If value < _Maximum Then _Minimum = value
  2354.                 If _Value < _Minimum Then _Value = Minimum
  2355.                 Invalidate()
  2356.             End Set
  2357.         End Property
  2358.  
  2359.         Public Property Maximum As Long
  2360.             Get
  2361.                 Return _Maximum
  2362.             End Get
  2363.             Set(value As Long)
  2364.                 If value > _Minimum Then _Maximum = value
  2365.                 If _Value > _Maximum Then _Value = _Maximum
  2366.                 Invalidate()
  2367.             End Set
  2368.         End Property
  2369.  
  2370.         Public Property TextAlignment As _TextAlignment
  2371.             Get
  2372.                 Return MyStringAlignment
  2373.             End Get
  2374.             Set(value As _TextAlignment)
  2375.                 MyStringAlignment = value
  2376.                 Invalidate()
  2377.             End Set
  2378.         End Property
  2379.  
  2380. #End Region
  2381. #Region " EventArgs "
  2382.  
  2383.         Protected Overrides Sub OnResize(ByVal e As System.EventArgs)
  2384.             MyBase.OnResize(e)
  2385.             Height = 28
  2386.             Shape = New GraphicsPath
  2387.             With Shape
  2388.                 .AddArc(0, 0, 10, 10, 180, 90)
  2389.                 .AddArc(Width - 11, 0, 10, 10, -90, 90)
  2390.                 .AddArc(Width - 11, Height - 11, 10, 10, 0, 90)
  2391.                 .AddArc(0, Height - 11, 10, 10, 90, 90)
  2392.                 .CloseAllFigures()
  2393.             End With
  2394.         End Sub
  2395.  
  2396.         Protected Overrides Sub OnMouseMove(ByVal e As System.Windows.Forms.MouseEventArgs)
  2397.             MyBase.OnMouseMove(e)
  2398.             Xval = e.Location.X
  2399.             Yval = e.Location.Y
  2400.             Invalidate()
  2401.  
  2402.             If e.X < Width - 24 Then
  2403.                 Cursor = Cursors.IBeam
  2404.             Else
  2405.                 Cursor = Cursors.Default
  2406.             End If
  2407.         End Sub
  2408.  
  2409.         Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  2410.             MyBase.OnMouseClick(e)
  2411.             If Xval > Me.Width - 23 AndAlso Xval < Me.Width - 3 Then
  2412.                 If Yval < 15 Then
  2413.                     If (Value + 1) <= _Maximum Then _Value += 1
  2414.                 Else
  2415.                     If (Value - 1) >= _Minimum Then _Value -= 1
  2416.                 End If
  2417.             Else
  2418.                 KeyboardNum = Not KeyboardNum
  2419.                 Focus()
  2420.             End If
  2421.             Invalidate()
  2422.         End Sub
  2423.  
  2424.         Protected Overrides Sub OnKeyPress(ByVal e As System.Windows.Forms.KeyPressEventArgs)
  2425.             MyBase.OnKeyPress(e)
  2426.             Try
  2427.                 If KeyboardNum = True Then
  2428.                     _Value = CStr(CStr(_Value) & e.KeyChar.ToString)
  2429.                 End If
  2430.                 If _Value > _Maximum Then
  2431.                     _Value = _Maximum
  2432.                 End If
  2433.             Catch ex As Exception
  2434.             End Try
  2435.         End Sub
  2436.  
  2437.         Protected Overrides Sub OnKeyUp(ByVal e As System.Windows.Forms.KeyEventArgs)
  2438.             MyBase.OnKeyUp(e)
  2439.             If e.KeyCode = Keys.Back Then
  2440.                 Dim TemporaryValue As String = _Value.ToString()
  2441.                 TemporaryValue = TemporaryValue.Remove(Convert.ToInt32(TemporaryValue.Length - 1))
  2442.                 If (TemporaryValue.Length = 0) Then TemporaryValue = "0"
  2443.                 _Value = Convert.ToInt32(TemporaryValue)
  2444.             End If
  2445.             Invalidate()
  2446.         End Sub
  2447.  
  2448.         Protected Overrides Sub OnMouseWheel(e As MouseEventArgs)
  2449.             MyBase.OnMouseWheel(e)
  2450.             If e.Delta > 0 Then
  2451.                 If (Value + 1) <= _Maximum Then _Value += 1
  2452.                 Invalidate()
  2453.             Else
  2454.                 If (Value - 1) >= _Minimum Then _Value -= 1
  2455.                 Invalidate()
  2456.             End If
  2457.         End Sub
  2458.  
  2459. #End Region
  2460.  
  2461.         Sub New()
  2462.             SetStyle(ControlStyles.SupportsTransparentBackColor, True)
  2463.             SetStyle(ControlStyles.UserPaint, True)
  2464.  
  2465.             P1 = New Pen(Color.FromArgb(180, 180, 180))
  2466.             B1 = New SolidBrush(Color.White)
  2467.             BackColor = Color.Transparent
  2468.             ForeColor = Color.DimGray
  2469.  
  2470.             _Minimum = 0
  2471.             _Maximum = 100
  2472.  
  2473.             Font = New Font("Tahoma", 11)
  2474.             Size = New Size(70, 28)
  2475.             MinimumSize = New Size(62, 28)
  2476.             DoubleBuffered = True
  2477.         End Sub
  2478.  
  2479.         Public Sub Increment(Value As Integer)
  2480.             Me._Value += Value
  2481.             Invalidate()
  2482.         End Sub
  2483.  
  2484.         Public Sub Decrement(Value As Integer)
  2485.             Me._Value -= Value
  2486.             Invalidate()
  2487.         End Sub
  2488.  
  2489.         Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  2490.             MyBase.OnPaint(e)
  2491.             Dim B As New Bitmap(Width, Height)
  2492.             Dim G As Graphics = Graphics.FromImage(B)
  2493.  
  2494.             G.SmoothingMode = SmoothingMode.AntiAlias
  2495.  
  2496.             G.Clear(Color.Transparent) ' Set control background color
  2497.             G.FillPath(B1, Shape) ' Draw background
  2498.             G.DrawPath(P1, Shape) ' Draw border
  2499.  
  2500.             Dim ColorGradient As New LinearGradientBrush(New Rectangle(Width - 23, 4, 19, 19), Color.FromArgb(241, 241, 241), Color.FromArgb(241, 241, 241), 90.0F)
  2501.             G.FillRectangle(ColorGradient, ColorGradient.Rectangle) '  Fills the body of the rectangle
  2502.  
  2503.             G.DrawRectangle(New Pen(Color.FromArgb(252, 252, 252)), New Rectangle(Width - 22, 5, 17, 17))
  2504.             G.DrawRectangle(New Pen(Color.FromArgb(180, 180, 180)), New Rectangle(Width - 23, 4, 19, 19))
  2505.  
  2506.             G.DrawLine(New Pen(Color.FromArgb(250, 252, 250)), New Point(Width - 22, Height - 16), New Point(Width - 5, Height - 16))
  2507.             G.DrawLine(New Pen(Color.FromArgb(180, 180, 180)), New Point(Width - 22, Height - 15), New Point(Width - 5, Height - 15))
  2508.             G.DrawLine(New Pen(Color.FromArgb(250, 250, 250)), New Point(Width - 22, Height - 14), New Point(Width - 5, Height - 14))
  2509.  
  2510.             G.DrawString("+", New Font("Tahoma", 8), Brushes.Gray, Width - 19, Height - 26)
  2511.             G.DrawString("-", New Font("Tahoma", 12), Brushes.Gray, Width - 19, Height - 20)
  2512.  
  2513.             Select Case MyStringAlignment
  2514.                 Case _TextAlignment.Near
  2515.                     G.DrawString(Value, Font, New SolidBrush(ForeColor), New Rectangle(5, 0, Width - 1, Height - 1), New StringFormat() With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Center})
  2516.                 Case _TextAlignment.Center
  2517.                     G.DrawString(Value, Font, New SolidBrush(ForeColor), New Rectangle(0, 0, Width - 1, Height - 1), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  2518.             End Select
  2519.             e.Graphics.DrawImage(B.Clone(), 0, 0)
  2520.             G.Dispose() : B.Dispose()
  2521.         End Sub
  2522.     End Class
  2523.  
  2524. #End Region
  2525. #Region " Left Chat Bubble "
  2526.  
  2527.     Public Class iTalk_ChatBubble_L
  2528.         Inherits Control
  2529.  
  2530. #Region " Variables "
  2531.  
  2532.         Private Shape As GraphicsPath
  2533.         Private _TextColor As Color = Color.FromArgb(52, 52, 52)
  2534.         Private _BubbleColor As Color = Color.FromArgb(217, 217, 217)
  2535.         Private _DrawBubbleArrow As Boolean = True
  2536.  
  2537. #End Region
  2538. #Region " Properties "
  2539.  
  2540.         Public Overrides Property ForeColor As Color
  2541.             Get
  2542.                 Return Me._TextColor
  2543.             End Get
  2544.             Set(ByVal value As Color)
  2545.                 Me._TextColor = value
  2546.                 Me.Invalidate()
  2547.             End Set
  2548.         End Property
  2549.  
  2550.         Public Property BubbleColor As Color
  2551.             Get
  2552.                 Return Me._BubbleColor
  2553.             End Get
  2554.             Set(ByVal value As Color)
  2555.                 Me._BubbleColor = value
  2556.                 Me.Invalidate()
  2557.             End Set
  2558.         End Property
  2559.  
  2560.         Public Shadows Property DrawBubbleArrow() As Boolean
  2561.             Get
  2562.                 Return _DrawBubbleArrow
  2563.             End Get
  2564.             Set(ByVal Val As Boolean)
  2565.                 _DrawBubbleArrow = Val
  2566.                 Invalidate()
  2567.             End Set
  2568.         End Property
  2569.  
  2570. #End Region
  2571.  
  2572.         Sub New()
  2573.             SetStyle(ControlStyles.AllPaintingInWmPaint Or _
  2574.                      ControlStyles.OptimizedDoubleBuffer Or _
  2575.                      ControlStyles.ResizeRedraw Or _
  2576.                      ControlStyles.SupportsTransparentBackColor Or _
  2577.                      ControlStyles.UserPaint, True)
  2578.             DoubleBuffered = True
  2579.             Size = New Size(152, 38)
  2580.             BackColor = Color.Transparent
  2581.             ForeColor = Color.FromArgb(52, 52, 52)
  2582.             Font = New Font("Segoe UI", 10)
  2583.         End Sub
  2584.  
  2585.         Protected Overrides Sub OnResize(ByVal e As System.EventArgs)
  2586.             Shape = New GraphicsPath
  2587.  
  2588.             With Shape
  2589.                 .AddArc(9, 0, 10, 10, 180, 90)
  2590.                 .AddArc(Width - 11, 0, 10, 10, -90, 90)
  2591.                 .AddArc(Width - 11, Height - 11, 10, 10, 0, 90)
  2592.                 .AddArc(9, Height - 11, 10, 10, 90, 90)
  2593.                 .CloseAllFigures()
  2594.             End With
  2595.  
  2596.             Invalidate()
  2597.             MyBase.OnResize(e)
  2598.         End Sub
  2599.  
  2600.         Protected Overrides Sub OnPaint(e As PaintEventArgs)
  2601.             MyBase.OnPaint(e)
  2602.             Dim B As New Bitmap(Width, Height)
  2603.             Dim G = Graphics.FromImage(B)
  2604.  
  2605.             With G
  2606.                 .SmoothingMode = SmoothingMode.HighQuality
  2607.                 .PixelOffsetMode = PixelOffsetMode.HighQuality
  2608.                 .Clear(BackColor)
  2609.  
  2610.                 .FillPath(New SolidBrush(_BubbleColor), Shape) ' Fill the body of the bubble with the specified color
  2611.                 .DrawString(Text, Font, New SolidBrush(ForeColor), New Rectangle(15, 4, Width - 17, Height - 5))
  2612.  
  2613.                 ' Draw a polygon on the right side of the bubble
  2614.                 If _DrawBubbleArrow = True Then
  2615.                     Dim p() As Point = {New Point(9, Height - 19), New Point(0, Height - 25), New Point(9, Height - 30)}
  2616.                     .FillPolygon(New SolidBrush(_BubbleColor), p)
  2617.                     .DrawPolygon(New Pen(New SolidBrush(_BubbleColor)), p)
  2618.                 End If
  2619.             End With
  2620.  
  2621.             G.Dispose()
  2622.             e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic
  2623.             e.Graphics.DrawImageUnscaled(B, 0, 0)
  2624.             B.Dispose()
  2625.         End Sub
  2626.     End Class
  2627.  
  2628. #End Region
  2629. #Region " Right Chat Bubble "
  2630.  
  2631.     Public Class iTalk_ChatBubble_R
  2632.         Inherits Control
  2633.  
  2634. #Region " Variables "
  2635.  
  2636.         Private Shape As GraphicsPath
  2637.         Private _TextColor As Color = Color.FromArgb(52, 52, 52)
  2638.         Private _BubbleColor As Color = Color.FromArgb(192, 206, 215)
  2639.         Private _DrawBubbleArrow As Boolean = True
  2640.  
  2641. #End Region
  2642. #Region " Properties "
  2643.  
  2644.         Public Overrides Property ForeColor As Color
  2645.             Get
  2646.                 Return Me._TextColor
  2647.             End Get
  2648.             Set(ByVal value As Color)
  2649.                 Me._TextColor = value
  2650.                 Me.Invalidate()
  2651.             End Set
  2652.         End Property
  2653.  
  2654.         Public Property BubbleColor As Color
  2655.             Get
  2656.                 Return Me._BubbleColor
  2657.             End Get
  2658.             Set(ByVal value As Color)
  2659.                 Me._BubbleColor = value
  2660.                 Me.Invalidate()
  2661.             End Set
  2662.         End Property
  2663.  
  2664.         Public Shadows Property DrawBubbleArrow() As Boolean
  2665.             Get
  2666.                 Return _DrawBubbleArrow
  2667.             End Get
  2668.             Set(ByVal Val As Boolean)
  2669.                 _DrawBubbleArrow = Val
  2670.                 Invalidate()
  2671.             End Set
  2672.         End Property
  2673.  
  2674. #End Region
  2675.  
  2676.         Sub New()
  2677.             SetStyle(ControlStyles.AllPaintingInWmPaint Or _
  2678.                      ControlStyles.OptimizedDoubleBuffer Or _
  2679.                      ControlStyles.ResizeRedraw Or _
  2680.                      ControlStyles.SupportsTransparentBackColor Or _
  2681.                      ControlStyles.UserPaint, True)
  2682.             DoubleBuffered = True
  2683.             Size = New Size(152, 38)
  2684.             BackColor = Color.Transparent
  2685.             ForeColor = Color.FromArgb(52, 52, 52)
  2686.             Font = New Font("Segoe UI", 10)
  2687.         End Sub
  2688.  
  2689.         Protected Overrides Sub OnResize(ByVal e As System.EventArgs)
  2690.             MyBase.OnResize(e)
  2691.             Shape = New GraphicsPath
  2692.  
  2693.             With Shape
  2694.                 .AddArc(0, 0, 10, 10, 180, 90)
  2695.                 .AddArc(Width - 18, 0, 10, 10, -90, 90)
  2696.                 .AddArc(Width - 18, Height - 11, 10, 10, 0, 90)
  2697.                 .AddArc(0, Height - 11, 10, 10, 90, 90)
  2698.                 .CloseAllFigures()
  2699.             End With
  2700.  
  2701.             Invalidate()
  2702.         End Sub
  2703.  
  2704.         Protected Overrides Sub OnPaint(e As PaintEventArgs)
  2705.             MyBase.OnPaint(e)
  2706.             Dim B As New Bitmap(Width, Height)
  2707.             Dim G = Graphics.FromImage(B)
  2708.  
  2709.             With G
  2710.                 .SmoothingMode = SmoothingMode.HighQuality
  2711.                 .PixelOffsetMode = PixelOffsetMode.HighQuality
  2712.                 .Clear(BackColor)
  2713.  
  2714.                 .FillPath(New SolidBrush(_BubbleColor), Shape) ' Fill the body of the bubble with the specified color
  2715.                 .DrawString(Text, Font, New SolidBrush(ForeColor), (New Rectangle(6, 4, Width - 15, Height)))
  2716.  
  2717.                 ' Draw a polygon on the right side of the bubble
  2718.                 If _DrawBubbleArrow = True Then
  2719.                     Dim p() As Point = {New Point(Width - 8, Height - 19), New Point(Width, Height - 25), New Point(Width - 8, Height - 30)}
  2720.                     .FillPolygon(New SolidBrush(_BubbleColor), p)
  2721.                     .DrawPolygon(New Pen(New SolidBrush(_BubbleColor)), p)
  2722.                 End If
  2723.             End With
  2724.             G.Dispose()
  2725.             e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic
  2726.             e.Graphics.DrawImageUnscaled(B, 0, 0)
  2727.             B.Dispose()
  2728.         End Sub
  2729.     End Class
  2730.  
  2731. #End Region
  2732. #Region " Separator "
  2733.  
  2734.     Public Class iTalk_Separator
  2735.         Inherits Control
  2736.  
  2737. #Region " Variables "
  2738.  
  2739.         Dim myBrush As New SolidBrush(Color.FromArgb(184, 183, 188))
  2740.         Dim myPen As New Pen(myBrush)
  2741.  
  2742. #End Region
  2743.  
  2744.         Sub New()
  2745.             SetStyle(ControlStyles.ResizeRedraw, True)
  2746.             Me.Size = New Point(120, 10)
  2747.         End Sub
  2748.  
  2749.         Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  2750.             MyBase.OnPaint(e)
  2751.             e.Graphics.DrawLine(myPen, 0, 5, Width, 5) ' Draw the line
  2752.         End Sub
  2753.     End Class
  2754.  
  2755. #End Region
  2756. #Region " Panel "
  2757.  
  2758.     Class iTalk_Panel
  2759.         Inherits ContainerControl
  2760.  
  2761.         Private Shape As GraphicsPath
  2762.  
  2763.         Sub New()
  2764.             SetStyle(ControlStyles.SupportsTransparentBackColor, True)
  2765.             SetStyle(ControlStyles.UserPaint, True)
  2766.  
  2767.             BackColor = Color.Transparent
  2768.             Me.Size = New Size(187, 117)
  2769.             Padding = New Padding(5, 5, 5, 5)
  2770.             DoubleBuffered = True
  2771.         End Sub
  2772.  
  2773.         Protected Overrides Sub OnResize(ByVal e As System.EventArgs)
  2774.             MyBase.OnResize(e)
  2775.  
  2776.             Shape = New GraphicsPath
  2777.             With Shape
  2778.                 .AddArc(0, 0, 10, 10, 180, 90)
  2779.                 .AddArc(Width - 11, 0, 10, 10, -90, 90)
  2780.                 .AddArc(Width - 11, Height - 11, 10, 10, 0, 90)
  2781.                 .AddArc(0, Height - 11, 10, 10, 90, 90)
  2782.                 .CloseAllFigures()
  2783.             End With
  2784.         End Sub
  2785.  
  2786.         Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  2787.             MyBase.OnPaint(e)
  2788.             Dim B As New Bitmap(Width, Height)
  2789.             Dim G = Graphics.FromImage(B)
  2790.  
  2791.             G.SmoothingMode = SmoothingMode.HighQuality
  2792.  
  2793.             G.Clear(Color.Transparent) ' Set control background to transparent
  2794.             G.FillPath(Brushes.White, Shape) ' Draw RTB background
  2795.             G.DrawPath(New Pen(Color.FromArgb(180, 180, 180)), Shape) ' Draw border
  2796.  
  2797.             G.Dispose()
  2798.             e.Graphics.DrawImage(B.Clone(), 0, 0)
  2799.             B.Dispose()
  2800.         End Sub
  2801.     End Class
  2802.  
  2803. #End Region
  2804. #Region " GroupBox "
  2805.  
  2806.     Public Class iTalk_GroupBox
  2807.         Inherits ContainerControl
  2808.  
  2809.         Sub New()
  2810.             SetStyle(ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  2811.             BackColor = Color.Transparent
  2812.             DoubleBuffered = True ' Reduce control flicker
  2813.             Me.Size = New Size(212, 104)
  2814.             Me.MinimumSize = New Size(136, 50)
  2815.             Me.Padding = New Padding(5, 28, 5, 5) ' Set padding so controls won't overlay when full-docked
  2816.         End Sub
  2817.  
  2818.         Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  2819.             MyBase.OnPaint(e)
  2820.             Dim B As New Bitmap(Width, Height)
  2821.             Dim G As Graphics = Graphics.FromImage(B)
  2822.             Dim TitleBox As New Rectangle(51, 3, Width - 103, 18)
  2823.             Dim box As New Rectangle(0, 0, Width - 1, Height - 10)
  2824.  
  2825.             G.Clear(Color.Transparent)
  2826.             G.SmoothingMode = SmoothingMode.HighQuality ' Specifies antialiased rendering
  2827.  
  2828.             ' Draw the body of the GroupBox
  2829.             G.FillPath(Brushes.White, RoundRectangle.RoundRect(New Rectangle(1, 12, Width - 3, box.Height - 1), 8))
  2830.             ' Draw the border of the GroupBox
  2831.             G.DrawPath(New Pen(Color.FromArgb(159, 159, 161)), RoundRectangle.RoundRect(New Rectangle(1, 12, Width - 3, Height - 13), 8))
  2832.  
  2833.             ' Draw the background of the title box
  2834.             G.FillPath(Brushes.White, RoundRectangle.RoundRect(TitleBox, 1))
  2835.             ' Draw the border of the title box
  2836.             G.DrawPath(New Pen(Color.FromArgb(182, 180, 186)), RoundRectangle.RoundRect(TitleBox, 4))
  2837.             ' Draw the specified string from 'Text' property inside the title box
  2838.             G.DrawString(Text, New Font("Tahoma", 9, FontStyle.Regular), New SolidBrush(Color.FromArgb(53, 53, 53)), TitleBox, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  2839.  
  2840.             e.Graphics.DrawImage(B.Clone(), 0, 0)
  2841.             G.Dispose()
  2842.             B.Dispose()
  2843.         End Sub
  2844.     End Class
  2845.  
  2846. #End Region
  2847. #Region " CheckBox "
  2848.  
  2849.     <DefaultEvent("CheckedChanged")> Class iTalk_CheckBox
  2850.         Inherits Control
  2851.  
  2852. #Region " Variables "
  2853.  
  2854.         Private Shape As GraphicsPath
  2855.         Private GB As LinearGradientBrush
  2856.         Private R1, R2 As Rectangle
  2857.         Private _Checked As Boolean
  2858.         Event CheckedChanged(ByVal sender As Object)
  2859.  
  2860. #End Region
  2861. #Region " Properties "
  2862.  
  2863.         Property Checked As Boolean
  2864.             Get
  2865.                 Return _Checked
  2866.             End Get
  2867.             Set(ByVal value As Boolean)
  2868.                 _Checked = value
  2869.                 RaiseEvent CheckedChanged(Me)
  2870.                 Invalidate()
  2871.             End Set
  2872.         End Property
  2873.  
  2874. #End Region
  2875.  
  2876.         Sub New()
  2877.             SetStyle(ControlStyles.AllPaintingInWmPaint Or _
  2878.                      ControlStyles.OptimizedDoubleBuffer Or _
  2879.                      ControlStyles.ResizeRedraw Or _
  2880.                      ControlStyles.SupportsTransparentBackColor Or _
  2881.                      ControlStyles.UserPaint, True)
  2882.  
  2883.             BackColor = Color.Transparent
  2884.             DoubleBuffered = True ' Reduce control flicker
  2885.             Font = New Font("Segoe UI", 10)
  2886.             Size = New Size(120, 26)
  2887.         End Sub
  2888.  
  2889.         Protected Overrides Sub OnClick(ByVal e As EventArgs)
  2890.             _Checked = Not _Checked
  2891.             RaiseEvent CheckedChanged(Me)
  2892.             Invalidate()
  2893.             MyBase.OnClick(e)
  2894.         End Sub
  2895.  
  2896.         Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
  2897.             Invalidate()
  2898.             MyBase.OnTextChanged(e)
  2899.         End Sub
  2900.  
  2901.         Protected Overrides Sub OnResize(ByVal e As System.EventArgs)
  2902.             If Width > 0 AndAlso Height > 0 Then
  2903.                 Shape = New GraphicsPath
  2904.  
  2905.                 R1 = New Rectangle(17, 0, Width, Height + 1)
  2906.                 R2 = New Rectangle(0, 0, Width, Height)
  2907.                 GB = New LinearGradientBrush(New Rectangle(0, 0, 25, 25), Color.FromArgb(250, 250, 250), Color.FromArgb(240, 240, 240), 90)
  2908.  
  2909.                 With Shape
  2910.                     .AddArc(0, 0, 7, 7, 180, 90)
  2911.                     .AddArc(7, 0, 7, 7, -90, 90)
  2912.                     .AddArc(7, 7, 7, 7, 0, 90)
  2913.                     .AddArc(0, 7, 7, 7, 90, 90)
  2914.                     .CloseAllFigures()
  2915.                 End With
  2916.                 Height = 15
  2917.             End If
  2918.  
  2919.             Invalidate()
  2920.             MyBase.OnResize(e)
  2921.         End Sub
  2922.  
  2923.         Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  2924.             MyBase.OnPaint(e)
  2925.  
  2926.             With e.Graphics
  2927.                 .Clear(Color.FromArgb(246, 246, 246))
  2928.                 .SmoothingMode = SmoothingMode.AntiAlias
  2929.  
  2930.                 .FillPath(GB, Shape) ' Fill the body of the CheckBox
  2931.                 .DrawPath(New Pen(Color.FromArgb(160, 160, 160)), Shape) ' Draw the border
  2932.  
  2933.                 .DrawString(Text, Font, New SolidBrush(Color.FromArgb(142, 142, 142)), R1, New StringFormat() With {.LineAlignment = StringAlignment.Center})
  2934.  
  2935.                 If Checked Then
  2936.                     .DrawString("ΓΌ", New Font("Wingdings", 14), New SolidBrush(Color.FromArgb(142, 142, 142)), New Rectangle(-2, 1, Width, Height), New StringFormat() With {.LineAlignment = StringAlignment.Center})
  2937.                 End If
  2938.             End With
  2939.             e.Dispose()
  2940.         End Sub
  2941.     End Class
  2942.  
  2943. #End Region
  2944. #Region " RadioButton "
  2945.  
  2946.     <DefaultEvent("CheckedChanged")> Class iTalk_RadioButton
  2947.         Inherits Control
  2948.  
  2949. #Region " Enums "
  2950.  
  2951.         Enum MouseState As Byte
  2952.             None = 0
  2953.             Over = 1
  2954.             Down = 2
  2955.             Block = 3
  2956.         End Enum
  2957.  
  2958. #End Region
  2959. #Region " Variables "
  2960.  
  2961.         Private _Checked As Boolean
  2962.         Event CheckedChanged(ByVal sender As Object)
  2963.  
  2964. #End Region
  2965. #Region " Properties "
  2966.  
  2967.         Property Checked() As Boolean
  2968.             Get
  2969.                 Return _Checked
  2970.             End Get
  2971.             Set(ByVal value As Boolean)
  2972.                 _Checked = value
  2973.                 InvalidateControls()
  2974.                 RaiseEvent CheckedChanged(Me)
  2975.                 Invalidate()
  2976.             End Set
  2977.         End Property
  2978.  
  2979. #End Region
  2980. #Region " EventArgs "
  2981.  
  2982.         Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
  2983.             Invalidate()
  2984.             MyBase.OnTextChanged(e)
  2985.         End Sub
  2986.  
  2987.         Protected Overrides Sub OnResize(e As EventArgs)
  2988.             MyBase.OnResize(e)
  2989.             Height = 15
  2990.         End Sub
  2991.  
  2992.         Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  2993.             If Not _Checked Then Checked = True
  2994.             MyBase.OnMouseDown(e)
  2995.         End Sub
  2996.  
  2997. #End Region
  2998.  
  2999.         Sub New()
  3000.             SetStyle(ControlStyles.AllPaintingInWmPaint Or _
  3001.                      ControlStyles.OptimizedDoubleBuffer Or _
  3002.                      ControlStyles.ResizeRedraw Or _
  3003.                      ControlStyles.SupportsTransparentBackColor Or _
  3004.                      ControlStyles.UserPaint, True)
  3005.             BackColor = Color.Transparent
  3006.             Font = New Font("Segoe UI", 10)
  3007.             Width = 132
  3008.         End Sub
  3009.  
  3010.         Private Sub InvalidateControls()
  3011.             If Not IsHandleCreated OrElse Not _Checked Then Return
  3012.  
  3013.             For Each _Control As Control In Parent.Controls
  3014.                 If _Control IsNot Me AndAlso TypeOf _Control Is iTalk_RadioButton Then
  3015.                     DirectCast(_Control, iTalk_RadioButton).Checked = False
  3016.                 End If
  3017.             Next
  3018.         End Sub
  3019.  
  3020.         Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  3021.             MyBase.OnPaint(e)
  3022.             With e.Graphics
  3023.  
  3024.                 .Clear(Color.FromArgb(246, 246, 246))
  3025.                 .SmoothingMode = SmoothingMode.AntiAlias
  3026.  
  3027.                 ' Fill the body of the ellipse with a gradient
  3028.                 Dim LGB As New LinearGradientBrush(New Rectangle(New Point(0, 0), New Size(14, 14)), Color.FromArgb(250, 250, 250), Color.FromArgb(240, 240, 240), 90)
  3029.                 .FillEllipse(LGB, New Rectangle(New Point(0, 0), New Size(14, 14)))
  3030.  
  3031.                 Dim GP As New GraphicsPath()
  3032.                 GP.AddEllipse(New Rectangle(0, 0, 14, 14))
  3033.                 .SetClip(GP)
  3034.                 .ResetClip()
  3035.  
  3036.                 ' Draw ellipse border
  3037.                 .DrawEllipse(New Pen(Color.FromArgb(160, 160, 160)), New Rectangle(New Point(0, 0), New Size(14, 14)))
  3038.  
  3039.                 If _Checked Then ' Draw an ellipse inside the body
  3040.                     Dim EllipseColor As New SolidBrush(Color.FromArgb(142, 142, 142))
  3041.                     .FillEllipse(EllipseColor, New Rectangle(New Point(4, 4), New Size(6, 6)))
  3042.                 End If
  3043.                 .DrawString(Text, Font, New SolidBrush(Color.FromArgb(142, 142, 142)), 16, 8, New StringFormat() With {.LineAlignment = StringAlignment.Center})
  3044.             End With
  3045.             e.Dispose()
  3046.         End Sub
  3047.     End Class
  3048.  
  3049. #End Region
  3050. #Region " Notification Number "
  3051.  
  3052.     Class iTalk_NotificationNumber
  3053.         Inherits Control
  3054.  
  3055. #Region " Variables "
  3056.  
  3057.         Private _Value As Integer = 0
  3058.         Private _Maximum As Integer = 99
  3059.  
  3060. #End Region
  3061. #Region " Properties "
  3062.  
  3063.         Public Property Value() As Integer
  3064.             Get
  3065.                 Select Case _Value
  3066.                     Case 0
  3067.                         Return 0
  3068.                     Case Else
  3069.                         Return _Value
  3070.                 End Select
  3071.             End Get
  3072.             Set(ByVal i As Integer)
  3073.                 Select Case i
  3074.                     Case Is > _Maximum
  3075.                         i = _Maximum
  3076.                 End Select
  3077.                 _Value = i
  3078.                 Invalidate()
  3079.             End Set
  3080.         End Property
  3081.  
  3082.         Public Property Maximum() As Integer
  3083.             Get
  3084.                 Return _Maximum
  3085.             End Get
  3086.             Set(ByVal i As Integer)
  3087.                 Select Case i
  3088.                     Case Is < _Value
  3089.                         _Value = i
  3090.                 End Select
  3091.                 _Maximum = i
  3092.                 Invalidate()
  3093.             End Set
  3094.         End Property
  3095.  
  3096. #End Region
  3097.  
  3098.         Sub New()
  3099.             SetStyle(ControlStyles.SupportsTransparentBackColor, True)
  3100.             SetStyle(ControlStyles.UserPaint, True)
  3101.  
  3102.             Text = Nothing
  3103.             DoubleBuffered = True
  3104.         End Sub
  3105.  
  3106.         Protected Overrides Sub OnResize(e As EventArgs)
  3107.             MyBase.OnResize(e)
  3108.             ' Make the width and height of the control unchangeable
  3109.             Height = 20
  3110.             Width = 20
  3111.         End Sub
  3112.  
  3113.         Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  3114.             MyBase.OnPaint(e)
  3115.             With e.Graphics
  3116.                 .Clear(BackColor)
  3117.                 .SmoothingMode = SmoothingMode.AntiAlias
  3118.  
  3119.                 Dim LGB As New LinearGradientBrush(New Rectangle(New Point(0, 0), New Size(18, 20)), Color.FromArgb(197, 69, 68), Color.FromArgb(176, 52, 52), 90.0F)
  3120.  
  3121.                 .FillEllipse(LGB, New Rectangle(New Point(0, 0), New Size(18, 18)))
  3122.                 .DrawEllipse(New Pen(Color.FromArgb(205, 70, 66)), New Rectangle(New Point(0, 0), New Size(18, 18))) ' Draw border
  3123.                 .DrawString(_Value, New Font("Segoe UI", 8, FontStyle.Bold), New SolidBrush(Color.FromArgb(255, 255, 253)), New Rectangle(0, 0, Width - 2, Height), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  3124.             End With
  3125.             e.Dispose()
  3126.         End Sub
  3127.     End Class
  3128.  
  3129. #End Region
  3130. #Region " ListView "
  3131.  
  3132.     Class iTalk_Listview
  3133.         Inherits ListView
  3134.  
  3135.         <DllImport("uxtheme", CharSet:=CharSet.Unicode)> _
  3136.         Public Shared Function SetWindowTheme(ByVal hWnd As IntPtr, ByVal textSubAppName As String, ByVal textSubIdList As String) As Integer
  3137.         End Function
  3138.  
  3139.         Public Sub New()
  3140.             Me.SetStyle(ControlStyles.OptimizedDoubleBuffer, True)
  3141.             Me.DoubleBuffered = True
  3142.             HeaderStyle = ColumnHeaderStyle.Nonclickable
  3143.             BorderStyle = Windows.Forms.BorderStyle.None ' Add the control to iTalk_Panel then full-dock it
  3144.         End Sub
  3145.  
  3146.         Protected Overrides Sub OnHandleCreated(ByVal e As EventArgs)
  3147.             iTalk_Listview.SetWindowTheme(Me.Handle, "explorer", Nothing)
  3148.             MyBase.OnHandleCreated(e)
  3149.         End Sub
  3150.     End Class
  3151.  
  3152. #End Region
  3153. #Region " ComboBox "
  3154.  
  3155.     Class iTalk_ComboBox
  3156.         Inherits ComboBox
  3157.  
  3158. #Region " Variables "
  3159.  
  3160.         Private _StartIndex As Integer = 0
  3161.         Private _HoverSelectionColor As Color = Color.FromArgb(241, 241, 241)
  3162.  
  3163. #End Region
  3164. #Region " Custom Properties "
  3165.  
  3166.         Public Property StartIndex As Integer
  3167.             Get
  3168.                 Return _StartIndex
  3169.             End Get
  3170.             Set(ByVal value As Integer)
  3171.                 _StartIndex = value
  3172.                 Try
  3173.                     MyBase.SelectedIndex = value
  3174.                 Catch
  3175.                 End Try
  3176.                 Invalidate()
  3177.             End Set
  3178.         End Property
  3179.  
  3180.         Public Property HoverSelectionColor As Color
  3181.             Get
  3182.                 Return _HoverSelectionColor
  3183.             End Get
  3184.             Set(value As Color)
  3185.                 _HoverSelectionColor = value
  3186.                 Invalidate()
  3187.             End Set
  3188.         End Property
  3189.  
  3190. #End Region
  3191. #Region " EventArgs "
  3192.  
  3193.         Protected Overrides Sub OnDrawItem(e As DrawItemEventArgs)
  3194.             If (e.State And DrawItemState.Selected) = DrawItemState.Selected Then
  3195.                 e.Graphics.FillRectangle(New SolidBrush(_HoverSelectionColor), e.Bounds)
  3196.             Else
  3197.                 e.Graphics.FillRectangle(Brushes.White, e.Bounds)
  3198.             End If
  3199.  
  3200.             If Not e.Index = -1 Then
  3201.                 e.Graphics.DrawString(GetItemText(Items(e.Index)), e.Font, Brushes.DimGray, e.Bounds)
  3202.             End If
  3203.         End Sub
  3204.  
  3205.         Protected Overrides Sub OnLostFocus(e As EventArgs)
  3206.             MyBase.OnLostFocus(e)
  3207.             SuspendLayout()
  3208.             Update()
  3209.             ResumeLayout()
  3210.         End Sub
  3211.  
  3212.         Protected Overrides Sub OnPaintBackground(e As PaintEventArgs)
  3213.             MyBase.OnPaintBackground(e)
  3214.         End Sub
  3215.  
  3216. #End Region
  3217.  
  3218.         Sub New()
  3219.             SetStyle(DirectCast(139286, ControlStyles), True)
  3220.             SetStyle(ControlStyles.Selectable, False)
  3221.  
  3222.             DrawMode = Windows.Forms.DrawMode.OwnerDrawFixed
  3223.             DropDownStyle = ComboBoxStyle.DropDownList
  3224.  
  3225.             BackColor = Color.FromArgb(246, 246, 246)
  3226.             ForeColor = Color.FromArgb(142, 142, 142)
  3227.             Size = New Size(135, 26)
  3228.             ItemHeight = 20
  3229.             DropDownHeight = 100
  3230.             Font = New Font("Segoe UI", 10, FontStyle.Regular)
  3231.         End Sub
  3232.  
  3233.         Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  3234.             MyBase.OnPaint(e)
  3235.             Dim LGB As LinearGradientBrush
  3236.             Dim GP As GraphicsPath
  3237.  
  3238.             e.Graphics.Clear(BackColor)
  3239.             e.Graphics.SmoothingMode = SmoothingMode.AntiAlias
  3240.  
  3241.             ' Create a curvy border
  3242.             GP = RoundRectangle.RoundRect(0, 0, Width - 1, Height - 1, 5)
  3243.             ' Fills the body of the rectangle with a gradient
  3244.             LGB = New LinearGradientBrush(ClientRectangle, Color.FromArgb(241, 241, 241), Color.FromArgb(241, 241, 241), 90.0F)
  3245.  
  3246.             e.Graphics.SetClip(GP)
  3247.             e.Graphics.FillRectangle(LGB, ClientRectangle)
  3248.             e.Graphics.ResetClip()
  3249.  
  3250.             ' Draw rectangle border
  3251.             e.Graphics.DrawPath(New Pen(Color.FromArgb(204, 204, 204)), GP)
  3252.             ' Draw string
  3253.             e.Graphics.DrawString(Text, Font, New SolidBrush(Color.FromArgb(142, 142, 142)), New Rectangle(3, 0, Width - 20, Height), New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Near})
  3254.  
  3255.             ' Draw the dropdown arrow
  3256.             e.Graphics.DrawLine(New Pen(Color.FromArgb(160, 160, 160), 2), New Point(Width - 18, 10), New Point(Width - 14, 14))
  3257.             e.Graphics.DrawLine(New Pen(Color.FromArgb(160, 160, 160), 2), New Point(Width - 14, 14), New Point(Width - 10, 10))
  3258.             e.Graphics.DrawLine(New Pen(Color.FromArgb(160, 160, 160)), New Point(Width - 14, 15), New Point(Width - 14, 14))
  3259.  
  3260.             GP.Dispose()
  3261.             LGB.Dispose()
  3262.         End Sub
  3263.     End Class
  3264.  
  3265. #End Region
  3266. #Region " Circular ProgressBar "
  3267.  
  3268.     Public Class iTalk_ProgressBar
  3269.         Inherits Control
  3270.  
  3271. #Region " Enums "
  3272.  
  3273.         Enum _ProgressShape
  3274.             Round
  3275.             Flat
  3276.         End Enum
  3277.  
  3278. #End Region
  3279. #Region " Variables "
  3280.  
  3281.         Private _Value As Long
  3282.         Private _Maximum As Long = 100
  3283.         Private _ProgressColor1 As Color = Color.FromArgb(92, 92, 92)
  3284.         Private _ProgressColor2 As Color = Color.FromArgb(92, 92, 92)
  3285.         Private ProgressShapeVal As _ProgressShape
  3286.  
  3287. #End Region
  3288. #Region " Custom Properties "
  3289.  
  3290.         Public Property Value() As Long
  3291.             Get
  3292.                 Return _Value
  3293.             End Get
  3294.             Set(ByVal val As Long)
  3295.                 If val > _Maximum Then val = _Maximum
  3296.                 _Value = val
  3297.                 Invalidate()
  3298.             End Set
  3299.         End Property
  3300.  
  3301.         Public Property Maximum() As Long
  3302.             Get
  3303.                 Return _Maximum
  3304.             End Get
  3305.             Set(ByVal val As Long)
  3306.                 If val < 1 Then val = 1
  3307.                 _Maximum = val
  3308.                 Invalidate()
  3309.             End Set
  3310.         End Property
  3311.  
  3312.         Public Property ProgressColor1 As Color
  3313.             Get
  3314.                 Return _ProgressColor1
  3315.             End Get
  3316.             Set(value As Color)
  3317.                 _ProgressColor1 = value
  3318.                 Invalidate()
  3319.             End Set
  3320.         End Property
  3321.  
  3322.         Public Property ProgressColor2 As Color
  3323.             Get
  3324.                 Return _ProgressColor2
  3325.             End Get
  3326.             Set(value As Color)
  3327.                 _ProgressColor2 = value
  3328.                 Invalidate()
  3329.             End Set
  3330.         End Property
  3331.  
  3332.         Public Property ProgressShape As _ProgressShape
  3333.             Get
  3334.                 Return ProgressShapeVal
  3335.             End Get
  3336.             Set(value As _ProgressShape)
  3337.                 ProgressShapeVal = value
  3338.                 Invalidate()
  3339.             End Set
  3340.         End Property
  3341.  
  3342. #End Region
  3343. #Region " EventArgs "
  3344.  
  3345.         Protected Overrides Sub OnResize(e As EventArgs)
  3346.             MyBase.OnResize(e)
  3347.             SetStandardSize()
  3348.         End Sub
  3349.  
  3350.         Protected Overrides Sub OnSizeChanged(e As EventArgs)
  3351.             MyBase.OnSizeChanged(e)
  3352.             SetStandardSize()
  3353.         End Sub
  3354.  
  3355.         Protected Overrides Sub OnPaintBackground(ByVal p As PaintEventArgs)
  3356.             MyBase.OnPaintBackground(p)
  3357.         End Sub
  3358.  
  3359. #End Region
  3360.  
  3361.         Sub New()
  3362.             Size = New Size(130, 130)
  3363.             Font = New Font("Segoe UI", 15)
  3364.             MinimumSize = New Size(100, 100)
  3365.             DoubleBuffered = True ' Reduce flicker
  3366.         End Sub
  3367.  
  3368.         Private Sub SetStandardSize()
  3369.             Dim _Size As Integer = Math.Max(Width, Height)
  3370.             Size = New Size(_Size, _Size)
  3371.         End Sub
  3372.  
  3373.         Public Sub Increment(Value As Integer)
  3374.             Me._Value += Value
  3375.             Invalidate()
  3376.         End Sub
  3377.  
  3378.         Public Sub Decrement(Value As Integer)
  3379.             Me._Value -= Value
  3380.             Invalidate()
  3381.         End Sub
  3382.  
  3383.         Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  3384.             MyBase.OnPaint(e)
  3385.  
  3386.             Using B As New Bitmap(Width, Height) ' Create an image buffer
  3387.                 Using G As Graphics = Graphics.FromImage(B)
  3388.  
  3389.                     G.SmoothingMode = SmoothingMode.AntiAlias
  3390.                     G.Clear(BackColor)
  3391.  
  3392.                     Using LGB As New LinearGradientBrush(ClientRectangle, _ProgressColor1, _ProgressColor2, LinearGradientMode.ForwardDiagonal)
  3393.                         Using P As New Pen(LGB, 14)
  3394.  
  3395.                             Select Case ProgressShapeVal
  3396.                                 Case _ProgressShape.Round
  3397.                                     P.StartCap = LineCap.Round
  3398.                                     P.EndCap = LineCap.Round
  3399.                                 Case _ProgressShape.Flat
  3400.                                     P.StartCap = LineCap.Flat
  3401.                                     P.EndCap = LineCap.Flat
  3402.                             End Select
  3403.  
  3404.                             G.DrawArc(P, CInt(35 / 2), CInt(35 / 2), Width - 35 - 2, Height - 35 - 2, -90, CInt((360 / _Maximum) * _Value))
  3405.                         End Using
  3406.                     End Using
  3407.  
  3408.                     ' Draw progress base/center object
  3409.                     Using LGB As New LinearGradientBrush(ClientRectangle, Color.FromArgb(52, 52, 52), Color.FromArgb(52, 52, 52), LinearGradientMode.Vertical)
  3410.                         G.FillEllipse(LGB, 24, 24, Width - 24 * 2 - 1, Height - 24 * 2 - 1)
  3411.                     End Using
  3412.  
  3413.                     ' Draw progress value
  3414.                     Dim MS As SizeF = G.MeasureString(CStr(CInt((100 / _Maximum) * _Value)), Font)
  3415.                     G.DrawString(CStr(CInt((100 / _Maximum) * _Value)), Font, Brushes.White, CInt(Width / 2 - MS.Width / 2), CInt(Height / 2 - MS.Height / 2))
  3416.  
  3417.                     e.Graphics.DrawImage(B, 0, 0) ' Create the output
  3418.                     ' Dispose drawing objects when finished
  3419.                     G.Dispose()
  3420.                     B.Dispose()
  3421.                 End Using
  3422.             End Using
  3423.         End Sub
  3424.     End Class
  3425.  
  3426. #End Region
  3427. #Region " Progress Indicator "
  3428.  
  3429.     Class iTalk_ProgressIndicator
  3430.         Inherits Control
  3431.  
  3432. #Region " Variables "
  3433.  
  3434.         Private ReadOnly BaseColor As New SolidBrush(Color.DarkGray)
  3435.         Private ReadOnly AnimationColor As New SolidBrush(Color.DimGray)
  3436.         Private ReadOnly AnimationSpeed As New Timer()
  3437.  
  3438.         Private FloatPoint As PointF()
  3439.         Private BuffGraphics As BufferedGraphics
  3440.         Private IndicatorIndex As Integer
  3441.         Private ReadOnly GraphicsContext As BufferedGraphicsContext = BufferedGraphicsManager.Current
  3442.  
  3443. #End Region
  3444. #Region " Custom Properties "
  3445.  
  3446.         Public Property P_BaseColor() As Color
  3447.             Get
  3448.                 Return BaseColor.Color
  3449.             End Get
  3450.             Set(val As Color)
  3451.                 BaseColor.Color = val
  3452.             End Set
  3453.         End Property
  3454.  
  3455.         Public Property P_AnimationColor() As Color
  3456.             Get
  3457.                 Return AnimationColor.Color
  3458.             End Get
  3459.             Set(val As Color)
  3460.                 AnimationColor.Color = val
  3461.             End Set
  3462.         End Property
  3463.  
  3464.         Public Property P_AnimationSpeed() As Integer
  3465.             Get
  3466.                 Return AnimationSpeed.Interval
  3467.             End Get
  3468.             Set(val As Integer)
  3469.                 AnimationSpeed.Interval = val
  3470.             End Set
  3471.         End Property
  3472.  
  3473. #End Region
  3474. #Region " EventArgs "
  3475.  
  3476.         Protected Overrides Sub OnSizeChanged(e As EventArgs)
  3477.             MyBase.OnSizeChanged(e)
  3478.             SetStandardSize()
  3479.             UpdateGraphics()
  3480.             SetPoints()
  3481.         End Sub
  3482.  
  3483.         Protected Overrides Sub OnEnabledChanged(e As EventArgs)
  3484.             MyBase.OnEnabledChanged(e)
  3485.             AnimationSpeed.Enabled = Me.Enabled
  3486.         End Sub
  3487.  
  3488.         Protected Overrides Sub OnHandleCreated(e As EventArgs)
  3489.             MyBase.OnHandleCreated(e)
  3490.             AddHandler AnimationSpeed.Tick, AddressOf AnimationSpeed_Tick
  3491.             AnimationSpeed.Start()
  3492.         End Sub
  3493.  
  3494.         Private Sub AnimationSpeed_Tick(sender As Object, e As EventArgs)
  3495.             If IndicatorIndex.Equals(0) Then
  3496.                 IndicatorIndex = FloatPoint.Length - 1
  3497.             Else
  3498.                 IndicatorIndex -= 1
  3499.             End If
  3500.             Me.Invalidate(False)
  3501.         End Sub
  3502.  
  3503. #End Region
  3504.  
  3505.         Public Sub New()
  3506.             Me.SetStyle(ControlStyles.AllPaintingInWmPaint Or _
  3507.                         ControlStyles.UserPaint Or _
  3508.                         ControlStyles.ResizeRedraw Or _
  3509.                         ControlStyles.OptimizedDoubleBuffer, True)
  3510.  
  3511.             Size = New Size(80, 80)
  3512.             Text = String.Empty
  3513.             MinimumSize = New Size(80, 80)
  3514.             SetPoints()
  3515.             AnimationSpeed.Interval = 100
  3516.         End Sub
  3517.  
  3518.         Private Sub SetStandardSize()
  3519.             Dim _Size As Integer = Math.Max(Width, Height)
  3520.             Size = New Size(_Size, _Size)
  3521.         End Sub
  3522.  
  3523.         Private Sub SetPoints()
  3524.             Dim FPStack = New Stack(Of PointF)()
  3525.             Dim centerPoint As New PointF(Me.Width / 2.0F, Me.Height / 2.0F)
  3526.             Dim i As Single = 0
  3527.  
  3528.             While i < 360.0F
  3529.                 SetValue(centerPoint, Me.Width / 2 - 15, i)
  3530.                 Dim FP As PointF = EndPoint
  3531.                 FP = New PointF(FP.X - 15 / 2.0F, FP.Y - 15 / 2.0F)
  3532.                 FPStack.Push(FP)
  3533.                 i += 360.0F / 8
  3534.             End While
  3535.             FloatPoint = FPStack.ToArray()
  3536.         End Sub
  3537.  
  3538.         Private Sub UpdateGraphics()
  3539.             If Me.Width > 0 AndAlso Me.Height > 0 Then
  3540.                 GraphicsContext.MaximumBuffer = New Size(Me.Width + 1, Me.Height + 1)
  3541.                 BuffGraphics = GraphicsContext.Allocate(Me.CreateGraphics(), Me.ClientRectangle)
  3542.                 BuffGraphics.Graphics.SmoothingMode = SmoothingMode.AntiAlias
  3543.             End If
  3544.         End Sub
  3545.  
  3546.         Protected Overrides Sub OnPaint(e As PaintEventArgs)
  3547.             MyBase.OnPaint(e)
  3548.             BuffGraphics.Graphics.Clear(Me.BackColor)
  3549.  
  3550.             For i As Integer = 0 To FloatPoint.Length - 1
  3551.                 If IndicatorIndex = i Then
  3552.                     BuffGraphics.Graphics.FillEllipse(AnimationColor, FloatPoint(i).X, FloatPoint(i).Y, 15, 15)
  3553.                 Else
  3554.                     BuffGraphics.Graphics.FillEllipse(BaseColor, FloatPoint(i).X, FloatPoint(i).Y, 15, 15)
  3555.                 End If
  3556.             Next
  3557.             BuffGraphics.Render(e.Graphics)
  3558.         End Sub
  3559.  
  3560.         Private Rise As Double, Run As Double
  3561.         Private _StartingFloatPoint As PointF
  3562.  
  3563.         Private Function AssignValues(Of X)(ByRef Run As X, Length As X) As X
  3564.             Run = Length
  3565.             Return Length
  3566.         End Function
  3567.  
  3568.         Private Sub SetValue(StartingFloatPoint As PointF, Length As Integer, Angle As Double)
  3569.             Dim CircleRadian As Double = Math.PI * Angle / 180.0
  3570.  
  3571.             _StartingFloatPoint = StartingFloatPoint
  3572.             Rise = AssignValues(Run, Length)
  3573.             Rise = Math.Sin(CircleRadian) * Rise
  3574.             Run = Math.Cos(CircleRadian) * Run
  3575.         End Sub
  3576.  
  3577.         Private ReadOnly Property EndPoint() As PointF
  3578.             Get
  3579.                 Dim LocationX As Single = CSng(_StartingFloatPoint.Y + Rise)
  3580.                 Dim LocationY As Single = CSng(_StartingFloatPoint.X + Run)
  3581.  
  3582.                 Return New PointF(LocationY, LocationX)
  3583.             End Get
  3584.         End Property
  3585.     End Class
  3586.  
  3587. #End Region
  3588. #Region " TabControl "
  3589.  
  3590.     Class iTalk_TabControl
  3591.         Inherits TabControl
  3592.  
  3593.         ' NOTE: For best quality icons/images on the TabControl; from the associated ImageList, set
  3594.         ' the image size (24,24) so it can fit in the tab rectangle. However, to ensure a
  3595.         ' high-quality image drawing, make sure you only add (32,32) images and not (24,24) as
  3596.         ' determined in the ImageList
  3597.  
  3598.         ' INFO: A free, non-commercial icon list that would fit in perfectly with the TabControl is
  3599.         ' Wireframe Toolbar Icons by Gentleface. Licensed under Creative Commons Attribution.
  3600.         ' Check it out from here: http://www.gentleface.com/free_icon_set.html
  3601.  
  3602.         Sub New()
  3603.             SetStyle(ControlStyles.AllPaintingInWmPaint Or _
  3604.                      ControlStyles.UserPaint Or _
  3605.                      ControlStyles.ResizeRedraw Or _
  3606.                      ControlStyles.DoubleBuffer, True)
  3607.  
  3608.             DoubleBuffered = True
  3609.             SizeMode = TabSizeMode.Fixed
  3610.             ItemSize = New Size(44, 135)
  3611.             DrawMode = TabDrawMode.OwnerDrawFixed
  3612.  
  3613.             For Each Page As TabPage In Me.TabPages
  3614.                 Page.BackColor = Color.FromArgb(246, 246, 246)
  3615.             Next
  3616.         End Sub
  3617.  
  3618.         Protected Overrides Sub OnControlAdded(ByVal e As ControlEventArgs)
  3619.             MyBase.OnControlAdded(e)
  3620.             If TypeOf e.Control Is TabPage Then
  3621.                 For Each i As TabPage In Me.Controls
  3622.                     i = New TabPage
  3623.                 Next
  3624.                 e.Control.BackColor = Color.FromArgb(246, 246, 246)
  3625.             End If
  3626.         End Sub
  3627.  
  3628.         Protected Overrides Sub CreateHandle()
  3629.             MyBase.CreateHandle()
  3630.  
  3631.             MyBase.DoubleBuffered = True
  3632.             SizeMode = TabSizeMode.Fixed
  3633.             Appearance = TabAppearance.Normal
  3634.             Alignment = TabAlignment.Left
  3635.         End Sub
  3636.  
  3637.         Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  3638.             MyBase.OnPaint(e)
  3639.             Dim B As New Bitmap(Width, Height)
  3640.             Dim G As Graphics = Graphics.FromImage(B)
  3641.  
  3642.             With G
  3643.  
  3644.                 .Clear(Color.FromArgb(246, 246, 246))
  3645.                 .SmoothingMode = SmoothingMode.HighSpeed
  3646.                 .CompositingQuality = Drawing2D.CompositingQuality.HighSpeed
  3647.                 .CompositingMode = Drawing2D.CompositingMode.SourceOver
  3648.  
  3649.                 ' Draw tab selector background
  3650.                 .FillRectangle(New SolidBrush(Color.FromArgb(54, 57, 64)), New Rectangle(-5, 0, ItemSize.Height + 4, Height))
  3651.                 ' Draw vertical line at the end of the tab selector rectangle
  3652.                 .DrawLine(New Pen(Color.FromArgb(25, 26, 28)), ItemSize.Height - 1, 0, ItemSize.Height - 1, Height)
  3653.  
  3654.                 For TabIndex As Integer = 0 To TabCount - 1
  3655.                     If TabIndex = SelectedIndex Then
  3656.                         Dim TabRect As Rectangle = New Rectangle(New Point(GetTabRect(TabIndex).Location.X - 2, GetTabRect(TabIndex).Location.Y - 2), New Size(GetTabRect(TabIndex).Width + 3, GetTabRect(TabIndex).Height - 8))
  3657.  
  3658.                         ' Draw background of the selected tab
  3659.                         .FillRectangle(New SolidBrush(Color.FromArgb(35, 36, 38)), TabRect.X, TabRect.Y, TabRect.Width - 4, TabRect.Height + 3)
  3660.                         ' Draw a tab highlighter on the background of the selected tab
  3661.                         Dim TabHighlighter As Rectangle = New Rectangle(New Point(GetTabRect(TabIndex).X - 2, GetTabRect(TabIndex).Location.Y - IIf(TabIndex = 0, 1, 1)), New Size(4, GetTabRect(TabIndex).Height - 7))
  3662.                         .FillRectangle(New SolidBrush(Color.FromArgb(89, 169, 222)), TabHighlighter)
  3663.                         ' Draw tab text
  3664.                         .DrawString(TabPages(TabIndex).Text, New Font(Font.FontFamily, Font.Size, FontStyle.Bold), New SolidBrush(Color.FromArgb(254, 255, 255)), New Rectangle(TabRect.Left + 40, TabRect.Top + 12, TabRect.Width - 40, TabRect.Height), New StringFormat With {.Alignment = StringAlignment.Near})
  3665.  
  3666.                         If Me.ImageList IsNot Nothing Then
  3667.                             Dim Index As Integer = TabPages(TabIndex).ImageIndex
  3668.                             If Not Index = -1 Then
  3669.                                 .DrawImage(Me.ImageList.Images.Item(TabPages(TabIndex).ImageIndex), TabRect.X + 9, TabRect.Y + 6, 24, 24)
  3670.                             End If
  3671.                         End If
  3672.  
  3673.                     Else
  3674.  
  3675.                         Dim TabRect As Rectangle = New Rectangle(New Point(GetTabRect(TabIndex).Location.X - 2, GetTabRect(TabIndex).Location.Y - 2), New Size(GetTabRect(TabIndex).Width + 3, GetTabRect(TabIndex).Height - 8))
  3676.                         ' Draw tab text
  3677.                         .DrawString(TabPages(TabIndex).Text, New Font(Font.FontFamily, Font.Size, FontStyle.Bold), New SolidBrush(Color.FromArgb(159, 162, 167)), New Rectangle(TabRect.Left + 40, TabRect.Top + 12, TabRect.Width - 40, TabRect.Height), New StringFormat With {.Alignment = StringAlignment.Near})
  3678.  
  3679.                         If Me.ImageList IsNot Nothing Then
  3680.                             Dim Index As Integer = TabPages(TabIndex).ImageIndex
  3681.                             If Not Index = -1 Then
  3682.                                 .DrawImage(Me.ImageList.Images.Item(TabPages(TabIndex).ImageIndex), TabRect.X + 9, TabRect.Y + 6, 24, 24)
  3683.                             End If
  3684.                         End If
  3685.  
  3686.                     End If
  3687.                 Next
  3688.                 e.Graphics.SmoothingMode = SmoothingMode.HighQuality
  3689.                 e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic
  3690.                 e.Graphics.CompositingQuality = CompositingQuality.HighQuality
  3691.                 e.Graphics.DrawImage(B.Clone, 0, 0)
  3692.                 G.Dispose()
  3693.                 B.Dispose()
  3694.             End With
  3695.         End Sub
  3696.     End Class
  3697.  
  3698. #End Region
  3699. #Region " TrackBar "
  3700.  
  3701.     <DefaultEvent("ValueChanged")> Class iTalk_TrackBar
  3702.         Inherits Control
  3703.  
  3704. #Region " Enums "
  3705.  
  3706.         Enum ValueDivisor
  3707.             By1 = 1
  3708.             By10 = 10
  3709.             By100 = 100
  3710.             By1000 = 1000
  3711.         End Enum
  3712.  
  3713. #End Region
  3714. #Region " Variables "
  3715.  
  3716.         Private PipeBorder, TrackBarHandle As GraphicsPath
  3717.         Private TrackBarHandleRect, ValueRect As Rectangle
  3718.         Private VlaueLGB, TrackBarHandleLGB As LinearGradientBrush
  3719.         Private Cap As Boolean
  3720.         Private ValueDrawer As Integer
  3721.  
  3722.         Private _Minimum As Integer = 0
  3723.         Private _Maximum As Integer = 10
  3724.         Private _Value As Integer = 0
  3725.         Private _ValueColour As Color = Color.FromArgb(224, 224, 224)
  3726.         Private _DrawHatch As Boolean = True
  3727.         Private _DrawValueString As Boolean = False
  3728.         Private _JumpToMouse As Boolean = False
  3729.         Private DividedValue As ValueDivisor = ValueDivisor.By1
  3730.  
  3731. #End Region
  3732. #Region " Custom Properties "
  3733.  
  3734.         Public Property Minimum() As Integer
  3735.             Get
  3736.                 Return _Minimum
  3737.             End Get
  3738.             Set(ByVal value As Integer)
  3739.  
  3740.                 If value >= _Maximum Then value = _Maximum - 10
  3741.                 If _Value < value Then _Value = value
  3742.  
  3743.                 _Minimum = value
  3744.                 Invalidate()
  3745.             End Set
  3746.         End Property
  3747.  
  3748.         Public Property Maximum() As Integer
  3749.             Get
  3750.                 Return _Maximum
  3751.             End Get
  3752.             Set(ByVal value As Integer)
  3753.  
  3754.                 If value <= _Minimum Then value = _Minimum + 10
  3755.                 If _Value > value Then _Value = value
  3756.  
  3757.                 _Maximum = value
  3758.                 Invalidate()
  3759.             End Set
  3760.         End Property
  3761.  
  3762.         Event ValueChanged()
  3763.         Public Property Value() As Integer
  3764.             Get
  3765.                 Return _Value
  3766.             End Get
  3767.             Set(ByVal value As Integer)
  3768.                 If _Value <> value Then
  3769.                     If value < _Minimum Then
  3770.                         _Value = _Minimum
  3771.                     Else
  3772.                         If value > _Maximum Then
  3773.                             _Value = _Maximum
  3774.                         Else
  3775.                             _Value = value
  3776.                         End If
  3777.                     End If
  3778.                     Invalidate()
  3779.                     RaiseEvent ValueChanged()
  3780.                 End If
  3781.             End Set
  3782.         End Property
  3783.  
  3784.         Public Property ValueDivison() As ValueDivisor
  3785.             Get
  3786.                 Return DividedValue
  3787.             End Get
  3788.             Set(ByVal Value As ValueDivisor)
  3789.                 DividedValue = Value
  3790.                 Invalidate()
  3791.             End Set
  3792.         End Property
  3793.  
  3794.         <Browsable(False)> Public Property ValueToSet() As Single
  3795.             Get
  3796.                 Return CSng(_Value / DividedValue)
  3797.             End Get
  3798.             Set(ByVal Val As Single)
  3799.                 Value = CInt(Val * DividedValue)
  3800.             End Set
  3801.         End Property
  3802.  
  3803.         Public Property ValueColour As Color
  3804.             Get
  3805.                 Return _ValueColour
  3806.             End Get
  3807.             Set(value As Color)
  3808.                 _ValueColour = value
  3809.                 Invalidate()
  3810.             End Set
  3811.         End Property
  3812.  
  3813.         Property DrawHatch() As Boolean
  3814.             Get
  3815.                 Return _DrawHatch
  3816.             End Get
  3817.             Set(ByVal v As Boolean)
  3818.                 _DrawHatch = v
  3819.                 Invalidate()
  3820.             End Set
  3821.         End Property
  3822.  
  3823.         Property DrawValueString() As Boolean
  3824.             Get
  3825.                 Return _DrawValueString
  3826.             End Get
  3827.             Set(ByVal v As Boolean)
  3828.                 _DrawValueString = v
  3829.                 If _DrawValueString = True Then
  3830.                     Height = 40
  3831.                 Else
  3832.                     Height = 22
  3833.                 End If
  3834.                 Invalidate()
  3835.             End Set
  3836.         End Property
  3837.  
  3838.         Public Property JumpToMouse() As Boolean
  3839.             Get
  3840.                 Return _JumpToMouse
  3841.             End Get
  3842.             Set(ByVal value As Boolean)
  3843.                 _JumpToMouse = value
  3844.             End Set
  3845.         End Property
  3846.  
  3847. #End Region
  3848. #Region " EventArgs "
  3849.  
  3850.         Protected Overrides Sub OnMouseMove(ByVal e As MouseEventArgs)
  3851.             MyBase.OnMouseMove(e)
  3852.             If Cap = True AndAlso e.X > -1 AndAlso e.X < (Width + 1) Then
  3853.                 Value = _Minimum + CInt((_Maximum - _Minimum) * (e.X / Width))
  3854.             End If
  3855.         End Sub
  3856.  
  3857.         Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  3858.             MyBase.OnMouseDown(e)
  3859.             If e.Button = Windows.Forms.MouseButtons.Left Then
  3860.                 ValueDrawer = CInt((_Value - _Minimum) / (_Maximum - _Minimum) * (Width - 11))
  3861.                 TrackBarHandleRect = New Rectangle(ValueDrawer, 0, 10, 20)
  3862.                 Cap = TrackBarHandleRect.Contains(e.Location)
  3863.                 If _JumpToMouse Then
  3864.                     Value = _Minimum + CInt((_Maximum - _Minimum) * (e.X / Width))
  3865.                 End If
  3866.             End If
  3867.         End Sub
  3868.  
  3869.         Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  3870.             MyBase.OnMouseUp(e)
  3871.             Cap = False
  3872.         End Sub
  3873.  
  3874. #End Region
  3875.  
  3876.         Sub New()
  3877.             SetStyle(ControlStyles.AllPaintingInWmPaint Or _
  3878.              ControlStyles.UserPaint Or _
  3879.              ControlStyles.ResizeRedraw Or _
  3880.              ControlStyles.DoubleBuffer, True)
  3881.  
  3882.             _DrawHatch = True
  3883.             Size = New Size(80, 22)
  3884.             MinimumSize = New Size(37, 22)
  3885.         End Sub
  3886.  
  3887.         Protected Overrides Sub OnResize(e As EventArgs)
  3888.             MyBase.OnResize(e)
  3889.             If _DrawValueString = True Then
  3890.                 Height = 40
  3891.             Else
  3892.                 Height = 22
  3893.             End If
  3894.         End Sub
  3895.  
  3896.         Protected Overrides Sub OnPaint(e As System.Windows.Forms.PaintEventArgs)
  3897.             MyBase.OnPaint(e)
  3898.             Dim G As Graphics = e.Graphics
  3899.             Dim Hatch As New HatchBrush(HatchStyle.WideDownwardDiagonal, Color.FromArgb(20, Color.Black), Color.Transparent)
  3900.  
  3901.             G.Clear(Parent.BackColor)
  3902.             G.SmoothingMode = SmoothingMode.AntiAlias
  3903.  
  3904.             PipeBorder = RoundRectangle.RoundRect(1, 6, Width - 3, 8, 3)
  3905.  
  3906.             Try
  3907.                 ValueDrawer = CInt((_Value - _Minimum) / (_Maximum - _Minimum) * (Width - 11))
  3908.             Catch ex As Exception
  3909.             End Try
  3910.  
  3911.             TrackBarHandleRect = New Rectangle(ValueDrawer, 0, 10, 20)
  3912.  
  3913.             G.SetClip(PipeBorder) ' Set the clipping region of this Graphics to the specified GraphicsPath
  3914.  
  3915.             ValueRect = New Rectangle(1, 7, TrackBarHandleRect.X + TrackBarHandleRect.Width - 2, 7)
  3916.             VlaueLGB = New LinearGradientBrush(ValueRect, _ValueColour, _ValueColour, 90.0F)
  3917.  
  3918.             G.FillRectangle(VlaueLGB, ValueRect)
  3919.  
  3920.             If _DrawHatch = True Then
  3921.                 G.FillRectangle(Hatch, ValueRect)
  3922.             End If
  3923.  
  3924.             G.ResetClip() ' Reset the clip region of this Graphics to an infinite region
  3925.  
  3926.             G.SmoothingMode = SmoothingMode.AntiAlias
  3927.             G.DrawPath(New Pen(Color.FromArgb(180, 180, 180)), PipeBorder) ' Draw pipe border
  3928.  
  3929.             TrackBarHandle = RoundRectangle.RoundRect(TrackBarHandleRect, 3)
  3930.             TrackBarHandleLGB = New LinearGradientBrush(ClientRectangle, SystemColors.Control, SystemColors.Control, 90.0F)
  3931.  
  3932.             ' Fill the handle body with the specified color gradient
  3933.             G.FillPath(TrackBarHandleLGB, TrackBarHandle)
  3934.             ' Draw handle borders
  3935.             G.DrawPath(New Pen(Color.FromArgb(180, 180, 180)), TrackBarHandle)
  3936.  
  3937.             If _DrawValueString = True Then
  3938.                 G.DrawString(ValueToSet, Font, Brushes.Gray, 0, 25)
  3939.             End If
  3940.         End Sub
  3941.     End Class
  3942.  
  3943. #End Region
  3944. #Region " MenuStrip "
  3945.  
  3946.     Public Class iTalk_MenuStrip
  3947.         Inherits MenuStrip
  3948.  
  3949.         Public Sub New()
  3950.             Me.Renderer = New ControlRenderer()
  3951.         End Sub
  3952.  
  3953.         Public Overloads Property Renderer() As ControlRenderer
  3954.             Get
  3955.                 Return DirectCast(MyBase.Renderer, ControlRenderer)
  3956.             End Get
  3957.             Set(ByVal value As ControlRenderer)
  3958.                 MyBase.Renderer = value
  3959.             End Set
  3960.         End Property
  3961.  
  3962.     End Class
  3963.  
  3964. #End Region
  3965. #Region " ContextMenuStrip "
  3966.  
  3967.     Public Class iTalk_ContextMenuStrip
  3968.         Inherits ContextMenuStrip
  3969.  
  3970.         Public Sub New()
  3971.             Me.Renderer = New ControlRenderer()
  3972.         End Sub
  3973.  
  3974.         Public Overloads Property Renderer() As ControlRenderer
  3975.             Get
  3976.                 Return DirectCast(MyBase.Renderer, ControlRenderer)
  3977.             End Get
  3978.             Set(ByVal value As ControlRenderer)
  3979.                 MyBase.Renderer = value
  3980.             End Set
  3981.         End Property
  3982.     End Class
  3983.  
  3984. #End Region
  3985. #Region " StatusStrip "
  3986.  
  3987.     Public Class iTalk_StatusStrip
  3988.         Inherits StatusStrip
  3989.  
  3990.         Public Sub New()
  3991.             Me.Renderer = New ControlRenderer()
  3992.             SizingGrip = False
  3993.         End Sub
  3994.  
  3995.         Public Overloads Property Renderer() As ControlRenderer
  3996.             Get
  3997.                 Return DirectCast(MyBase.Renderer, ControlRenderer)
  3998.             End Get
  3999.             Set(ByVal value As ControlRenderer)
  4000.                 MyBase.Renderer = value
  4001.             End Set
  4002.         End Property
  4003.     End Class
  4004.  
  4005. #End Region
  4006. #Region " Info Icon "
  4007.  
  4008.     Class iTalk_Icon_Info
  4009.         Inherits Control
  4010.         Public Sub New()
  4011.             Me.ForeColor = Color.DimGray
  4012.             Me.BackColor = Color.FromArgb(246, 246, 246)
  4013.             Me.Size = New Size(33, 33)
  4014.             DoubleBuffered = True
  4015.         End Sub
  4016.         Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  4017.             e.Graphics.SmoothingMode = SmoothingMode.HighQuality
  4018.             e.Graphics.TextRenderingHint = TextRenderingHint.ClearTypeGridFit
  4019.  
  4020.             e.Graphics.FillEllipse(New SolidBrush(Color.Gray), New Rectangle(1, 1, 29, 29))
  4021.             e.Graphics.FillEllipse(New SolidBrush(Color.FromArgb(246, 246, 246)), New Rectangle(3, 3, 25, 25))
  4022.  
  4023.             e.Graphics.DrawString("Β‘", New Font("Segoe UI", 25, FontStyle.Bold), New SolidBrush(Color.Gray), New Rectangle(4, -14, Width, 43), New StringFormat() With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Near})
  4024.         End Sub
  4025.     End Class
  4026.  
  4027. #End Region
  4028. #Region " Tick Icon "
  4029. ' Get more free themes at ThemesVB.NET
  4030.     Class iTalk_Icon_Tick
  4031.         Inherits Control
  4032.  
  4033.         Sub New()
  4034.             Me.ForeColor = Color.DimGray
  4035.             Me.BackColor = Color.FromArgb(246, 246, 246)
  4036.             Me.Size = New Size(33, 33)
  4037.             DoubleBuffered = True
  4038.         End Sub
  4039.  
  4040.         Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  4041.             e.Graphics.SmoothingMode = SmoothingMode.HighQuality
  4042.             e.Graphics.TextRenderingHint = TextRenderingHint.ClearTypeGridFit
  4043.  
  4044.             e.Graphics.FillEllipse(New SolidBrush(Color.Gray), New Rectangle(1, 1, 29, 29))
  4045.             e.Graphics.FillEllipse(New SolidBrush(Color.FromArgb(246, 246, 246)), New Rectangle(3, 3, 25, 25))
  4046.  
  4047.             e.Graphics.DrawString("ΓΌ", New Font("Wingdings", 25, FontStyle.Bold), New SolidBrush(Color.Gray), New Rectangle(0, -3, Width, 43), New StringFormat() With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Near})
  4048.         End Sub
  4049.     End Class
  4050.  
  4051. #End Region
  4052.  
  4053. End Namespace
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement