Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System.Drawing.Drawing2D
- Imports System.ComponentModel
- '--------------------- [ THEME ] ---------------------
- 'Name: KainedTheme
- 'Creator: ヱヴァンゲリヲン
- 'Credit: iSynthesis, are you dead or what ? :
- 'Credit: Ashlanfox, ça fait un baille tu deviens quoi ?
- 'Credit: nathan72389 if you see this, please no BDSM on my thread
- 'Credit: Aeonhack for the Themebase, as usual
- 'Credit: Eternal & 143VPN : Color scheme. Feel free to use this theme because your current theme is
- 'ugly as fuck.
- 'Credit: You, because you downloaded this theme.
- '-------------------- [ /THEME ] ---------------------
- Module Helpers
- #Region " Variables"
- Friend G As Graphics, B As Bitmap
- Friend NearSF As New StringFormat() With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Near}
- Friend CenterSF As New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center}
- #End Region
- #Region " Functions"
- Public Function RoundRec(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(x!, y!, w!, h!, Optional r! = 0.3, Optional TL As Boolean = True, Optional TR As Boolean = True, Optional BR As Boolean = True, Optional BL As Boolean = True) As GraphicsPath
- Dim d! = Math.Min(w, h) * r, xw = x + w, yh = y + h
- RoundRect = New GraphicsPath
- With RoundRect
- If TL Then .AddArc(x, y, d, d, 180, 90) Else .AddLine(x, y, x, y)
- If TR Then .AddArc(xw - d, y, d, d, 270, 90) Else .AddLine(xw, y, xw, y)
- If BR Then .AddArc(xw - d, yh - d, d, d, 0, 90) Else .AddLine(xw, yh, xw, yh)
- If BL Then .AddArc(x, yh - d, d, d, 90, 90) Else .AddLine(x, yh, x, yh)
- .CloseFigure()
- End With
- End Function
- '-- Credit: AeonHack
- Public Function DrawArrow(x As Integer, y As Integer, flip As Boolean) As GraphicsPath
- Dim GP As New GraphicsPath()
- Dim W As Integer = 12
- Dim H As Integer = 6
- 'GP.AddLine(x, y + H, x + W, y + H)
- 'GP.AddLine(x + W, y + H, x + H, y)
- GP.CloseFigure()
- Return GP
- End Function
- Public Sub DrawCircle(g As Graphics, pen As Pen, centerX As Single, centerY As Single, radius As Single)
- g.DrawEllipse(pen, centerX - radius, centerY - radius, radius + radius, radius + radius)
- End Sub
- Public Sub FillCircle(g As Graphics, brush As Brush, centerX As Single, centerY As Single, radius As Single)
- g.FillEllipse(brush, centerX - radius, centerY - radius, radius + radius, radius + radius)
- End Sub
- #End Region
- End Module
- Class KainedForm
- Inherits ThemeContainer154
- <Category("Colors")> _
- Public Property HeaderColor() As Color
- Get
- Return _HeaderColor
- End Get
- Set(value As Color)
- _HeaderColor = 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
- Private _HeaderColor As Color = Color.FromArgb(54, 54, 54)
- Private _BaseColor As Color = Color.FromArgb(91, 202, 118)
- #Region "Functions | Create form"
- Private CreateRoundPath As GraphicsPath
- Function CreateTop(ByVal r As Rectangle, ByVal slope As Integer) As GraphicsPath
- CreateRoundPath = New GraphicsPath(FillMode.Winding)
- CreateRoundPath.AddArc(r.X, r.Y, slope, slope, 180.0F, 90.0F)
- CreateRoundPath.AddArc(r.Right - slope, r.Y, slope, slope, 270.0F, 90.0F)
- CreateRoundPath.AddRectangle(New Rectangle(r.X, r.Y + (slope / 2), r.Right, r.Y + 30))
- CreateRoundPath.CloseFigure()
- Return CreateRoundPath
- End Function
- #End Region
- Sub New()
- DoubleBuffered = True
- End Sub
- Protected Overrides Sub ColorHook()
- BackColor = Color.FromArgb(235, 75, 75)
- Font = New Font("Segoe UI", 15, FontStyle.Regular)
- End Sub
- Protected Overrides Sub PaintHook()
- _HeaderColor = Color.FromArgb(235, 75, 75)
- TransparencyKey = Color.Fuchsia
- G.Clear(Color.Fuchsia)
- G.InterpolationMode = InterpolationMode.HighQualityBicubic
- Dim LBR1 As New LinearGradientBrush(New Rectangle(50, 50, 50, 50), _HeaderColor, _HeaderColor, 0S)
- Dim GP1 As GraphicsPath = CreateTop(New Rectangle(0, 0, Width, 2), 10)
- Dim GP2 As GraphicsPath = CreateRound(New Rectangle(0, 0, Width, Height), 10)
- G.FillPath(New SolidBrush(Color.FromArgb(255, 255, 255)), GP2)
- G.FillPath(LBR1, GP1)
- G.SmoothingMode = SmoothingMode.HighQuality
- End Sub
- End Class
- Class ControlButton
- Inherits ThemeControl154
- Protected Overrides Sub ColorHook()
- End Sub
- Sub New()
- SetStyle(ControlStyles.SupportsTransparentBackColor, True)
- Size = New Size(25, 25)
- Cursor = Cursors.Hand
- End Sub
- Protected Overrides Sub PaintHook()
- G.SmoothingMode = SmoothingMode.HighQuality
- G.Clear(Color.FromArgb(235, 75, 75))
- Size = New Size(25, 25)
- Dim LBR1 As New LinearGradientBrush(New Rectangle(0, 0, 25, 25), Color.FromArgb(208, 88, 87), Color.FromArgb(208, 88, 87), 90S)
- '209, 89, 90
- Select Case State
- Case MouseState.None
- G.SmoothingMode = SmoothingMode.HighQuality
- Dim r As New Rectangle(1, 1, 20, 20)
- Dim LB1 As New LinearGradientBrush(r, Color.FromArgb(243, 131, 130), Color.FromArgb(243, 131, 130), 90S)
- LB1.SetSigmaBellShape(0.3F, 0.3F)
- LB1.GammaCorrection = True
- G.FillEllipse(LB1, r)
- Dim t As New Font("Segoe UI Symbol", 5, FontStyle.Regular)
- G.DrawString("❌", t, New SolidBrush(Color.FromArgb(255, 255, 255)), 7, 7)
- Case MouseState.Down
- '255,234,63
- G.SmoothingMode = SmoothingMode.HighQuality
- Dim r As New Rectangle(1, 1, 20, 20)
- Dim LB1 As New LinearGradientBrush(r, Color.FromArgb(243, 131, 130), Color.FromArgb(243, 131, 130), 90S)
- LB1.SetSigmaBellShape(0.3F, 0.3F)
- LB1.GammaCorrection = True
- G.FillEllipse(LB1, r)
- Dim t As New Font("Segoe UI Symbol", 5, FontStyle.Regular)
- G.DrawString("❌", t, New SolidBrush(Color.FromArgb(249, 154, 154)), 7, 7)
- Case MouseState.Over
- G.SmoothingMode = SmoothingMode.HighQuality
- Dim r As New Rectangle(1, 1, 20, 20)
- Dim LB1 As New LinearGradientBrush(r, Color.FromArgb(243, 131, 130), Color.FromArgb(243, 131, 130), 90S)
- LB1.SetSigmaBellShape(0.3F, 0.3F)
- LB1.GammaCorrection = True
- G.FillEllipse(LB1, r)
- Dim t As New Font("Segoe UI Symbol", 5, FontStyle.Regular)
- G.DrawString("❌", t, New SolidBrush(Color.FromArgb(248, 214, 219)), 7, 7)
- End Select
- End Sub
- End Class
- Class KainedTextbox : Inherits Control
- Dim WithEvents _tb As New TextBox
- <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(230, 230, 230)
- Private _BackgroundText As Color = Color.FromArgb(230, 230, 230)
- #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.FromArgb(52, 73, 94)
- Font = New Font("Verdana", 10, FontStyle.Regular)
- Size = New Size(132, 29)
- End Sub
- Protected Overrides Sub OnPaint(ByVal e As Windows.Forms.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)
- 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))
- 'g.DrawPath(New Pen(BaseColor), RoundRect(rect, 3))
- e.Graphics.DrawImage(b, New Point(0, 0))
- ForeColor = Color.FromArgb(165, 165, 165)
- g.Dispose() : b.Dispose()
- 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
- Class KainedButton : Inherits Control
- Dim _state As MouseState
- #Region " Variables"
- #End Region
- <Category("Colors")> _
- Public Property BaseColor() As Color
- Get
- Return _BaseColor
- End Get
- Set(value As Color)
- _BaseColor = value
- End Set
- End Property
- Private _ShowText As Boolean = True
- Private _BaseColor As Color = Color.FromArgb(235, 75, 75)
- #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
- 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(132, 29)
- _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", 10, 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, _BaseColor, _BaseColor, LinearGradientMode.Vertical)
- g.FillPath(buttonrect, RoundRect(rect, 3))
- g.DrawPath(New Pen(Brushes.Gray), RoundRect(rect, 3))
- With g
- .SmoothingMode = 2
- .PixelOffsetMode = 2
- .TextRenderingHint = 5
- .Clear(BackColor)
- Select Case _state
- Case MouseState.None
- Dim buttonrectnone As New LinearGradientBrush(rect, BaseColor, BaseColor, LinearGradientMode.Vertical)
- g.FillPath(buttonrectnone, 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, BaseColor, BaseColor, LinearGradientMode.Vertical)
- g.FillPath(buttonrectnone, 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, BaseColor, BaseColor, LinearGradientMode.Vertical)
- g.FillPath(buttonrectnone, 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
- End With
- e.Graphics.DrawImage(b, New Point(0, 0))
- g.Dispose() : b.Dispose()
- End Sub
- End Class
- <DefaultEvent("CheckedChanged")> Class KainedCheckBox : Inherits Control
- #Region "Control Help"
- Private State As MouseState = MouseState.None
- <Category("Colors")> _
- Public Property BaseColor() As Color
- Get
- Return _BaseColor
- End Get
- Set(value As Color)
- _BaseColor = value
- End Set
- End Property
- Private _BaseColor As Color = Color.FromArgb(231, 231, 231)
- 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
- Protected Overrides Sub OnMouseEnter(ByVal e As System.EventArgs)
- MyBase.OnMouseEnter(e)
- State = MouseState.Over
- Invalidate()
- End Sub
- Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
- MyBase.OnMouseDown(e)
- State = MouseState.Down
- Invalidate()
- End Sub
- Protected Overrides Sub OnMouseLeave(ByVal e As System.EventArgs)
- MyBase.OnMouseLeave(e)
- State = MouseState.None
- Invalidate()
- End Sub
- Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
- MyBase.OnMouseUp(e)
- State = MouseState.Over
- Invalidate()
- End Sub
- Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
- MyBase.OnTextChanged(e)
- Invalidate()
- End Sub
- Private _Checked As Boolean
- Property Checked() As Boolean
- Get
- Return _Checked
- End Get
- Set(ByVal value As Boolean)
- _Checked = value
- Invalidate()
- End Set
- End Property
- Protected Overrides Sub OnResize(ByVal e As System.EventArgs)
- MyBase.OnResize(e)
- Height = 14
- End Sub
- Protected Overrides Sub OnClick(ByVal e As System.EventArgs)
- _Checked = Not _Checked
- RaiseEvent CheckedChanged(Me)
- MyBase.OnClick(e)
- End Sub
- Event CheckedChanged(ByVal sender As Object)
- #End Region
- Sub New()
- MyBase.New()
- SetStyle(ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor Or ControlStyles.OptimizedDoubleBuffer, True)
- BackColor = Color.Transparent
- ForeColor = Color.Black
- Font = New Font("Verdana", 8, FontStyle.Regular)
- Size = New Size(145, 16)
- DoubleBuffered = True
- End Sub
- Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
- Dim coloracion As Color
- Dim B As New Bitmap(Width, Height)
- Dim G As Graphics = Graphics.FromImage(B)
- Dim checkBoxRectangle As New Rectangle(0, 0, Height, Height - 1)
- Dim Inner As New Rectangle(0, 0, Height, Height - 1)
- G.SmoothingMode = SmoothingMode.HighQuality
- G.InterpolationMode = InterpolationMode.HighQualityBicubic
- G.CompositingQuality = CompositingQuality.HighQuality
- G.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
- G.Clear(Color.Transparent)
- Dim bodyGrad As New LinearGradientBrush(checkBoxRectangle, Color.FromArgb(68, 76, 99), Color.FromArgb(68, 76, 99), 90S)
- G.FillPath(New SolidBrush(_BaseColor), RoundRect(checkBoxRectangle, 3))
- coloracion = Color.FromArgb(138, 138, 138)
- If Checked Then
- coloracion = Color.FromArgb(138, 138, 138)
- Dim t As New Font("Marlett", 10, FontStyle.Regular)
- G.DrawString("a", t, New SolidBrush(Color.FromArgb(255, 255, 255)), -1.5, 0)
- End If
- Dim drawFont As New Font("Verdana", 8, FontStyle.Regular)
- Dim nb As Brush = New SolidBrush(coloracion)
- G.DrawString(Text, drawFont, nb, New Point(18, 7), New StringFormat With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Center})
- e.Graphics.DrawImage(B.Clone(), 0, 0)
- G.Dispose() : B.Dispose()
- End Sub
- End Class
- Class KainedProgressBar
- Inherits Control
- #Region "Declarations 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
- #End Region
- #Region " Properties "
- Dim WithEvents Pgs As New ProgressBar()
- Sub New()
- Size = New Point(132, 14)
- End Sub
- Private _Maximum As Double
- Public Property Maximum() As Double
- Get
- Return _Maximum
- End Get
- Set(ByVal v As Double)
- _Maximum = v
- Progress = _Current / v * 100
- Invalidate()
- End Set
- End Property
- Private _Current As Double
- Public Property Current() As Double
- Get
- Return _Current
- End Get
- Set(ByVal v As Double)
- _Current = v
- Progress = v / _Maximum * 100
- Invalidate()
- End Set
- End Property
- Private _Progress As Double
- Public Property Progress() As Double
- Get
- Return _Progress
- End Get
- Set(ByVal v As Double)
- If v < 0 Then v = 0 Else If v > 100 Then v = 100
- _Progress = v
- _Current = v * 0.01 * _Maximum
- Invalidate()
- End Set
- End Property
- Private _ShowPercentage As Boolean = True
- Public Property ShowPercentage() As Boolean
- Get
- Return _ShowPercentage
- End Get
- Set(ByVal v As Boolean)
- _ShowPercentage = v
- Invalidate()
- End Set
- End Property
- #End Region
- #Region "Couleur"
- Protected Overrides Sub OnPaintBackground(ByVal pevent As PaintEventArgs)
- End Sub
- Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
- Using B As New Bitmap(Width, Height)
- Using G = Graphics.FromImage(B)
- G.Clear(Color.FromArgb(255, 255, 255))
- Dim Rect1 As Rectangle = New Rectangle(0, 0, Width - 7, Height)
- Dim Glow As New LinearGradientBrush(Rect1, Color.FromArgb(230, 230, 230), Color.FromArgb(230, 230, 230), -270S)
- G.FillPath(Glow, RoundRect(Rect1, 3))
- G.DrawPath(New Pen(Color.FromArgb(230, 230, 230)), RoundRect(Rect1, 3))
- Dim W = CInt(_Progress * 0.01 * Width)
- Dim R As New Rectangle(3, 3, W - 7, Height - 7)
- Dim Header As New LinearGradientBrush(R, Color.FromArgb(138, 138, 138), Color.FromArgb(138, 138, 138), 270S)
- G.FillPath(Header, RoundRect(R, 3))
- G.DrawPath(New Pen(Color.FromArgb(138, 138, 138)), RoundRect(R, 3))
- End Using
- e.Graphics.DrawImage(B, 0, 0)
- End Using
- MyBase.OnPaint(e)
- End Sub
- #End Region
- End Class
- Class KainedComboBox : Inherits Windows.Forms.ComboBox
- #Region " Variables"
- Private W, H As Integer
- Private _StartIndex As Integer = 0
- Private x, y As Integer
- #End Region
- 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
- #Region " Properties"
- #Region " Mouse States"
- Private State As MouseState = MouseState.None
- Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
- MyBase.OnMouseDown(e)
- State = MouseState.Down : Invalidate()
- End Sub
- Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
- MyBase.OnMouseUp(e)
- State = MouseState.Over : Invalidate()
- End Sub
- Protected Overrides Sub OnMouseEnter(e As EventArgs)
- MyBase.OnMouseEnter(e)
- State = MouseState.Over : Invalidate()
- End Sub
- Protected Overrides Sub OnMouseLeave(e As EventArgs)
- MyBase.OnMouseLeave(e)
- State = MouseState.None : Invalidate()
- End Sub
- Protected Overrides Sub OnMouseMove(e As MouseEventArgs)
- MyBase.OnMouseMove(e)
- x = e.Location.X
- y = e.Location.Y
- Invalidate()
- If e.X < Width - 41 Then Cursor = Cursors.IBeam Else Cursor = Cursors.Hand
- End Sub
- Protected Overrides Sub OnDrawItem(e As DrawItemEventArgs)
- MyBase.OnDrawItem(e) : Invalidate()
- If (e.State And DrawItemState.Selected) = DrawItemState.Selected Then
- Invalidate()
- End If
- End Sub
- Protected Overrides Sub OnClick(e As EventArgs)
- MyBase.OnClick(e) : Invalidate()
- End Sub
- #End Region
- #Region " Colors"
- <Category("Colors")> _
- Public Property BaseColor() As Color
- Get
- Return _BGColor
- End Get
- Set(value As Color)
- _BGColor = value
- End Set
- End Property
- <Category("Colors")> _
- Public Property HoverColor As Color
- Get
- Return _HoverColor
- End Get
- Set(value As Color)
- _HoverColor = value
- End Set
- End Property
- #End Region
- Private Property StartIndex As Integer
- Get
- Return _StartIndex
- End Get
- Set(ByVal value As Integer)
- _StartIndex = value
- Try
- MyBase.SelectedIndex = value
- Catch
- End Try
- Invalidate()
- End Set
- End Property
- Sub DrawItem_(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles Me.DrawItem
- If e.Index < 0 Then Exit Sub
- e.DrawBackground()
- e.DrawFocusRectangle()
- e.Graphics.SmoothingMode = 2
- e.Graphics.PixelOffsetMode = 2
- e.Graphics.TextRenderingHint = 5
- e.Graphics.InterpolationMode = 7
- If (e.State And DrawItemState.Selected) = DrawItemState.Selected Then
- '-- Selected item
- e.Graphics.FillRectangle(New SolidBrush(_HoverColor), e.Bounds)
- Else
- '-- Not Selected
- e.Graphics.FillRectangle(New SolidBrush(_BaseColor), e.Bounds)
- End If
- '-- Text
- e.Graphics.DrawString(MyBase.GetItemText(MyBase.Items(e.Index)), New Font("Segoe UI", 8), _
- Brushes.White, New Rectangle(e.Bounds.X + 2, e.Bounds.Y + 2, e.Bounds.Width, e.Bounds.Height))
- e.Graphics.Dispose()
- End Sub
- Protected Overrides Sub OnResize(e As EventArgs)
- MyBase.OnResize(e)
- Height = 18
- End Sub
- #End Region
- #Region " Colors"
- Private _BaseColor As Color = Color.FromArgb(218, 218, 218)
- Private _BGColor As Color = Color.FromArgb(230, 230, 230)
- Private _HoverColor As Color = Color.FromArgb(235, 75, 75)
- #End Region
- Sub New()
- SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or _
- ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer, True)
- DoubleBuffered = True
- DrawMode = DrawMode.OwnerDrawFixed
- BackColor = Color.FromArgb(245, 245, 245)
- ForeColor = Color.White
- DropDownStyle = ComboBoxStyle.DropDownList
- Cursor = Cursors.Hand
- StartIndex = 0
- ItemHeight = 18
- Font = New Font("Verdana", 10, FontStyle.Regular)
- End Sub
- Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
- B = New Bitmap(Width, Height) : G = Graphics.FromImage(B)
- W = Width : H = Height
- Dim Base As Rectangle = New Rectangle(0, 0, Width - 1, Height - 1)
- Dim buttonrect As New LinearGradientBrush(Base, _BaseColor, _BaseColor, LinearGradientMode.Vertical)
- G.FillPath(buttonrect, RoundRect(Base, 3))
- G.DrawPath(New Pen(Brushes.Gray), RoundRect(Base, 3))
- Dim GP, GP2 As New GraphicsPath
- With G
- .Clear(Color.FromArgb(255, 255, 255))
- .SmoothingMode = 2
- .PixelOffsetMode = 2
- .TextRenderingHint = 5
- .FillPath(buttonrect, RoundRect(Base, 3))
- Dim t As New Font("Segoe UI Symbol", 12, FontStyle.Regular)
- .DrawString("⏷", t, New SolidBrush(Color.FromArgb(139, 139, 139)), W - 25, 0)
- .DrawString(Text, Font, Brushes.Gray, New Point(4, 3), NearSF)
- End With
- G.Dispose()
- e.Graphics.InterpolationMode = 7
- e.Graphics.DrawImageUnscaled(B, 0, 0)
- B.Dispose()
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment