XenocodeRCE

KainedTheme

Apr 29th, 2015
667
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 39.17 KB | None | 0 0
  1. Imports System.Drawing.Drawing2D
  2. Imports System.ComponentModel
  3.  
  4. '--------------------- [ THEME ] ---------------------
  5. 'Name: KainedTheme
  6. 'Creator: ヱヴァンゲリヲン
  7. 'Credit: iSynthesis, are you dead or what ? :
  8. 'Credit: Ashlanfox, ça fait un baille tu deviens quoi ?
  9. 'Credit: nathan72389 if you see this, please no BDSM on my thread
  10. 'Credit: Aeonhack for the Themebase, as usual
  11. 'Credit: Eternal & 143VPN : Color scheme. Feel free to use this theme because your current theme is
  12. 'ugly as fuck.
  13. 'Credit: You, because you downloaded this theme.
  14. '-------------------- [ /THEME ] ---------------------
  15. Module Helpers
  16.  
  17. #Region " Variables"
  18.     Friend G As Graphics, B As Bitmap
  19.     Friend NearSF As New StringFormat() With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Near}
  20.     Friend CenterSF As New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center}
  21. #End Region
  22.  
  23. #Region " Functions"
  24.  
  25.     Public Function RoundRec(ByVal Rectangle As Rectangle, ByVal Curve As Integer) As GraphicsPath
  26.         Dim P As GraphicsPath = New GraphicsPath()
  27.         Dim ArcRectangleWidth As Integer = Curve * 2
  28.         P.AddArc(New Rectangle(Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -180, 90)
  29.         P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -90, 90)
  30.         P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 0, 90)
  31.         P.AddArc(New Rectangle(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 90, 90)
  32.         P.AddLine(New Point(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y), New Point(Rectangle.X, Curve + Rectangle.Y))
  33.         Return P
  34.     End Function
  35.  
  36.     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
  37.         Dim d! = Math.Min(w, h) * r, xw = x + w, yh = y + h
  38.         RoundRect = New GraphicsPath
  39.  
  40.         With RoundRect
  41.             If TL Then .AddArc(x, y, d, d, 180, 90) Else .AddLine(x, y, x, y)
  42.             If TR Then .AddArc(xw - d, y, d, d, 270, 90) Else .AddLine(xw, y, xw, y)
  43.             If BR Then .AddArc(xw - d, yh - d, d, d, 0, 90) Else .AddLine(xw, yh, xw, yh)
  44.             If BL Then .AddArc(x, yh - d, d, d, 90, 90) Else .AddLine(x, yh, x, yh)
  45.  
  46.             .CloseFigure()
  47.         End With
  48.     End Function
  49.  
  50.     '-- Credit: AeonHack
  51.     Public Function DrawArrow(x As Integer, y As Integer, flip As Boolean) As GraphicsPath
  52.         Dim GP As New GraphicsPath()
  53.  
  54.         Dim W As Integer = 12
  55.         Dim H As Integer = 6
  56.  
  57.         'GP.AddLine(x, y + H, x + W, y + H)
  58.         'GP.AddLine(x + W, y + H, x + H, y)
  59.  
  60.         GP.CloseFigure()
  61.         Return GP
  62.     End Function
  63.  
  64.     Public Sub DrawCircle(g As Graphics, pen As Pen, centerX As Single, centerY As Single, radius As Single)
  65.         g.DrawEllipse(pen, centerX - radius, centerY - radius, radius + radius, radius + radius)
  66.     End Sub
  67.  
  68.     Public Sub FillCircle(g As Graphics, brush As Brush, centerX As Single, centerY As Single, radius As Single)
  69.         g.FillEllipse(brush, centerX - radius, centerY - radius, radius + radius, radius + radius)
  70.     End Sub
  71.  
  72. #End Region
  73.  
  74. End Module
  75.  
  76. Class KainedForm
  77.     Inherits ThemeContainer154
  78.  
  79.  
  80.     <Category("Colors")> _
  81.     Public Property HeaderColor() As Color
  82.         Get
  83.             Return _HeaderColor
  84.         End Get
  85.         Set(value As Color)
  86.             _HeaderColor = value
  87.         End Set
  88.     End Property
  89.     <Category("Colors")> _
  90.     Public Property BaseColor() As Color
  91.         Get
  92.             Return _BaseColor
  93.         End Get
  94.         Set(value As Color)
  95.             _BaseColor = value
  96.         End Set
  97.     End Property
  98.  
  99.     Private _HeaderColor As Color = Color.FromArgb(54, 54, 54)
  100.     Private _BaseColor As Color = Color.FromArgb(91, 202, 118)
  101.  
  102.  
  103. #Region "Functions | Create form"
  104.     Private CreateRoundPath As GraphicsPath
  105.     Function CreateTop(ByVal r As Rectangle, ByVal slope As Integer) As GraphicsPath
  106.         CreateRoundPath = New GraphicsPath(FillMode.Winding)
  107.         CreateRoundPath.AddArc(r.X, r.Y, slope, slope, 180.0F, 90.0F)
  108.         CreateRoundPath.AddArc(r.Right - slope, r.Y, slope, slope, 270.0F, 90.0F)
  109.         CreateRoundPath.AddRectangle(New Rectangle(r.X, r.Y + (slope / 2), r.Right, r.Y + 30))
  110.         CreateRoundPath.CloseFigure()
  111.         Return CreateRoundPath
  112.     End Function
  113.  
  114.    
  115. #End Region
  116.  
  117.     Sub New()
  118.         DoubleBuffered = True
  119.     End Sub
  120.  
  121.     Protected Overrides Sub ColorHook()
  122.         BackColor = Color.FromArgb(235, 75, 75)
  123.         Font = New Font("Segoe UI", 15, FontStyle.Regular)
  124.     End Sub
  125.  
  126.     Protected Overrides Sub PaintHook()
  127.  
  128.  
  129.         _HeaderColor = Color.FromArgb(235, 75, 75)
  130.         TransparencyKey = Color.Fuchsia
  131.         G.Clear(Color.Fuchsia)
  132.  
  133.         G.InterpolationMode = InterpolationMode.HighQualityBicubic
  134.  
  135.         Dim LBR1 As New LinearGradientBrush(New Rectangle(50, 50, 50, 50), _HeaderColor, _HeaderColor, 0S)
  136.  
  137.         Dim GP1 As GraphicsPath = CreateTop(New Rectangle(0, 0, Width, 2), 10)
  138.         Dim GP2 As GraphicsPath = CreateRound(New Rectangle(0, 0, Width, Height), 10)
  139.  
  140.         G.FillPath(New SolidBrush(Color.FromArgb(255, 255, 255)), GP2)
  141.         G.FillPath(LBR1, GP1)
  142.         G.SmoothingMode = SmoothingMode.HighQuality
  143.  
  144.  
  145.     End Sub
  146.  
  147. End Class
  148. Class ControlButton
  149.     Inherits ThemeControl154
  150.  
  151.     Protected Overrides Sub ColorHook()
  152.     End Sub
  153.  
  154.     Sub New()
  155.         SetStyle(ControlStyles.SupportsTransparentBackColor, True)
  156.         Size = New Size(25, 25)
  157.         Cursor = Cursors.Hand
  158.     End Sub
  159.  
  160.     Protected Overrides Sub PaintHook()
  161.  
  162.  
  163.         G.SmoothingMode = SmoothingMode.HighQuality
  164.         G.Clear(Color.FromArgb(235, 75, 75))
  165.  
  166.         Size = New Size(25, 25)
  167.         Dim LBR1 As New LinearGradientBrush(New Rectangle(0, 0, 25, 25), Color.FromArgb(208, 88, 87), Color.FromArgb(208, 88, 87), 90S)
  168.  
  169.         '209, 89, 90
  170.         Select Case State
  171.             Case MouseState.None
  172.                 G.SmoothingMode = SmoothingMode.HighQuality
  173.  
  174.                 Dim r As New Rectangle(1, 1, 20, 20)
  175.                 Dim LB1 As New LinearGradientBrush(r, Color.FromArgb(243, 131, 130), Color.FromArgb(243, 131, 130), 90S)
  176.                 LB1.SetSigmaBellShape(0.3F, 0.3F)
  177.                 LB1.GammaCorrection = True
  178.                 G.FillEllipse(LB1, r)
  179.                 Dim t As New Font("Segoe UI Symbol", 5, FontStyle.Regular)
  180.                 G.DrawString("❌", t, New SolidBrush(Color.FromArgb(255, 255, 255)), 7, 7)
  181.  
  182.             Case MouseState.Down
  183.                 '255,234,63
  184.                 G.SmoothingMode = SmoothingMode.HighQuality
  185.                 Dim r As New Rectangle(1, 1, 20, 20)
  186.                 Dim LB1 As New LinearGradientBrush(r, Color.FromArgb(243, 131, 130), Color.FromArgb(243, 131, 130), 90S)
  187.                 LB1.SetSigmaBellShape(0.3F, 0.3F)
  188.                 LB1.GammaCorrection = True
  189.                 G.FillEllipse(LB1, r)
  190.                 Dim t As New Font("Segoe UI Symbol", 5, FontStyle.Regular)
  191.                 G.DrawString("❌", t, New SolidBrush(Color.FromArgb(249, 154, 154)), 7, 7)
  192.  
  193.  
  194.             Case MouseState.Over
  195.                 G.SmoothingMode = SmoothingMode.HighQuality
  196.                 Dim r As New Rectangle(1, 1, 20, 20)
  197.                 Dim LB1 As New LinearGradientBrush(r, Color.FromArgb(243, 131, 130), Color.FromArgb(243, 131, 130), 90S)
  198.                 LB1.SetSigmaBellShape(0.3F, 0.3F)
  199.                 LB1.GammaCorrection = True
  200.                 G.FillEllipse(LB1, r)
  201.                 Dim t As New Font("Segoe UI Symbol", 5, FontStyle.Regular)
  202.                 G.DrawString("❌", t, New SolidBrush(Color.FromArgb(248, 214, 219)), 7, 7)
  203.         End Select
  204.  
  205.  
  206.  
  207.     End Sub
  208. End Class
  209. Class KainedTextbox : Inherits Control
  210.     Dim WithEvents _tb As New TextBox
  211.  
  212.     <Category("Colors")> _
  213.     Public Property BaseColor() As Color
  214.         Get
  215.             Return _BaseColor
  216.         End Get
  217.         Set(value As Color)
  218.             _BaseColor = value
  219.         End Set
  220.     End Property
  221.  
  222.     <Category("Colors")> _
  223.     Public Property BackgroundText() As Color
  224.         Get
  225.             Return _BackgroundText
  226.         End Get
  227.         Set(value As Color)
  228.             _BackgroundText = value
  229.         End Set
  230.     End Property
  231.  
  232.     Private _BaseColor As Color = Color.FromArgb(230, 230, 230)
  233.     Private _BackgroundText As Color = Color.FromArgb(230, 230, 230)
  234.  
  235.  
  236. #Region "Declaration and shits"
  237.     Public Function RoundRect(ByVal rectangle As Rectangle, ByVal curve As Integer) As GraphicsPath
  238.         Dim p As GraphicsPath = New GraphicsPath()
  239.         Dim arcRectangleWidth As Integer = curve * 2
  240.         p.AddArc(New Rectangle(rectangle.X, rectangle.Y, arcRectangleWidth, arcRectangleWidth), -180, 90)
  241.         p.AddArc(New Rectangle(rectangle.Width - arcRectangleWidth + rectangle.X, rectangle.Y, arcRectangleWidth, arcRectangleWidth), -90, 90)
  242.         p.AddArc(New Rectangle(rectangle.Width - arcRectangleWidth + rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y, arcRectangleWidth, arcRectangleWidth), 0, 90)
  243.         p.AddArc(New Rectangle(rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y, arcRectangleWidth, arcRectangleWidth), 90, 90)
  244.         p.AddLine(New Point(rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y), New Point(rectangle.X, curve + rectangle.Y))
  245.         Return p
  246.     End Function
  247.     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
  248.         Dim rectangle As Rectangle = New Rectangle(x, y, width, height)
  249.         Dim p As GraphicsPath = New GraphicsPath()
  250.         Dim arcRectangleWidth As Integer = curve * 2
  251.         p.AddArc(New Rectangle(rectangle.X, rectangle.Y, arcRectangleWidth, arcRectangleWidth), -180, 90)
  252.         p.AddArc(New Rectangle(rectangle.Width - arcRectangleWidth + rectangle.X, rectangle.Y, arcRectangleWidth, arcRectangleWidth), -90, 90)
  253.         p.AddArc(New Rectangle(rectangle.Width - arcRectangleWidth + rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y, arcRectangleWidth, arcRectangleWidth), 0, 90)
  254.         p.AddArc(New Rectangle(rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y, arcRectangleWidth, arcRectangleWidth), 90, 90)
  255.         p.AddLine(New Point(rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y), New Point(rectangle.X, curve + rectangle.Y))
  256.         Return p
  257.     End Function
  258.  
  259.     Private _allowpassword As Boolean = False
  260.     Public Shadows Property UseSystemPasswordChar() As Boolean
  261.         Get
  262.             Return _allowpassword
  263.         End Get
  264.         Set(ByVal value As Boolean)
  265.             _tb.UseSystemPasswordChar = UseSystemPasswordChar
  266.             _allowpassword = value
  267.             Invalidate()
  268.         End Set
  269.     End Property
  270.  
  271.     Private _maxChars As Integer = 32767
  272.     Public Shadows Property MaxLength() As Integer
  273.         Get
  274.             Return _maxChars
  275.         End Get
  276.         Set(ByVal value As Integer)
  277.             _maxChars = value
  278.             _tb.MaxLength = MaxLength
  279.             Invalidate()
  280.         End Set
  281.     End Property
  282.  
  283.     Private _textAlignment As HorizontalAlignment
  284.     Public Shadows Property TextAlign() As HorizontalAlignment
  285.         Get
  286.             Return _textAlignment
  287.         End Get
  288.         Set(ByVal value As HorizontalAlignment)
  289.             _textAlignment = value
  290.             Invalidate()
  291.         End Set
  292.     End Property
  293.  
  294.     Private _multiLine As Boolean = False
  295.     Public Shadows Property MultiLine() As Boolean
  296.         Get
  297.             Return _multiLine
  298.         End Get
  299.         Set(ByVal value As Boolean)
  300.             _multiLine = value
  301.             _tb.Multiline = value
  302.             OnResize(EventArgs.Empty)
  303.             Invalidate()
  304.         End Set
  305.     End Property
  306.  
  307.     Private _readOnly As Boolean = False
  308.     Public Shadows Property [ReadOnly]() As Boolean
  309.         Get
  310.             Return _readOnly
  311.         End Get
  312.         Set(ByVal value As Boolean)
  313.             _readOnly = value
  314.             If _tb IsNot Nothing Then
  315.                 _tb.ReadOnly = value
  316.             End If
  317.         End Set
  318.     End Property
  319.  
  320.     Protected Overrides Sub OnTextChanged(ByVal e As EventArgs)
  321.         MyBase.OnTextChanged(e)
  322.         Invalidate()
  323.     End Sub
  324.  
  325.     Protected Overrides Sub OnBackColorChanged(ByVal e As EventArgs)
  326.         MyBase.OnBackColorChanged(e)
  327.         Invalidate()
  328.     End Sub
  329.  
  330.     Protected Overrides Sub OnForeColorChanged(ByVal e As EventArgs)
  331.         MyBase.OnForeColorChanged(e)
  332.         _tb.ForeColor = ForeColor
  333.         Invalidate()
  334.     End Sub
  335.  
  336.     Protected Overrides Sub OnFontChanged(ByVal e As EventArgs)
  337.         MyBase.OnFontChanged(e)
  338.         _tb.Font = Font
  339.     End Sub
  340.  
  341.     Protected Overrides Sub OnGotFocus(ByVal e As EventArgs)
  342.         MyBase.OnGotFocus(e)
  343.         _tb.Focus()
  344.     End Sub
  345.  
  346.     Private Sub TextChangeTb() Handles _tb.TextChanged
  347.         Text = _tb.Text
  348.     End Sub
  349.  
  350.     Private Sub TextChng() Handles MyBase.TextChanged
  351.         _tb.Text = Text
  352.     End Sub
  353.  
  354. #End Region
  355.  
  356.     Public Sub NewTextBox()
  357.         With _tb
  358.             .Text = String.Empty
  359.             .BackColor = _BackgroundText
  360.             .ForeColor = ForeColor
  361.             .TextAlign = HorizontalAlignment.Left
  362.             .BorderStyle = BorderStyle.None
  363.             .Location = New Point(3, 3)
  364.             .Font = New Font("Verdana", 10, FontStyle.Regular)
  365.             .Size = New Size(Width - 3, Height - 3)
  366.             .UseSystemPasswordChar = UseSystemPasswordChar
  367.         End With
  368.     End Sub
  369.  
  370.     Sub New()
  371.         MyBase.New()
  372.         NewTextBox()
  373.         Controls.Add(_tb)
  374.         SetStyle(ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  375.         DoubleBuffered = True
  376.         TextAlign = HorizontalAlignment.Left
  377.         BackColor = _BaseColor
  378.         ForeColor = Color.FromArgb(52, 73, 94)
  379.         Font = New Font("Verdana", 10, FontStyle.Regular)
  380.         Size = New Size(132, 29)
  381.     End Sub
  382.  
  383.     Protected Overrides Sub OnPaint(ByVal e As Windows.Forms.PaintEventArgs)
  384.  
  385.         Dim b As Bitmap = New Bitmap(Width, Height)
  386.         Dim g As Graphics = Graphics.FromImage(b)
  387.         Dim rect As Rectangle = New Rectangle(0, 0, Width - 1, Height - 1)
  388.         MyBase.OnPaint(e)
  389.         g.SmoothingMode = SmoothingMode.HighQuality
  390.         g.InterpolationMode = InterpolationMode.HighQualityBicubic
  391.         g.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
  392.         With _tb
  393.             .TextAlign = TextAlign
  394.             .UseSystemPasswordChar = UseSystemPasswordChar
  395.         End With
  396.         'g.FillPath(New SolidBrush(_BackgroundText), RoundRect(rect, 3))
  397.         'g.DrawPath(New Pen(BaseColor), RoundRect(rect, 3))
  398.         e.Graphics.DrawImage(b, New Point(0, 0))
  399.         ForeColor = Color.FromArgb(165, 165, 165)
  400.         g.Dispose() : b.Dispose()
  401.  
  402.  
  403.  
  404.     End Sub
  405.  
  406.     Protected Overrides Sub OnResize(e As EventArgs)
  407.         MyBase.OnResize(e)
  408.         If Not MultiLine Then
  409.             Dim tbheight As Integer = _tb.Height
  410.             _tb.Location = New Point(10, CType(((Height / 2) - (tbheight / 2) - 0), Integer))
  411.             _tb.Size = New Size(Width - 20, tbheight)
  412.         Else
  413.             _tb.Location = New Point(10, 10)
  414.             _tb.Size = New Size(Width - 20, Height - 20)
  415.         End If
  416.     End Sub
  417. End Class
  418. Class KainedButton : Inherits Control
  419.     Dim _state As MouseState
  420.  
  421. #Region " Variables"
  422.  
  423.  
  424. #End Region
  425.  
  426.  
  427.  
  428.     <Category("Colors")> _
  429.     Public Property BaseColor() As Color
  430.         Get
  431.             Return _BaseColor
  432.         End Get
  433.         Set(value As Color)
  434.             _BaseColor = value
  435.         End Set
  436.     End Property
  437.  
  438.     Private _ShowText As Boolean = True
  439.  
  440.     Private _BaseColor As Color = Color.FromArgb(235, 75, 75)
  441.  
  442. #Region "Declaration and shits"
  443.     Public Function RoundRect(ByVal rectangle As Rectangle, ByVal curve As Integer) As GraphicsPath
  444.         Dim p As GraphicsPath = New GraphicsPath()
  445.         Dim arcRectangleWidth As Integer = curve * 2
  446.         p.AddArc(New Rectangle(rectangle.X, rectangle.Y, arcRectangleWidth, arcRectangleWidth), -180, 90)
  447.         p.AddArc(New Rectangle(rectangle.Width - arcRectangleWidth + rectangle.X, rectangle.Y, arcRectangleWidth, arcRectangleWidth), -90, 90)
  448.         p.AddArc(New Rectangle(rectangle.Width - arcRectangleWidth + rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y, arcRectangleWidth, arcRectangleWidth), 0, 90)
  449.         p.AddArc(New Rectangle(rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y, arcRectangleWidth, arcRectangleWidth), 90, 90)
  450.         p.AddLine(New Point(rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y), New Point(rectangle.X, curve + rectangle.Y))
  451.         Return p
  452.     End Function
  453.     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
  454.         Dim rectangle As Rectangle = New Rectangle(x, y, width, height)
  455.         Dim p As GraphicsPath = New GraphicsPath()
  456.         Dim arcRectangleWidth As Integer = curve * 2
  457.         p.AddArc(New Rectangle(rectangle.X, rectangle.Y, arcRectangleWidth, arcRectangleWidth), -180, 90)
  458.         p.AddArc(New Rectangle(rectangle.Width - arcRectangleWidth + rectangle.X, rectangle.Y, arcRectangleWidth, arcRectangleWidth), -90, 90)
  459.         p.AddArc(New Rectangle(rectangle.Width - arcRectangleWidth + rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y, arcRectangleWidth, arcRectangleWidth), 0, 90)
  460.         p.AddArc(New Rectangle(rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y, arcRectangleWidth, arcRectangleWidth), 90, 90)
  461.         p.AddLine(New Point(rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y), New Point(rectangle.X, curve + rectangle.Y))
  462.         Return p
  463.     End Function
  464.     Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  465.         MyBase.OnMouseDown(e)
  466.         _state = MouseState.Down
  467.         Invalidate()
  468.     End Sub
  469.  
  470.     Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  471.         MyBase.OnMouseUp(e)
  472.         _state = MouseState.Over
  473.         Invalidate()
  474.     End Sub
  475.  
  476.     Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
  477.         MyBase.OnMouseEnter(e)
  478.         _state = MouseState.Over
  479.         Invalidate()
  480.     End Sub
  481.  
  482.     Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
  483.         MyBase.OnMouseLeave(e)
  484.         _state = MouseState.None
  485.         Invalidate()
  486.     End Sub
  487.  
  488. #End Region
  489.  
  490.  
  491.     Sub New()
  492.         SetStyle(ControlStyles.UserPaint Or ControlStyles.ResizeRedraw Or ControlStyles.SupportsTransparentBackColor, True)
  493.         BackColor = Color.Transparent
  494.         DoubleBuffered = True
  495.         Size = New Size(132, 29)
  496.         _state = MouseState.None
  497.     End Sub
  498.  
  499.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  500.         Dim b As Bitmap = New Bitmap(Width, Height)
  501.         Dim g As Graphics = Graphics.FromImage(b)
  502.         Dim rect As Rectangle = New Rectangle(0, 0, Width - 1, Height - 1)
  503.         Dim btnfont As New Font("Verdana", 10, FontStyle.Regular)
  504.         MyBase.OnPaint(e)
  505.         g.SmoothingMode = SmoothingMode.HighQuality
  506.         g.InterpolationMode = InterpolationMode.HighQualityBicubic
  507.         g.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
  508.         g.Clear(BackColor)
  509.         Dim buttonrect As New LinearGradientBrush(rect, _BaseColor, _BaseColor, LinearGradientMode.Vertical)
  510.         g.FillPath(buttonrect, RoundRect(rect, 3))
  511.         g.DrawPath(New Pen(Brushes.Gray), RoundRect(rect, 3))
  512.  
  513.         With g
  514.  
  515.             .SmoothingMode = 2
  516.             .PixelOffsetMode = 2
  517.             .TextRenderingHint = 5
  518.             .Clear(BackColor)
  519.  
  520.             Select Case _state
  521.                 Case MouseState.None
  522.                     Dim buttonrectnone As New LinearGradientBrush(rect, BaseColor, BaseColor, LinearGradientMode.Vertical)
  523.                     g.FillPath(buttonrectnone, RoundRect(rect, 3))
  524.                     g.DrawString(Text, btnfont, Brushes.White, New Rectangle(0, 0, Width - 1, Height - 1), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  525.                 Case MouseState.Down
  526.                     Dim buttonrectnone As New LinearGradientBrush(rect, BaseColor, BaseColor, LinearGradientMode.Vertical)
  527.                     g.FillPath(buttonrectnone, RoundRect(rect, 3))
  528.                     g.DrawString(Text, btnfont, Brushes.White, New Rectangle(0, 0, Width - 1, Height - 1), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  529.                 Case MouseState.Over
  530.                     Dim buttonrectnone As New LinearGradientBrush(rect, BaseColor, BaseColor, LinearGradientMode.Vertical)
  531.                     g.FillPath(buttonrectnone, RoundRect(rect, 3))
  532.                     g.DrawString(Text, btnfont, Brushes.White, New Rectangle(0, 0, Width - 1, Height - 1), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  533.             End Select
  534.  
  535.  
  536.  
  537.         End With
  538.  
  539.         e.Graphics.DrawImage(b, New Point(0, 0))
  540.         g.Dispose() : b.Dispose()
  541.     End Sub
  542. End Class
  543. <DefaultEvent("CheckedChanged")> Class KainedCheckBox : Inherits Control
  544.  
  545. #Region "Control Help"
  546.     Private State As MouseState = MouseState.None
  547.  
  548.     <Category("Colors")> _
  549.     Public Property BaseColor() As Color
  550.         Get
  551.             Return _BaseColor
  552.         End Get
  553.         Set(value As Color)
  554.             _BaseColor = value
  555.         End Set
  556.     End Property
  557.     Private _BaseColor As Color = Color.FromArgb(231, 231, 231)
  558.  
  559.     Public Function RoundRect(ByVal rectangle As Rectangle, ByVal curve As Integer) As GraphicsPath
  560.         Dim p As GraphicsPath = New GraphicsPath()
  561.         Dim arcRectangleWidth As Integer = curve * 2
  562.         p.AddArc(New Rectangle(rectangle.X, rectangle.Y, arcRectangleWidth, arcRectangleWidth), -180, 90)
  563.         p.AddArc(New Rectangle(rectangle.Width - arcRectangleWidth + rectangle.X, rectangle.Y, arcRectangleWidth, arcRectangleWidth), -90, 90)
  564.         p.AddArc(New Rectangle(rectangle.Width - arcRectangleWidth + rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y, arcRectangleWidth, arcRectangleWidth), 0, 90)
  565.         p.AddArc(New Rectangle(rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y, arcRectangleWidth, arcRectangleWidth), 90, 90)
  566.         p.AddLine(New Point(rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y), New Point(rectangle.X, curve + rectangle.Y))
  567.         Return p
  568.     End Function
  569.     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
  570.         Dim rectangle As Rectangle = New Rectangle(x, y, width, height)
  571.         Dim p As GraphicsPath = New GraphicsPath()
  572.         Dim arcRectangleWidth As Integer = curve * 2
  573.         p.AddArc(New Rectangle(rectangle.X, rectangle.Y, arcRectangleWidth, arcRectangleWidth), -180, 90)
  574.         p.AddArc(New Rectangle(rectangle.Width - arcRectangleWidth + rectangle.X, rectangle.Y, arcRectangleWidth, arcRectangleWidth), -90, 90)
  575.         p.AddArc(New Rectangle(rectangle.Width - arcRectangleWidth + rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y, arcRectangleWidth, arcRectangleWidth), 0, 90)
  576.         p.AddArc(New Rectangle(rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y, arcRectangleWidth, arcRectangleWidth), 90, 90)
  577.         p.AddLine(New Point(rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y), New Point(rectangle.X, curve + rectangle.Y))
  578.         Return p
  579.     End Function
  580.  
  581.     Protected Overrides Sub OnMouseEnter(ByVal e As System.EventArgs)
  582.         MyBase.OnMouseEnter(e)
  583.         State = MouseState.Over
  584.         Invalidate()
  585.     End Sub
  586.     Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  587.         MyBase.OnMouseDown(e)
  588.         State = MouseState.Down
  589.         Invalidate()
  590.     End Sub
  591.     Protected Overrides Sub OnMouseLeave(ByVal e As System.EventArgs)
  592.         MyBase.OnMouseLeave(e)
  593.         State = MouseState.None
  594.         Invalidate()
  595.     End Sub
  596.     Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
  597.         MyBase.OnMouseUp(e)
  598.         State = MouseState.Over
  599.         Invalidate()
  600.     End Sub
  601.     Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
  602.         MyBase.OnTextChanged(e)
  603.         Invalidate()
  604.     End Sub
  605.     Private _Checked As Boolean
  606.     Property Checked() As Boolean
  607.         Get
  608.             Return _Checked
  609.         End Get
  610.         Set(ByVal value As Boolean)
  611.             _Checked = value
  612.             Invalidate()
  613.         End Set
  614.     End Property
  615.     Protected Overrides Sub OnResize(ByVal e As System.EventArgs)
  616.         MyBase.OnResize(e)
  617.         Height = 14
  618.     End Sub
  619.     Protected Overrides Sub OnClick(ByVal e As System.EventArgs)
  620.         _Checked = Not _Checked
  621.         RaiseEvent CheckedChanged(Me)
  622.         MyBase.OnClick(e)
  623.     End Sub
  624.     Event CheckedChanged(ByVal sender As Object)
  625. #End Region
  626.  
  627.  
  628.  
  629.  
  630.     Sub New()
  631.         MyBase.New()
  632.         SetStyle(ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor Or ControlStyles.OptimizedDoubleBuffer, True)
  633.         BackColor = Color.Transparent
  634.         ForeColor = Color.Black
  635.         Font = New Font("Verdana", 8, FontStyle.Regular)
  636.         Size = New Size(145, 16)
  637.         DoubleBuffered = True
  638.     End Sub
  639.  
  640.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  641.         Dim coloracion As Color
  642.         Dim B As New Bitmap(Width, Height)
  643.         Dim G As Graphics = Graphics.FromImage(B)
  644.         Dim checkBoxRectangle As New Rectangle(0, 0, Height, Height - 1)
  645.         Dim Inner As New Rectangle(0, 0, Height, Height - 1)
  646.  
  647.         G.SmoothingMode = SmoothingMode.HighQuality
  648.         G.InterpolationMode = InterpolationMode.HighQualityBicubic
  649.         G.CompositingQuality = CompositingQuality.HighQuality
  650.         G.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
  651.  
  652.         G.Clear(Color.Transparent)
  653.  
  654.         Dim bodyGrad As New LinearGradientBrush(checkBoxRectangle, Color.FromArgb(68, 76, 99), Color.FromArgb(68, 76, 99), 90S)
  655.         G.FillPath(New SolidBrush(_BaseColor), RoundRect(checkBoxRectangle, 3))
  656.  
  657.         coloracion = Color.FromArgb(138, 138, 138)
  658.         If Checked Then
  659.  
  660.             coloracion = Color.FromArgb(138, 138, 138)
  661.  
  662.             Dim t As New Font("Marlett", 10, FontStyle.Regular)
  663.             G.DrawString("a", t, New SolidBrush(Color.FromArgb(255, 255, 255)), -1.5, 0)
  664.  
  665.  
  666.         End If
  667.  
  668.         Dim drawFont As New Font("Verdana", 8, FontStyle.Regular)
  669.         Dim nb As Brush = New SolidBrush(coloracion)
  670.         G.DrawString(Text, drawFont, nb, New Point(18, 7), New StringFormat With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Center})
  671.  
  672.         e.Graphics.DrawImage(B.Clone(), 0, 0)
  673.         G.Dispose() : B.Dispose()
  674.  
  675.  
  676.  
  677.  
  678.  
  679.  
  680.     End Sub
  681.  
  682. End Class
  683. Class KainedProgressBar
  684.     Inherits Control
  685.  
  686. #Region "Declarations and shits"
  687.  
  688.     Public Function RoundRect(ByVal rectangle As Rectangle, ByVal curve As Integer) As GraphicsPath
  689.         Dim p As GraphicsPath = New GraphicsPath()
  690.         Dim arcRectangleWidth As Integer = curve * 2
  691.         p.AddArc(New Rectangle(rectangle.X, rectangle.Y, arcRectangleWidth, arcRectangleWidth), -180, 90)
  692.         p.AddArc(New Rectangle(rectangle.Width - arcRectangleWidth + rectangle.X, rectangle.Y, arcRectangleWidth, arcRectangleWidth), -90, 90)
  693.         p.AddArc(New Rectangle(rectangle.Width - arcRectangleWidth + rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y, arcRectangleWidth, arcRectangleWidth), 0, 90)
  694.         p.AddArc(New Rectangle(rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y, arcRectangleWidth, arcRectangleWidth), 90, 90)
  695.         p.AddLine(New Point(rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y), New Point(rectangle.X, curve + rectangle.Y))
  696.         Return p
  697.     End Function
  698.     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
  699.         Dim rectangle As Rectangle = New Rectangle(x, y, width, height)
  700.         Dim p As GraphicsPath = New GraphicsPath()
  701.         Dim arcRectangleWidth As Integer = curve * 2
  702.         p.AddArc(New Rectangle(rectangle.X, rectangle.Y, arcRectangleWidth, arcRectangleWidth), -180, 90)
  703.         p.AddArc(New Rectangle(rectangle.Width - arcRectangleWidth + rectangle.X, rectangle.Y, arcRectangleWidth, arcRectangleWidth), -90, 90)
  704.         p.AddArc(New Rectangle(rectangle.Width - arcRectangleWidth + rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y, arcRectangleWidth, arcRectangleWidth), 0, 90)
  705.         p.AddArc(New Rectangle(rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y, arcRectangleWidth, arcRectangleWidth), 90, 90)
  706.         p.AddLine(New Point(rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y), New Point(rectangle.X, curve + rectangle.Y))
  707.         Return p
  708.     End Function
  709.  
  710. #End Region
  711. #Region " Properties "
  712.     Dim WithEvents Pgs As New ProgressBar()
  713.     Sub New()
  714.         Size = New Point(132, 14)
  715.     End Sub
  716.     Private _Maximum As Double
  717.     Public Property Maximum() As Double
  718.         Get
  719.             Return _Maximum
  720.         End Get
  721.         Set(ByVal v As Double)
  722.             _Maximum = v
  723.             Progress = _Current / v * 100
  724.             Invalidate()
  725.         End Set
  726.     End Property
  727.  
  728.  
  729.     Private _Current As Double
  730.     Public Property Current() As Double
  731.         Get
  732.             Return _Current
  733.         End Get
  734.         Set(ByVal v As Double)
  735.             _Current = v
  736.             Progress = v / _Maximum * 100
  737.             Invalidate()
  738.         End Set
  739.     End Property
  740.     Private _Progress As Double
  741.     Public Property Progress() As Double
  742.         Get
  743.             Return _Progress
  744.         End Get
  745.         Set(ByVal v As Double)
  746.             If v < 0 Then v = 0 Else If v > 100 Then v = 100
  747.             _Progress = v
  748.             _Current = v * 0.01 * _Maximum
  749.             Invalidate()
  750.         End Set
  751.     End Property
  752.  
  753.     Private _ShowPercentage As Boolean = True
  754.     Public Property ShowPercentage() As Boolean
  755.         Get
  756.             Return _ShowPercentage
  757.         End Get
  758.         Set(ByVal v As Boolean)
  759.             _ShowPercentage = v
  760.             Invalidate()
  761.         End Set
  762.     End Property
  763. #End Region
  764. #Region "Couleur"
  765.     Protected Overrides Sub OnPaintBackground(ByVal pevent As PaintEventArgs)
  766.     End Sub
  767.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  768.         Using B As New Bitmap(Width, Height)
  769.  
  770.             Using G = Graphics.FromImage(B)
  771.                 G.Clear(Color.FromArgb(255, 255, 255))
  772.  
  773.  
  774.  
  775.                 Dim Rect1 As Rectangle = New Rectangle(0, 0, Width - 7, Height)
  776.                 Dim Glow As New LinearGradientBrush(Rect1, Color.FromArgb(230, 230, 230), Color.FromArgb(230, 230, 230), -270S)
  777.                 G.FillPath(Glow, RoundRect(Rect1, 3))
  778.                 G.DrawPath(New Pen(Color.FromArgb(230, 230, 230)), RoundRect(Rect1, 3))
  779.                 Dim W = CInt(_Progress * 0.01 * Width)
  780.  
  781.                 Dim R As New Rectangle(3, 3, W - 7, Height - 7)
  782.  
  783.                 Dim Header As New LinearGradientBrush(R, Color.FromArgb(138, 138, 138), Color.FromArgb(138, 138, 138), 270S)
  784.                 G.FillPath(Header, RoundRect(R, 3))
  785.                 G.DrawPath(New Pen(Color.FromArgb(138, 138, 138)), RoundRect(R, 3))
  786.  
  787.             End Using
  788.             e.Graphics.DrawImage(B, 0, 0)
  789.         End Using
  790.         MyBase.OnPaint(e)
  791.     End Sub
  792.  
  793.  
  794. #End Region
  795. End Class
  796. Class KainedComboBox : Inherits Windows.Forms.ComboBox
  797.  
  798. #Region " Variables"
  799.  
  800.     Private W, H As Integer
  801.     Private _StartIndex As Integer = 0
  802.     Private x, y As Integer
  803.  
  804. #End Region
  805.     Public Function RoundRect(ByVal rectangle As Rectangle, ByVal curve As Integer) As GraphicsPath
  806.         Dim p As GraphicsPath = New GraphicsPath()
  807.         Dim arcRectangleWidth As Integer = curve * 2
  808.         p.AddArc(New Rectangle(rectangle.X, rectangle.Y, arcRectangleWidth, arcRectangleWidth), -180, 90)
  809.         p.AddArc(New Rectangle(rectangle.Width - arcRectangleWidth + rectangle.X, rectangle.Y, arcRectangleWidth, arcRectangleWidth), -90, 90)
  810.         p.AddArc(New Rectangle(rectangle.Width - arcRectangleWidth + rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y, arcRectangleWidth, arcRectangleWidth), 0, 90)
  811.         p.AddArc(New Rectangle(rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y, arcRectangleWidth, arcRectangleWidth), 90, 90)
  812.         p.AddLine(New Point(rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y), New Point(rectangle.X, curve + rectangle.Y))
  813.         Return p
  814.     End Function
  815.     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
  816.         Dim rectangle As Rectangle = New Rectangle(x, y, width, height)
  817.         Dim p As GraphicsPath = New GraphicsPath()
  818.         Dim arcRectangleWidth As Integer = curve * 2
  819.         p.AddArc(New Rectangle(rectangle.X, rectangle.Y, arcRectangleWidth, arcRectangleWidth), -180, 90)
  820.         p.AddArc(New Rectangle(rectangle.Width - arcRectangleWidth + rectangle.X, rectangle.Y, arcRectangleWidth, arcRectangleWidth), -90, 90)
  821.         p.AddArc(New Rectangle(rectangle.Width - arcRectangleWidth + rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y, arcRectangleWidth, arcRectangleWidth), 0, 90)
  822.         p.AddArc(New Rectangle(rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y, arcRectangleWidth, arcRectangleWidth), 90, 90)
  823.         p.AddLine(New Point(rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y), New Point(rectangle.X, curve + rectangle.Y))
  824.         Return p
  825.     End Function
  826. #Region " Properties"
  827.  
  828. #Region " Mouse States"
  829.  
  830.     Private State As MouseState = MouseState.None
  831.     Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
  832.         MyBase.OnMouseDown(e)
  833.         State = MouseState.Down : Invalidate()
  834.     End Sub
  835.     Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
  836.         MyBase.OnMouseUp(e)
  837.         State = MouseState.Over : Invalidate()
  838.     End Sub
  839.     Protected Overrides Sub OnMouseEnter(e As EventArgs)
  840.         MyBase.OnMouseEnter(e)
  841.         State = MouseState.Over : Invalidate()
  842.     End Sub
  843.     Protected Overrides Sub OnMouseLeave(e As EventArgs)
  844.         MyBase.OnMouseLeave(e)
  845.         State = MouseState.None : Invalidate()
  846.     End Sub
  847.  
  848.     Protected Overrides Sub OnMouseMove(e As MouseEventArgs)
  849.         MyBase.OnMouseMove(e)
  850.         x = e.Location.X
  851.         y = e.Location.Y
  852.         Invalidate()
  853.         If e.X < Width - 41 Then Cursor = Cursors.IBeam Else Cursor = Cursors.Hand
  854.     End Sub
  855.  
  856.     Protected Overrides Sub OnDrawItem(e As DrawItemEventArgs)
  857.         MyBase.OnDrawItem(e) : Invalidate()
  858.         If (e.State And DrawItemState.Selected) = DrawItemState.Selected Then
  859.             Invalidate()
  860.         End If
  861.     End Sub
  862.  
  863.     Protected Overrides Sub OnClick(e As EventArgs)
  864.         MyBase.OnClick(e) : Invalidate()
  865.     End Sub
  866.  
  867. #End Region
  868.  
  869. #Region " Colors"
  870.  
  871.     <Category("Colors")> _
  872.     Public Property BaseColor() As Color
  873.         Get
  874.             Return _BGColor
  875.         End Get
  876.         Set(value As Color)
  877.             _BGColor = value
  878.         End Set
  879.     End Property
  880.  
  881.     <Category("Colors")> _
  882.     Public Property HoverColor As Color
  883.         Get
  884.             Return _HoverColor
  885.         End Get
  886.         Set(value As Color)
  887.             _HoverColor = value
  888.         End Set
  889.     End Property
  890.  
  891. #End Region
  892.  
  893.     Private Property StartIndex As Integer
  894.         Get
  895.             Return _StartIndex
  896.         End Get
  897.         Set(ByVal value As Integer)
  898.             _StartIndex = value
  899.             Try
  900.                 MyBase.SelectedIndex = value
  901.             Catch
  902.             End Try
  903.             Invalidate()
  904.         End Set
  905.     End Property
  906.  
  907.     Sub DrawItem_(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles Me.DrawItem
  908.         If e.Index < 0 Then Exit Sub
  909.         e.DrawBackground()
  910.         e.DrawFocusRectangle()
  911.  
  912.         e.Graphics.SmoothingMode = 2
  913.         e.Graphics.PixelOffsetMode = 2
  914.         e.Graphics.TextRenderingHint = 5
  915.         e.Graphics.InterpolationMode = 7
  916.  
  917.         If (e.State And DrawItemState.Selected) = DrawItemState.Selected Then
  918.             '-- Selected item
  919.             e.Graphics.FillRectangle(New SolidBrush(_HoverColor), e.Bounds)
  920.         Else
  921.             '-- Not Selected
  922.             e.Graphics.FillRectangle(New SolidBrush(_BaseColor), e.Bounds)
  923.         End If
  924.  
  925.         '-- Text
  926.         e.Graphics.DrawString(MyBase.GetItemText(MyBase.Items(e.Index)), New Font("Segoe UI", 8), _
  927.                      Brushes.White, New Rectangle(e.Bounds.X + 2, e.Bounds.Y + 2, e.Bounds.Width, e.Bounds.Height))
  928.  
  929.  
  930.         e.Graphics.Dispose()
  931.     End Sub
  932.  
  933.     Protected Overrides Sub OnResize(e As EventArgs)
  934.         MyBase.OnResize(e)
  935.         Height = 18
  936.     End Sub
  937.  
  938. #End Region
  939.  
  940. #Region " Colors"
  941.     Private _BaseColor As Color = Color.FromArgb(218, 218, 218)
  942.     Private _BGColor As Color = Color.FromArgb(230, 230, 230)
  943.     Private _HoverColor As Color = Color.FromArgb(235, 75, 75)
  944.  
  945. #End Region
  946.  
  947.     Sub New()
  948.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or _
  949.                  ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer, True)
  950.         DoubleBuffered = True
  951.  
  952.         DrawMode = DrawMode.OwnerDrawFixed
  953.         BackColor = Color.FromArgb(245, 245, 245)
  954.         ForeColor = Color.White
  955.         DropDownStyle = ComboBoxStyle.DropDownList
  956.         Cursor = Cursors.Hand
  957.         StartIndex = 0
  958.         ItemHeight = 18
  959.         Font = New Font("Verdana", 10, FontStyle.Regular)
  960.     End Sub
  961.  
  962.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  963.         B = New Bitmap(Width, Height) : G = Graphics.FromImage(B)
  964.         W = Width : H = Height
  965.         Dim Base As Rectangle = New Rectangle(0, 0, Width - 1, Height - 1)
  966.         Dim buttonrect As New LinearGradientBrush(Base, _BaseColor, _BaseColor, LinearGradientMode.Vertical)
  967.         G.FillPath(buttonrect, RoundRect(Base, 3))
  968.         G.DrawPath(New Pen(Brushes.Gray), RoundRect(Base, 3))
  969.         Dim GP, GP2 As New GraphicsPath
  970.         With G
  971.             .Clear(Color.FromArgb(255, 255, 255))
  972.             .SmoothingMode = 2
  973.             .PixelOffsetMode = 2
  974.             .TextRenderingHint = 5
  975.             .FillPath(buttonrect, RoundRect(Base, 3))
  976.             Dim t As New Font("Segoe UI Symbol", 12, FontStyle.Regular)
  977.             .DrawString("⏷", t, New SolidBrush(Color.FromArgb(139, 139, 139)), W - 25, 0)
  978.             .DrawString(Text, Font, Brushes.Gray, New Point(4, 3), NearSF)
  979.         End With
  980.         G.Dispose()
  981.         e.Graphics.InterpolationMode = 7
  982.         e.Graphics.DrawImageUnscaled(B, 0, 0)
  983.         B.Dispose()
  984.     End Sub
  985. End Class
Advertisement
Add Comment
Please, Sign In to add comment