PDA

View Full Version : iTalk Theme



Rickafds
01/01/2016, 11:32 AM
[Only registered and activated users can see links]



Module RoundRectangle
Public Function RoundRect(ByVal Rectangle As Rectangle, ByVal Curve As Integer) As GraphicsPath
Dim P As GraphicsPath = New GraphicsPath()
Dim ArcRectangleWidth As Integer = Curve * 2
P.AddArc(New Rectangle(Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -180, 90)
P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -90, 90)
P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 0, 90)
P.AddArc(New Rectangle(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 90, 90)
P.AddLine(New Point(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y), New Point(Rectangle.X, Curve + Rectangle.Y))
Return P
End Function
End Module

#End Region



#Region " ThemeContainer "

Class Chili_ThemeContainer
Inherits ContainerControl

#Region " Enums "

Enum MouseState As Byte
None = 0
Over = 1
Down = 2
Block = 3
End Enum

#End Region
#Region " Variables "

Private HeaderRect As Rectangle
Protected State As MouseState
Private MoveHeight As Integer
Private MouseP As Point = New Point(0, 0)
Private Cap As Boolean = False
Private HasShown As Boolean

#End Region
#Region " Properties "

Private _Sizable As Boolean = True
Property Sizable() As Boolean
Get
Return _Sizable
End Get
Set(ByVal value As Boolean)
_Sizable = value
End Set
End Property

Private _SmartBounds As Boolean = True
Property SmartBounds() As Boolean
Get
Return _SmartBounds
End Get
Set(ByVal value As Boolean)
_SmartBounds = value
End Set
End Property

Private _RoundCorners As Boolean = True
Property RoundCorners() As Boolean
Get
Return _RoundCorners
End Get
Set(ByVal value As Boolean)
_RoundCorners = value
Invalidate()
End Set
End Property

Private _IsParentForm As Boolean
Protected ReadOnly Property IsParentForm As Boolean
Get
Return _IsParentForm
End Get
End Property

Protected ReadOnly Property IsParentMdi As Boolean
Get
If Parent Is Nothing Then Return False
Return Parent.Parent IsNot Nothing
End Get
End Property

Private _ControlMode As Boolean
Protected Property ControlMode() As Boolean
Get
Return _ControlMode
End Get
Set(ByVal v As Boolean)
_ControlMode = v
Invalidate()
End Set
End Property

Private _StartPosition As FormStartPosition
Property StartPosition As FormStartPosition
Get
If _IsParentForm AndAlso Not _ControlMode Then Return ParentForm.StartPosition Else Return _StartPosition
End Get
Set(ByVal value As FormStartPosition)
_StartPosition = value

If _IsParentForm AndAlso Not _ControlMode Then
ParentForm.StartPosition = value
End If
End Set
End Property

#End Region
#Region " EventArgs "

Protected NotOverridable Overrides Sub OnParentChanged(ByVal e As EventArgs)
MyBase.OnParentChanged(e)

If Parent Is Nothing Then Return
_IsParentForm = TypeOf Parent Is Form

If Not _ControlMode Then
InitializeMessages()

If _IsParentForm Then
Me.ParentForm.FormBorderStyle = FormBorderStyle.None
Me.ParentForm.TransparencyKey = Color.Fuchsia

If Not DesignMode Then
AddHandler ParentForm.Shown, AddressOf FormShown
End If
End If
Parent.BackColor = BackColor
' Parent.MinimumSize = New Size(261, 65)
End If
End Sub

Protected NotOverridable Overrides Sub OnSizeChanged(ByVal e As EventArgs)
MyBase.OnSizeChanged(e)
If Not _ControlMode Then HeaderRect = New Rectangle(0, 0, Width - 14, MoveHeight - 7)
Invalidate()
End Sub

Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
MyBase.OnMouseDown(e)
Focus()
If e.Button = Windows.Forms.MouseButtons.Left Then SetState(MouseState.Down)
If Not (_IsParentForm AndAlso ParentForm.WindowState = FormWindowState.Maximized OrElse _ControlMode) Then
If HeaderRect.Contains(e.Location) Then
Capture = False
WM_LMBUTTONDOWN = True
DefWndProc(Messages(0))
ElseIf _Sizable AndAlso Not Previous = 0 Then
Capture = False
WM_LMBUTTONDOWN = True
DefWndProc(Messages(Previous))
End If
End If
End Sub

Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
MyBase.OnMouseUp(e)
Cap = False
End Sub

Protected Overrides Sub OnMouseMove(ByVal e As System.Windows.Forms.MouseEventArgs)
MyBase.OnMouseMove(e)
If Not (_IsParentForm AndAlso ParentForm.WindowState = FormWindowState.Maximized) Then
If _Sizable AndAlso Not _ControlMode Then InvalidateMouse()
End If
If Cap Then
Parent.Location = MousePosition - MouseP
End If
End Sub

Protected Overrides Sub OnInvalidated(ByVal e As System.Windows.Forms.InvalidateEventArgs)
MyBase.OnInvalidated(e)
ParentForm.Text = Text
End Sub

Protected Overrides Sub OnPaintBackground(e As PaintEventArgs)
MyBase.OnPaintBackground(e)
End Sub

Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
MyBase.OnTextChanged(e)
Invalidate()
End Sub

Private Sub FormShown(ByVal sender As Object, ByVal e As EventArgs)
If _ControlMode OrElse HasShown Then Return

If _StartPosition = FormStartPosition.CenterParent OrElse _StartPosition = FormStartPosition.CenterScreen Then
Dim SB As Rectangle = Screen.PrimaryScreen.Bounds
Dim CB As Rectangle = ParentForm.Bounds
ParentForm.Location = New Point(SB.Width \ 2 - CB.Width \ 2, SB.Height \ 2 - CB.Width \ 2)
End If
HasShown = True
End Sub

#End Region

Protected Overrides Sub CreateHandle()
MyBase.CreateHandle()
End Sub

Sub New()
SetStyle(DirectCast(139270, ControlStyles), True)
BackColor = Color.FromArgb(33, 36, 38)
'Padding = New Padding(10, 70, 10, 9)
DoubleBuffered = True
Dock = DockStyle.Fill
MoveHeight = 166
Font = New Font("Segoe UI", 9)
End Sub

Protected Overrides Sub OnPaint(e As PaintEventArgs)
MyBase.OnPaint(e)
Dim G As Graphics = e.Graphics

G.Clear(Color.FromArgb(33, 36, 38))
G.FillRectangle(New SolidBrush(Color.FromArgb(33, 36, 38)), New Rectangle(0, 0, Width, 60))

If _RoundCorners = True Then

G.FillRectangle(New SolidBrush(Color.FromArgb(33, 36, 38)), Width - 2, Height - 3, 1, 1)
G.FillRectangle(New SolidBrush(Color.FromArgb(33, 36, 38)), Width - 2, Height - 4, 1, 1)
G.FillRectangle(New SolidBrush(Color.FromArgb(33, 36, 38)), Width - 4, Height - 2, 1, 1)
G.FillRectangle(New SolidBrush(Color.FromArgb(33, 36, 38)), Width - 3, Height - 2, 1, 1)
End If
End Sub
End Class

#End Region
#Region " ControlBox "
'
Class Chili_ControlBox
Inherits Control

#Region " Enums "

Enum ButtonHoverState
Minimize
Close
None
End Enum

#End Region
#Region " Variables "

Private ButtonHState As ButtonHoverState = ButtonHoverState.None

#End Region
#Region " Properties "

Private _EnableMaximize As Boolean = True
Property EnableMaximizeButton() As Boolean
Get
Return _EnableMaximize
End Get
Set(ByVal value As Boolean)
_EnableMaximize = value
Invalidate()
End Set
End Property

Private _EnableMinimize As Boolean = True
Property EnableMinimizeButton() As Boolean
Get
Return _EnableMinimize
End Get
Set(ByVal value As Boolean)
_EnableMinimize = value
Invalidate()
End Set
End Property

Private _EnableHoverHighlight As Boolean = False
Property EnableHoverHighlight() As Boolean
Get
Return _EnableHoverHighlight
End Get
Set(ByVal value As Boolean)
_EnableHoverHighlight = value
Invalidate()
End Set
End Property

#End Region
#Region " EventArgs "

Protected Overrides Sub OnResize(ByVal e As EventArgs)
MyBase.OnResize(e)
Size = New Size(100, 25)
End Sub

Protected Overrides Sub OnMouseMove(ByVal e As MouseEventArgs)
MyBase.OnMouseMove(e)
Dim X As Integer = e.Location.X
Dim Y As Integer = e.Location.Y
If Y > 0 AndAlso Y < (Height - 2) Then
If X > 0 AndAlso X < 40 Then
ButtonHState = ButtonHoverState.Minimize
ElseIf X > 64 AndAlso X < Width Then
ButtonHState = ButtonHoverState.Close
Else
ButtonHState = ButtonHoverState.None
End If
Else
ButtonHState = ButtonHoverState.None
End If
Invalidate()
End Sub

Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
MyBase.OnMouseDown(e)
Select Case ButtonHState
Case ButtonHoverState.Close
Parent.FindForm().Close()
Case ButtonHoverState.Minimize
If _EnableMinimize = True Then
Parent.FindForm().WindowState = FormWindowState.Minimized
End If
End Select
End Sub
Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
MyBase.OnMouseLeave(e)
ButtonHState = ButtonHoverState.None : Invalidate()
End Sub

Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
MyBase.OnMouseDown(e)
Focus()
End Sub

#End Region

Sub New()
MyBase.New()
DoubleBuffered = True
Anchor = AnchorStyles.Top Or AnchorStyles.Right
End Sub

Protected Overrides Sub OnCreateControl()
MyBase.OnCreateControl()

End Sub

Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
MyBase.OnPaint(e)
Dim G As Graphics = e.Graphics
G.Clear(Color.FromArgb(33, 36, 38))

If _EnableHoverHighlight = True Then
Select Case ButtonHState
Case ButtonHoverState.None
G.Clear(Color.FromArgb(33, 36, 38))
Case ButtonHoverState.Minimize
If _EnableMinimize = True Then
G.FillRectangle(New SolidBrush(Color.FromArgb(33, 36, 38)), New Rectangle(3, 0, 35, Height))
End If
Case ButtonHoverState.Close
G.FillRectangle(New SolidBrush(Color.FromArgb(33, 36, 38)), New Rectangle(66, 0, 35, Height))
End Select
End If

G.DrawString("r", New Font("Marlett", 11), New SolidBrush(Color.FromArgb(119, 131, 141)), New Point(Width - 16, 8), New StringFormat With {.Alignment = StringAlignment.Center})

If _EnableMinimize = True Then
G.DrawString("0", New Font("Marlett", 11), New SolidBrush(Color.FromArgb(119, 131, 141)), New Point(40, 7), New StringFormat With {.Alignment = StringAlignment.Center})
Else
G.DrawString("0", New Font("Marlett", 11), New SolidBrush(Color.FromArgb(119, 131, 141)), New Point(40, 7), New StringFormat With {.Alignment = StringAlignment.Center})
End If
End Sub
End Class
'
#End Region
#Region " Button "




Class ChiliButton : Inherits Control


Dim _state As MouseState
#Region "Declaration and shits"
Public Function RoundRect(ByVal rectangle As Rectangle, ByVal curve As Integer) As GraphicsPath
Dim p As GraphicsPath = New GraphicsPath()
Dim arcRectangleWidth As Integer = curve * 1
p.AddArc(New Rectangle(rectangle.X, rectangle.Y, arcRectangleWidth, arcRectangleWidth), -180, 90)
p.AddArc(New Rectangle(rectangle.Width - arcRectangleWidth + rectangle.X, rectangle.Y, arcRectangleWidth, arcRectangleWidth), -90, 90)
p.AddArc(New Rectangle(rectangle.Width - arcRectangleWidth + rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y, arcRectangleWidth, arcRectangleWidth), 0, 90)
p.AddArc(New Rectangle(rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y, arcRectangleWidth, arcRectangleWidth), 90, 90)
p.AddLine(New Point(rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y), New Point(rectangle.X, curve + rectangle.Y))
Return p
End Function
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
Dim rectangle As Rectangle = New Rectangle(x, y, width, height)
Dim p As GraphicsPath = New GraphicsPath()
Dim arcRectangleWidth As Integer = curve * 1
p.AddArc(New Rectangle(rectangle.X, rectangle.Y, arcRectangleWidth, arcRectangleWidth), -180, 90)
p.AddArc(New Rectangle(rectangle.Width - arcRectangleWidth + rectangle.X, rectangle.Y, arcRectangleWidth, arcRectangleWidth), -90, 90)
p.AddArc(New Rectangle(rectangle.Width - arcRectangleWidth + rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y, arcRectangleWidth, arcRectangleWidth), 0, 90)
p.AddArc(New Rectangle(rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y, arcRectangleWidth, arcRectangleWidth), 90, 90)
p.AddLine(New Point(rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y), New Point(rectangle.X, curve + rectangle.Y))
Return p
End Function
Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
MyBase.OnMouseDown(e)
_state = MouseState.Down
Invalidate()
End Sub

Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
MyBase.OnMouseUp(e)
_state = MouseState.Over
Invalidate()
End Sub

Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
MyBase.OnMouseEnter(e)
_state = MouseState.Over
Invalidate()
End Sub

Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
MyBase.OnMouseLeave(e)
_state = MouseState.None
Invalidate()
End Sub

#End Region


Sub New()
SetStyle(ControlStyles.UserPaint Or ControlStyles.ResizeRedraw Or ControlStyles.SupportsTransparentBackColor, True)
BackColor = Color.Transparent
DoubleBuffered = True
Size = New Size(150, 28)
_state = MouseState.None
End Sub


Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
Dim b As Bitmap = New Bitmap(Width, Height)
Dim g As Graphics = Graphics.FromImage(b)
Dim rect As Rectangle = New Rectangle(0, 0, Width - 1, Height - 1)
Dim btnfont As New Font("Verdana", 8, FontStyle.Regular)
MyBase.OnPaint(e)
g.SmoothingMode = SmoothingMode.HighQuality
g.InterpolationMode = InterpolationMode.HighQualityBicubic
g.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
g.Clear(BackColor)
Dim buttonrect As New LinearGradientBrush(rect, Color.FromArgb(0, 161, 255), Color.FromArgb(0, 161, 255), LinearGradientMode.Vertical)
g.FillPath(buttonrect, RoundRect(rect, 1))
g.DrawPath(New Pen(Color.FromArgb(0, 161, 255)), RoundRect(rect, 1))
Select Case _state
Case MouseState.None
Dim buttonrectnone As New LinearGradientBrush(rect, Color.FromArgb(0, 161, 255), Color.FromArgb(0, 161, 255), LinearGradientMode.Vertical)
g.FillPath(buttonrectnone, RoundRect(rect, 1))
g.DrawPath(New Pen(Color.FromArgb(0, 161, 255)), RoundRect(rect, 3))
g.DrawString(Text, btnfont, Brushes.White, New Rectangle(0, 0, Width - 1, Height - 1), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
Case MouseState.Over
Dim buttonrectnone As New LinearGradientBrush(rect, Color.FromArgb(0, 161, 255), Color.FromArgb(0, 161, 255), LinearGradientMode.Vertical)
g.FillPath(buttonrectnone, RoundRect(rect, 1))
g.DrawPath(New Pen(Color.FromArgb(0, 161, 255)), RoundRect(rect, 3))
g.DrawString(Text, btnfont, Brushes.White, New Rectangle(0, 0, Width - 1, Height - 1), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
Case MouseState.Down
Dim buttonrectnone As New LinearGradientBrush(rect, Color.FromArgb(0, 153, 243), Color.FromArgb(0, 153, 243), LinearGradientMode.Vertical)
g.FillPath(buttonrectnone, RoundRect(rect, 1))
g.DrawPath(New Pen(Color.FromArgb(0, 153, 243)), RoundRect(rect, 3))
g.DrawString(Text, btnfont, Brushes.White, New Rectangle(0, 0, Width - 1, Height - 1), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
End Select
e.Graphics.DrawImage(b, New Point(0, 0))
g.Dispose() : b.Dispose()
End Sub
End Class



#End Region
#Region " Toggle Button "

<DefaultEvent("ToggledChanged")> Class Chili_Toggle
Inherits Control

#Region " Enums "

Enum _Type
OnOff
End Enum

#End Region
#Region " Variables "

Event ToggledChanged()
Private _Toggled As Boolean
Private ToggleType As _Type
Private Bar As Rectangle
Private _Width, _Height As Integer

#End Region
#Region " Properties "

Public Property Toggled() As Boolean
Get
Return _Toggled
End Get
Set(ByVal value As Boolean)
_Toggled = value
Invalidate()
RaiseEvent ToggledChanged()
End Set
End Property

Public Property Type As _Type
Get
Return ToggleType
End Get
Set(value As _Type)
ToggleType = value
Invalidate()
End Set
End Property

#End Region
#Region " EventArgs "

Protected Overrides Sub OnResize(e As EventArgs)
MyBase.OnResize(e)
Me.Size = New Size(70, 30)
End Sub

Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
MyBase.OnMouseUp(e)
Toggled = Not Toggled
Focus()
End Sub

#End Region

Sub New()
SetStyle(ControlStyles.AllPaintingInWmPaint Or _
ControlStyles.DoubleBuffer Or _
ControlStyles.ResizeRedraw Or _
ControlStyles.UserPaint, True)
End Sub

Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
MyBase.OnPaint(e)
Dim G As Graphics = e.Graphics

G.SmoothingMode = SmoothingMode.HighQuality
G.Clear(Parent.BackColor)
_Width = Width - 2 : _Height = Height - 2

Dim GP, GP2 As New GraphicsPath
Dim BaseRect As New Rectangle(0, 0, _Width, _Height)
Dim ThumbRect As New Rectangle(CInt(_Width \ 2), 0, 38, _Height)

With G
.SmoothingMode = 2
.PixelOffsetMode = 2
.TextRenderingHint = 5
.Clear(BackColor)

GP = RoundRect(BaseRect, 1)
ThumbRect = New Rectangle(CInt(_Width \ 2) - 2, 1, 35, _Height - 2)
GP2 = RoundRect(ThumbRect, 1)
.FillPath(New SolidBrush(Color.FromArgb(63, 70, 73)), GP)
.FillPath(New SolidBrush(Color.FromArgb(32, 35, 37)), GP2) '32, 35, 37

If _Toggled Then
GP = RoundRect(BaseRect, 1)
ThumbRect = New Rectangle(0, 0, 35, _Height - 0)
GP2 = RoundRect(ThumbRect, 1)
.FillPath(New SolidBrush(Color.FromArgb(63, 70, 73)), GP)
.FillPath(New SolidBrush(Color.FromArgb(0, 161, 255)), GP2)
End If

' Draw string
Select Case ToggleType
Case _Type.OnOff
If Toggled Then
G.DrawString("t", New Font("Marlett", 11, FontStyle.Regular), Brushes.WhiteSmoke, Bar.X + 17, Bar.Y + 16, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
Else
G.DrawString("r", New Font("Marlett", 11, FontStyle.Regular), Brushes.DimGray, Bar.X + 50, Bar.Y + 16, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
End If
End Select
End With
End Sub
End Class

#End Region
#Region " Social Button "

Class Chili_SocialButton
Inherits Control

#Region " Variables "

Private EllipseColor As Color = Color.FromArgb(127, 187, 25)
Private EllipseColor2 As Color = Color.FromArgb(33, 36, 38)

#End Region
#Region " Properties "

Private O As _Options
<Flags()> _
Enum _Options
Normal
Warning
End Enum

<Category("Options")> _
Public Property Style As _Options
Get
Return O
End Get
Set(value As _Options)
O = value
End Set
End Property

#End Region
#Region " EventArgs "

Protected Overrides Sub OnResize(e As EventArgs)
MyBase.OnResize(e)
Me.Size = New Size(100, 100)
End Sub

Protected Overrides Sub OnMouseEnter(e As EventArgs)
MyBase.OnMouseEnter(e)
EllipseColor = EllipseColor
Refresh()
End Sub
Protected Overrides Sub OnMouseLeave(e As EventArgs)
MyBase.OnMouseLeave(e)
EllipseColor = EllipseColor
Refresh()
End Sub

Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
MyBase.OnMouseDown(e)
EllipseColor = EllipseColor
Focus()
Refresh()
End Sub
Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
MyBase.OnMouseUp(e)
EllipseColor = EllipseColor
Refresh()
End Sub

#End Region




Sub New()
DoubleBuffered = True
Font = New Font("Verdana", 20, FontStyle.Regular)
End Sub

Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
Select Case O
Case _Options.Normal
EllipseColor = Color.FromArgb(127, 187, 25)
Dim G As Graphics = e.Graphics
G.Clear(Parent.BackColor)
G.SmoothingMode = SmoothingMode.HighQuality
G.DrawEllipse(New Pen(EllipseColor), New Rectangle(10, 10, 85, 85))
G.FillEllipse(New SolidBrush(EllipseColor2), New Rectangle(0, 0, 23, 23))
G.DrawString("✓", New Font("Verdana", 20, FontStyle.Bold), New SolidBrush(EllipseColor), New Rectangle(0, 0, Width + 8, Height + 8), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
Case _Options.Warning
EllipseColor = Color.FromArgb(255, 31, 31)
Dim G As Graphics = e.Graphics
G.Clear(Parent.BackColor)
G.SmoothingMode = SmoothingMode.HighQuality
G.DrawEllipse(New Pen(EllipseColor), New Rectangle(10, 10, 85, 85))
G.FillEllipse(New SolidBrush(EllipseColor2), New Rectangle(0, 0, 23, 23))
G.DrawString("✕", New Font("Verdana", 20, FontStyle.Bold), New SolidBrush(EllipseColor), New Rectangle(0, 0, Width + 8, Height + 8), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
End Select




End Sub
End Class

#End Region
#Region " Label "

Class Chili_Label
Inherits Label

Sub New()
Font = New Font("Arial", 7)
ForeColor = Color.FromArgb(116, 125, 132)
BackColor = Color.Transparent
End Sub
End Class

#End Region
#Region " Panel "

Class Chili_Panel
Inherits ContainerControl

Private Shape As GraphicsPath
Private Basecolor As Color
Private Basecolor2 As Color

Private O As _Options
<Flags()> _
Enum _Options
Big
Small
End Enum

<Category("Options")> _
Public Property Style As _Options
Get
Return O
End Get
Set(value As _Options)
O = value
End Set
End Property

Sub New()
SetStyle(ControlStyles.SupportsTransparentBackColo r, True)
SetStyle(ControlStyles.UserPaint, True)
Select Case O
Case _Options.Big
BackColor = Color.FromArgb(85, 94, 102)
Basecolor = Color.FromArgb(85, 94, 102)
Case _Options.Small
BackColor = Color.FromArgb(64, 71, 77)
Basecolor2 = Color.FromArgb(64, 71, 77)
End Select
Me.Size = New Size(187, 117)
Padding = New Padding(5, 5, 5, 5)
DoubleBuffered = True
End Sub
Protected Overrides Sub OnMouseEnter(e As EventArgs)
MyBase.OnMouseEnter(e)
Select Case O
Case _Options.Big
Basecolor = Color.FromArgb(0, 161, 255)
Case _Options.Small
Basecolor2 = Color.FromArgb(0, 161, 255)
End Select
Refresh()
End Sub


Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
MyBase.OnMouseDown(e)
Select Case O
Case _Options.Big
Basecolor = Color.FromArgb(0, 161, 255)
Case _Options.Small
Basecolor2 = Color.FromArgb(0, 161, 255)
End Select
Focus()
Refresh()
End Sub

Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
MyBase.OnMouseUp(e)
Select Case O
Case _Options.Big
Basecolor = Color.FromArgb(0, 161, 255)
Case _Options.Small
Basecolor2 = Color.FromArgb(0, 161, 255)
End Select
Refresh()
End Sub
Protected Overrides Sub OnMouseLeave(e As EventArgs)
MyBase.OnMouseLeave(e)
Select Case O
Case _Options.Big
Basecolor = Color.FromArgb(85, 94, 102)
Case _Options.Small
Basecolor2 = Color.FromArgb(64, 71, 77)
End Select

Refresh()
End Sub
Protected Overrides Sub OnResize(ByVal e As System.EventArgs)
MyBase.OnResize(e)

Shape = New GraphicsPath
With Shape
.AddArc(0, 0, 10, 10, 180, 90)
.AddArc(Width - 11, 0, 10, 10, -90, 90)
.AddArc(Width - 11, Height - 11, 10, 10, 0, 90)
.AddArc(0, Height - 11, 10, 10, 90, 90)
.CloseAllFigures()
End With
End Sub

Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
Select Case O
Case _Options.Big
Size = New Size(150, 150)
MyBase.OnPaint(e)
Dim B As New Bitmap(Width, Height)
Dim G = Graphics.FromImage(B)

G.SmoothingMode = SmoothingMode.HighQuality

G.Clear(Basecolor)
G.FillPath(New SolidBrush(Basecolor), Shape)
G.DrawPath(New Pen(Basecolor), Shape)

G.Dispose()
e.Graphics.DrawImage(B.Clone(), 0, 0)
B.Dispose()
Case _Options.Small
Size = New Size(73, 73)
MyBase.OnPaint(e)
Dim B As New Bitmap(Width, Height)
Dim G = Graphics.FromImage(B)

G.SmoothingMode = SmoothingMode.HighQuality

G.Clear(Basecolor2)
G.FillPath(New SolidBrush(Basecolor2), Shape)
G.DrawPath(New Pen(Basecolor2), Shape)

G.Dispose()
e.Graphics.DrawImage(B.Clone(), 0, 0)
B.Dispose()
End Select


End Sub
End Class

#End Region
#Region " Radio Button "

<DefaultEvent("CheckedChanged")> Class Chili_RadioButton
Inherits Control
#Region " Variables "

Private X As Integer
Private _Checked As Boolean

#End Region
#Region " Properties "

Property Checked() As Boolean
Get
Return _Checked
End Get
Set(ByVal value As Boolean)
_Checked = value
InvalidateControls()
RaiseEvent CheckedChanged(Me)
Invalidate()
End Set
End Property

#End Region
#Region " EventArgs "

Event CheckedChanged(ByVal sender As Object)

Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
If Not _Checked Then Checked = True
Focus()
MyBase.OnMouseDown(e)
End Sub
Protected Overrides Sub OnMouseMove(ByVal e As System.Windows.Forms.MouseEventArgs)
MyBase.OnMouseMove(e)
X = e.X
Invalidate()
End Sub
Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
MyBase.OnTextChanged(e)
Dim textSize As Integer
textSize = Me.CreateGraphics.MeasureString(Text, Font).Width
Me.Width = 28 + textSize
End Sub

Protected Overrides Sub OnResize(e As EventArgs)
MyBase.OnResize(e)
Me.Height = 17
End Sub

#End Region

Public Sub New()
Width = 159
Height = 17
DoubleBuffered = True
End Sub



Private Sub InvalidateControls()
If Not IsHandleCreated OrElse Not _Checked Then Return

For Each _Control As Control In Parent.Controls
If _Control IsNot Me AndAlso TypeOf _Control Is Chili_RadioButton Then
DirectCast(_Control, Chili_RadioButton).Checked = False
End If
Next
End Sub

Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
MyBase.OnPaint(e)
Dim G As Graphics = e.Graphics
G.Clear(Parent.BackColor)
G.SmoothingMode = SmoothingMode.HighQuality

G.FillEllipse(New SolidBrush(Color.FromArgb(254, 254, 254)), New Rectangle(0, 0, 16, 16))

If _Checked Then
G.Clear(Parent.BackColor)
G.FillEllipse(New SolidBrush(Color.FromArgb(0, 160, 254)), New Rectangle(0, 0, 16, 16))
G.FillEllipse(New SolidBrush(Color.FromArgb(254, 254, 254)), New Rectangle(5, 5, 6, 6))
End If

G.DrawString(Text, Font, New SolidBrush(Color.FromArgb(116, 125, 132)), New Point(20, 0))
End Sub
End Class

#End Region
#Region " CheckBox "

<DefaultEvent("CheckedChanged")> Class Chili_CheckBox
Inherits Control

#Region " Variables "

Private X As Integer
Private _Checked As Boolean = False
Private Shape As GraphicsPath

#End Region
#Region " Properties "

Property Checked() As Boolean
Get
Return _Checked
End Get
Set(ByVal value As Boolean)
_Checked = value
Invalidate()
End Set
End Property

#End Region
#Region " EventArgs "

Event CheckedChanged(ByVal sender As Object)

Protected Overrides Sub OnMouseMove(ByVal e As System.Windows.Forms.MouseEventArgs)
MyBase.OnMouseMove(e)
X = e.Location.X
Invalidate()
End Sub
Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
_Checked = Not _Checked
Focus()
RaiseEvent CheckedChanged(Me)
MyBase.OnMouseDown(e)
End Sub

Protected Overrides Sub OnResize(e As EventArgs)
MyBase.OnResize(e)

Me.Height = 16

Shape = New GraphicsPath
With Shape
.AddArc(0, 0, 10, 10, 180, 90)
.AddArc(Width - 11, 0, 10, 10, -90, 90)
.AddArc(Width - 11, Height - 11, 10, 10, 0, 90)
.AddArc(0, Height - 11, 10, 10, 90, 90)
.CloseAllFigures()
End With
Invalidate()
End Sub

#End Region

Sub New()
Width = 148
Height = 16
Font = New Font("Microsoft Sans Serif", 9)
DoubleBuffered = True
End Sub

Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
MyBase.OnPaint(e)
Dim G As Graphics = e.Graphics
G.Clear(Parent.BackColor)

If _Checked Then
G.FillRectangle(New SolidBrush(Color.FromArgb(0, 161, 255)), New Rectangle(0, 0, 16, 16))
G.FillRectangle(New SolidBrush(Color.FromArgb(0, 161, 255)), New Rectangle(1, 1, 16 - 2, 16 - 2))
Else
G.FillRectangle(New SolidBrush(Color.FromArgb(254, 254, 254)), New Rectangle(0, 0, 16, 16))
G.FillRectangle(New SolidBrush(Color.FromArgb(254, 254, 254)), New Rectangle(1, 1, 16 - 2, 16 - 2))
End If

If Enabled = True Then
If _Checked Then G.DrawString("a", New Font("Marlett", 12), New SolidBrush(Color.FromArgb(254, 254, 254)), New Point(-2, -1))
Else
If _Checked Then G.DrawString("a", New Font("Marlett", 12), New SolidBrush(Color.Gray), New Point(-5, -3))
End If

G.DrawString(Text, Font, New SolidBrush(Color.FromArgb(116, 125, 132)), New Point(20, 0))
End Sub
End Class
#End Region
#Region " TextBox "

<DefaultEvent("TextChanged")> Class Chili_TextBox
Inherits Control

#Region " Variables "

Public WithEvents ChiliTB As New TextBox
Private _maxchars As Integer = 32767
Private _ReadOnly As Boolean
Private _Multiline As Boolean
Private _Image As Image
Private _ImageSize As Size
Private ALNType As HorizontalAlignment
Private isPasswordMasked As Boolean = False
Private P1 As Pen
Private B1 As SolidBrush
Private Shape As GraphicsPath

#End Region
#Region " Properties "

Public Shadows Property TextAlignment() As HorizontalAlignment
Get
Return ALNType
End Get
Set(ByVal Val As HorizontalAlignment)
ALNType = Val
Invalidate()
End Set
End Property
Public Shadows Property MaxLength() As Integer
Get
Return _maxchars
End Get
Set(ByVal Val As Integer)
_maxchars = Val
ChiliTB.MaxLength = MaxLength
Invalidate()
End Set
End Property

Public Shadows Property UseSystemPasswordChar() As Boolean
Get
Return isPasswordMasked
End Get
Set(ByVal Val As Boolean)
ChiliTB.UseSystemPasswordChar = UseSystemPasswordChar
isPasswordMasked = Val
Invalidate()
End Set
End Property




#End Region
#Region " EventArgs "


Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
MyBase.OnTextChanged(e)
Invalidate()
End Sub

Protected Overrides Sub OnForeColorChanged(ByVal e As System.EventArgs)
MyBase.OnForeColorChanged(e)
ChiliTB.ForeColor = ForeColor
Invalidate()
End Sub

Protected Overrides Sub OnFontChanged(ByVal e As System.EventArgs)
MyBase.OnFontChanged(e)
ChiliTB.Font = Font
End Sub

Protected Overrides Sub OnPaintBackground(e As PaintEventArgs)
MyBase.OnPaintBackground(e)
End Sub



Protected Overrides Sub OnResize(ByVal e As System.EventArgs)
MyBase.OnResize(e)

End Sub

Protected Overrides Sub OnGotFocus(ByVal e As System.EventArgs)
MyBase.OnGotFocus(e)
ChiliTB.Focus()
End Sub

Sub _TextChanged() Handles ChiliTB.TextChanged
Text = ChiliTB.Text
End Sub

Sub _BaseTextChanged() Handles MyBase.TextChanged
ChiliTB.Text = Text
End Sub

#End Region

Sub AddTextBox()
With ChiliTB
.Location = New Point(8, 10)
.Text = String.Empty
.BorderStyle = BorderStyle.None
.TextAlign = HorizontalAlignment.Left
.Font = New Font("Tahoma", 8)
.ForeColor = Color.White
.UseSystemPasswordChar = UseSystemPasswordChar
.Multiline = False
.BackColor = Color.FromArgb(66, 76, 85)
.ScrollBars = ScrollBars.None
End With
'AddHandler ChiliTB.KeyDown, AddressOf _OnKeyDown
'AddHandler ChiliTB.Enter, AddressOf _Enter
'AddHandler ChiliTB.Leave, AddressOf _Leave
End Sub

Sub New()
SetStyle(ControlStyles.SupportsTransparentBackColo r, True)
SetStyle(ControlStyles.UserPaint, True)

AddTextBox()
Controls.Add(ChiliTB)

'P1 = New Pen(Color.FromArgb(66, 76, 85))
B1 = New SolidBrush(Color.FromArgb(66, 76, 85))
BackColor = Color.Transparent
ForeColor = Color.White

Text = Nothing
Font = New Font("Tahoma", 11)
Size = New Size(118, 28)
DoubleBuffered = True
End Sub

Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
Dim B = New Bitmap(Width, Height) : Dim G = Graphics.FromImage(B)
Dim W = Width + 20 : Dim H = Height + 1

Dim Base As New Rectangle(-1, 50, W + 7, H + 20)

With G
.SmoothingMode = 2
.PixelOffsetMode = 2
.TextRenderingHint = 5
.Clear(BackColor)

'-- Colors
BackColor = Color.FromArgb(66, 76, 85)

'-- Base
.FillRectangle(New SolidBrush(Color.FromArgb(66, 76, 85)), Base)
.DrawString(Text, New Font("Tahoma", 11), New SolidBrush(Color.White), W - 1, H + 50)
End With

MyBase.OnPaint(e)
G.Dispose()
e.Graphics.InterpolationMode = 7
e.Graphics.DrawImageUnscaled(B, 0, 0)
B.Dispose()
End Sub
End Class

#End Region
Class ChiliTextbox : Inherits Control
Dim WithEvents _tb As New TextBox


Private O As _Options
<Flags()> _
Enum _Options
Enabled
Disabled
End Enum

<Category("Options")> _
Public Property TextboxStyle As _Options
Get
Return O
End Get
Set(value As _Options)
O = value
End Set
End Property


<Category("Colors")> _
Public Property BaseColor() As Color
Get
Return _BaseColor
End Get
Set(value As Color)
_BaseColor = value
End Set
End Property

<Category("Colors")> _
Public Property BackgroundText() As Color
Get
Return _BackgroundText
End Get
Set(value As Color)
_BackgroundText = value
End Set
End Property

Private _BaseColor As Color = Color.FromArgb(63, 70, 76)
Private _BackgroundText As Color = Color.FromArgb(63, 70, 76)


#Region "Declaration and shits"
Public Function RoundRect(ByVal rectangle As Rectangle, ByVal curve As Integer) As GraphicsPath
Dim p As GraphicsPath = New GraphicsPath()
Dim arcRectangleWidth As Integer = curve * 2
p.AddArc(New Rectangle(rectangle.X, rectangle.Y, arcRectangleWidth, arcRectangleWidth), -180, 90)
p.AddArc(New Rectangle(rectangle.Width - arcRectangleWidth + rectangle.X, rectangle.Y, arcRectangleWidth, arcRectangleWidth), -90, 90)
p.AddArc(New Rectangle(rectangle.Width - arcRectangleWidth + rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y, arcRectangleWidth, arcRectangleWidth), 0, 90)
p.AddArc(New Rectangle(rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y, arcRectangleWidth, arcRectangleWidth), 90, 90)
p.AddLine(New Point(rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y), New Point(rectangle.X, curve + rectangle.Y))
Return p
End Function
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
Dim rectangle As Rectangle = New Rectangle(x, y, width, height)
Dim p As GraphicsPath = New GraphicsPath()
Dim arcRectangleWidth As Integer = curve * 2
p.AddArc(New Rectangle(rectangle.X, rectangle.Y, arcRectangleWidth, arcRectangleWidth), -180, 90)
p.AddArc(New Rectangle(rectangle.Width - arcRectangleWidth + rectangle.X, rectangle.Y, arcRectangleWidth, arcRectangleWidth), -90, 90)
p.AddArc(New Rectangle(rectangle.Width - arcRectangleWidth + rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y, arcRectangleWidth, arcRectangleWidth), 0, 90)
p.AddArc(New Rectangle(rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y, arcRectangleWidth, arcRectangleWidth), 90, 90)
p.AddLine(New Point(rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y), New Point(rectangle.X, curve + rectangle.Y))
Return p
End Function

Private _allowpassword As Boolean = False
Public Shadows Property UseSystemPasswordChar() As Boolean
Get
Return _allowpassword
End Get
Set(ByVal value As Boolean)
_tb.UseSystemPasswordChar = UseSystemPasswordChar
_allowpassword = value
Invalidate()
End Set
End Property

Private _maxChars As Integer = 32767
Public Shadows Property MaxLength() As Integer
Get
Return _maxChars
End Get
Set(ByVal value As Integer)
_maxChars = value
_tb.MaxLength = MaxLength
Invalidate()
End Set
End Property

Private _textAlignment As HorizontalAlignment
Public Shadows Property TextAlign() As HorizontalAlignment
Get
Return _textAlignment
End Get
Set(ByVal value As HorizontalAlignment)
_textAlignment = value
Invalidate()
End Set
End Property

Private _multiLine As Boolean = False
Public Shadows Property MultiLine() As Boolean
Get
Return _multiLine
End Get
Set(ByVal value As Boolean)
_multiLine = value
_tb.Multiline = value
OnResize(EventArgs.Empty)
Invalidate()
End Set
End Property

Private _readOnly As Boolean = False
Public Shadows Property [ReadOnly]() As Boolean
Get
Return _readOnly
End Get
Set(ByVal value As Boolean)
_readOnly = value
If _tb IsNot Nothing Then
_tb.ReadOnly = value
End If
End Set
End Property

Protected Overrides Sub OnTextChanged(ByVal e As EventArgs)
MyBase.OnTextChanged(e)
Invalidate()
End Sub

Protected Overrides Sub OnBackColorChanged(ByVal e As EventArgs)
MyBase.OnBackColorChanged(e)
Invalidate()
End Sub

Protected Overrides Sub OnForeColorChanged(ByVal e As EventArgs)
MyBase.OnForeColorChanged(e)
_tb.ForeColor = ForeColor
Invalidate()
End Sub

Protected Overrides Sub OnFontChanged(ByVal e As EventArgs)
MyBase.OnFontChanged(e)
_tb.Font = Font
End Sub

Protected Overrides Sub OnGotFocus(ByVal e As EventArgs)
MyBase.OnGotFocus(e)
_tb.Focus()
End Sub

Private Sub TextChangeTb() Handles _tb.TextChanged
Text = _tb.Text
End Sub

Private Sub TextChng() Handles MyBase.TextChanged
_tb.Text = Text
End Sub

#End Region

Public Sub NewTextBox()
With _tb
.Text = String.Empty
.BackColor = _BackgroundText
.ForeColor = ForeColor
.TextAlign = HorizontalAlignment.Left
.BorderStyle = BorderStyle.None
.Location = New Point(3, 3)
.Font = New Font("Verdana", 10, FontStyle.Regular)
.Size = New Size(Width - 3, Height - 3)
.UseSystemPasswordChar = UseSystemPasswordChar
End With
End Sub

Sub New()
MyBase.New()
NewTextBox()
Controls.Add(_tb)
SetStyle(ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
DoubleBuffered = True
TextAlign = HorizontalAlignment.Left
BackColor = _BaseColor
ForeColor = Color.White
Font = New Font("Verdana", 10, FontStyle.Regular)
Size = New Size(132, 29)
End Sub

Protected Overrides Sub OnPaint(ByVal e As Windows.Forms.PaintEventArgs)
Select Case O
Case _Options.Enabled
Dim b As Bitmap = New Bitmap(Width, Height)
Dim g As Graphics = Graphics.FromImage(b)
Dim rect As Rectangle = New Rectangle(0, 0, Width - 1, Height - 1)
MyBase.OnPaint(e)
g.SmoothingMode = SmoothingMode.HighQuality
g.InterpolationMode = InterpolationMode.HighQualityBicubic
g.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
With _tb
.TextAlign = TextAlign
.UseSystemPasswordChar = UseSystemPasswordChar
End With
g.FillPath(New SolidBrush(_BackgroundText), RoundRect(rect, 3))
e.Graphics.DrawImage(b, New Point(0, 0))
ForeColor = Color.White
g.Dispose() : b.Dispose()

Case _Options.Disabled

Dim b As Bitmap = New Bitmap(Width, Height)
Dim g As Graphics = Graphics.FromImage(b)
Dim rect As Rectangle = New Rectangle(0, 0, Width - 1, Height - 1)
MyBase.OnPaint(e)
g.SmoothingMode = SmoothingMode.HighQuality
g.InterpolationMode = InterpolationMode.HighQualityBicubic
g.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
With _tb
.TextAlign = TextAlign
.UseSystemPasswordChar = UseSystemPasswordChar
End With
g.FillPath(New SolidBrush(Color.FromArgb(63, 70, 76)), RoundRect(rect, 3))
g.DrawPath(New Pen(Color.FromArgb(63, 70, 76)), RoundRect(rect, 3))
e.Graphics.DrawImage(b, New Point(0, 0))
ForeColor = Color.FromArgb(63, 70, 76)
Enabled = False
g.Dispose() : b.Dispose()
End Select

End Sub

Protected Overrides Sub OnResize(e As EventArgs)
MyBase.OnResize(e)
If Not MultiLine Then
Dim tbheight As Integer = _tb.Height
_tb.Location = New Point(10, CType(((Height / 2) - (tbheight / 2) - 0), Integer))
_tb.Size = New Size(Width - 20, tbheight)
Else
_tb.Location = New Point(10, 10)
_tb.Size = New Size(Width - 20, Height - 20)
End If
End Sub
End Class
#Region " Separator "

Class Chili_Separator
Inherits Control

Sub New()
SetStyle(ControlStyles.ResizeRedraw, True)
Me.Size = New Point(120, 10)
End Sub

Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
MyBase.OnPaint(e)
e.Graphics.DrawLine(New Pen(Color.FromArgb(58, 64, 70)), 1, 5, Width, 5)
End Sub
End Class

#End Region