Advertisement
XenocodeRCE

QubeTheme

Sep 3rd, 2014
1,707
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 37.17 KB | None | 0 0
  1. Imports System.Drawing.Drawing2D
  2. Imports System.ComponentModel
  3.  
  4. '--------------------- [ THEME ] ---------------------
  5. 'Name: QubeTheme
  6. 'Creator: 0xabad1dea
  7. 'Credit: Temploit
  8. 'Created: 30.08.2014
  9. '-------------------- [ /THEME ] ---------------------
  10.  
  11. Class QubeForm
  12.     Inherits ThemeContainer154
  13.  
  14. #Region "Functions | Create form"
  15.     Private CreateRoundPath As GraphicsPath
  16.  
  17. #End Region
  18.  
  19.     Private _LeftPanelSize As Integer
  20.     <Category("Options")> _
  21.     Public Property PanelSize As Integer
  22.         Get
  23.             Return _LeftPanelSize
  24.         End Get
  25.         Set(value As Integer)
  26.             _LeftPanelSize = value
  27.         End Set
  28.     End Property
  29.  
  30.     Sub New()
  31.         DoubleBuffered = True
  32.         _LeftPanelSize = 4
  33.         Size = New Size(396, 235)
  34.     End Sub
  35.  
  36.     Protected Overrides Sub ColorHook()
  37.         BackColor = Color.FromArgb(255, 255, 255)
  38.         Font = New Font("Segoe UI", 15, FontStyle.Regular)
  39.     End Sub
  40.  
  41.     Protected Overrides Sub PaintHook()
  42.         TransparencyKey = Color.Fuchsia
  43.         G.Clear(Color.Fuchsia)
  44.  
  45.         G.SmoothingMode = SmoothingMode.Default
  46.         G.TextRenderingHint = Drawing.Text.TextRenderingHint.ClearTypeGridFit
  47.         G.InterpolationMode = InterpolationMode.HighQualityBicubic
  48.  
  49.  
  50.         Dim GP2 As GraphicsPath = CreateRound(New Rectangle(-1, -1, Width, Height + 2), 1)
  51.         G.FillPath(New SolidBrush(Color.FromArgb(255, 255, 255)), GP2)
  52.         G.SmoothingMode = SmoothingMode.HighQuality
  53.  
  54.         G.SmoothingMode = SmoothingMode.HighQuality
  55.         Dim GP3 As GraphicsPath = CreateRound(New Rectangle(-1, -1, Width / _LeftPanelSize, Height + 2), 1)
  56.         G.FillPath(New SolidBrush(Color.FromArgb(68, 76, 99)), GP3)
  57.         G.SmoothingMode = SmoothingMode.HighQuality
  58.  
  59.  
  60.     End Sub
  61.  
  62. End Class
  63. Class QubeWhiteTextbox : Inherits Control
  64.     Dim WithEvents _tb As New TextBox
  65.  
  66. #Region "Declaration and shits"
  67.     Public Function RoundRect(ByVal rectangle As Rectangle, ByVal curve As Integer) As GraphicsPath
  68.         Dim p As GraphicsPath = New GraphicsPath()
  69.         Dim arcRectangleWidth As Integer = curve * 2
  70.         p.AddArc(New Rectangle(rectangle.X, rectangle.Y, arcRectangleWidth, arcRectangleWidth), -180, 90)
  71.         p.AddArc(New Rectangle(rectangle.Width - arcRectangleWidth + rectangle.X, rectangle.Y, arcRectangleWidth, arcRectangleWidth), -90, 90)
  72.         p.AddArc(New Rectangle(rectangle.Width - arcRectangleWidth + rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y, arcRectangleWidth, arcRectangleWidth), 0, 90)
  73.         p.AddArc(New Rectangle(rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y, arcRectangleWidth, arcRectangleWidth), 90, 90)
  74.         p.AddLine(New Point(rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y), New Point(rectangle.X, curve + rectangle.Y))
  75.         Return p
  76.     End Function
  77.     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
  78.         Dim rectangle As Rectangle = New Rectangle(x, y, width, height)
  79.         Dim p As GraphicsPath = New GraphicsPath()
  80.         Dim arcRectangleWidth As Integer = curve * 2
  81.         p.AddArc(New Rectangle(rectangle.X, rectangle.Y, arcRectangleWidth, arcRectangleWidth), -180, 90)
  82.         p.AddArc(New Rectangle(rectangle.Width - arcRectangleWidth + rectangle.X, rectangle.Y, arcRectangleWidth, arcRectangleWidth), -90, 90)
  83.         p.AddArc(New Rectangle(rectangle.Width - arcRectangleWidth + rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y, arcRectangleWidth, arcRectangleWidth), 0, 90)
  84.         p.AddArc(New Rectangle(rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y, arcRectangleWidth, arcRectangleWidth), 90, 90)
  85.         p.AddLine(New Point(rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y), New Point(rectangle.X, curve + rectangle.Y))
  86.         Return p
  87.     End Function
  88.  
  89.     Private _allowpassword As Boolean = False
  90.     Public Shadows Property UseSystemPasswordChar() As Boolean
  91.         Get
  92.             Return _allowpassword
  93.         End Get
  94.         Set(ByVal value As Boolean)
  95.             _tb.UseSystemPasswordChar = UseSystemPasswordChar
  96.             _allowpassword = value
  97.             Invalidate()
  98.         End Set
  99.     End Property
  100.  
  101.     Private _maxChars As Integer = 32767
  102.     Public Shadows Property MaxLength() As Integer
  103.         Get
  104.             Return _maxChars
  105.         End Get
  106.         Set(ByVal value As Integer)
  107.             _maxChars = value
  108.             _tb.MaxLength = MaxLength
  109.             Invalidate()
  110.         End Set
  111.     End Property
  112.  
  113.     Private _textAlignment As HorizontalAlignment
  114.     Public Shadows Property TextAlign() As HorizontalAlignment
  115.         Get
  116.             Return _textAlignment
  117.         End Get
  118.         Set(ByVal value As HorizontalAlignment)
  119.             _textAlignment = value
  120.             Invalidate()
  121.         End Set
  122.     End Property
  123.  
  124.     Private _multiLine As Boolean = False
  125.     Public Shadows Property MultiLine() As Boolean
  126.         Get
  127.             Return _multiLine
  128.         End Get
  129.         Set(ByVal value As Boolean)
  130.             _multiLine = value
  131.             _tb.Multiline = value
  132.             OnResize(EventArgs.Empty)
  133.             Invalidate()
  134.         End Set
  135.     End Property
  136.  
  137.     Private _readOnly As Boolean = False
  138.     Public Shadows Property [ReadOnly]() As Boolean
  139.         Get
  140.             Return _readOnly
  141.         End Get
  142.         Set(ByVal value As Boolean)
  143.             _readOnly = value
  144.             If _tb IsNot Nothing Then
  145.                 _tb.ReadOnly = value
  146.             End If
  147.         End Set
  148.     End Property
  149.  
  150.     Protected Overrides Sub OnTextChanged(ByVal e As EventArgs)
  151.         MyBase.OnTextChanged(e)
  152.         Invalidate()
  153.     End Sub
  154.  
  155.     Protected Overrides Sub OnBackColorChanged(ByVal e As EventArgs)
  156.         MyBase.OnBackColorChanged(e)
  157.         Invalidate()
  158.     End Sub
  159.  
  160.     Protected Overrides Sub OnForeColorChanged(ByVal e As EventArgs)
  161.         MyBase.OnForeColorChanged(e)
  162.         _tb.ForeColor = ForeColor
  163.         Invalidate()
  164.     End Sub
  165.  
  166.     Protected Overrides Sub OnFontChanged(ByVal e As EventArgs)
  167.         MyBase.OnFontChanged(e)
  168.         _tb.Font = Font
  169.     End Sub
  170.  
  171.     Protected Overrides Sub OnGotFocus(ByVal e As EventArgs)
  172.         MyBase.OnGotFocus(e)
  173.         _tb.Focus()
  174.     End Sub
  175.  
  176.     Private Sub TextChangeTb() Handles _tb.TextChanged
  177.         Text = _tb.Text
  178.     End Sub
  179.  
  180.     Private Sub TextChng() Handles MyBase.TextChanged
  181.         _tb.Text = Text
  182.     End Sub
  183.  
  184. #End Region
  185.  
  186.     Public Sub NewTextBox()
  187.         With _tb
  188.             .Text = String.Empty
  189.             .BackColor = Color.FromArgb(68, 76, 99)
  190.             .ForeColor = ForeColor
  191.             .TextAlign = HorizontalAlignment.Center
  192.             .BorderStyle = BorderStyle.None
  193.             .Location = New Point(3, 3)
  194.             .Font = New Font("Verdana", 10, FontStyle.Regular)
  195.             .Size = New Size(Width - 3, Height - 3)
  196.             .UseSystemPasswordChar = UseSystemPasswordChar
  197.         End With
  198.     End Sub
  199.  
  200.     Sub New()
  201.         MyBase.New()
  202.         NewTextBox()
  203.         Controls.Add(_tb)
  204.         SetStyle(ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  205.         DoubleBuffered = True
  206.         TextAlign = HorizontalAlignment.Center
  207.         BackColor = Color.FromArgb(255, 255, 255)
  208.         ForeColor = Color.FromArgb(255, 255, 251)
  209.         Font = New Font("Verdana", 10, FontStyle.Regular)
  210.         Size = New Size(132, 29)
  211.     End Sub
  212.  
  213.     Protected Overrides Sub OnPaint(ByVal e As Windows.Forms.PaintEventArgs)
  214.         Dim b As Bitmap = New Bitmap(Width, Height)
  215.         Dim g As Graphics = Graphics.FromImage(b)
  216.         Dim rect As Rectangle = New Rectangle(0, 0, Width - 1, Height - 1)
  217.         MyBase.OnPaint(e)
  218.         g.SmoothingMode = SmoothingMode.HighQuality
  219.         g.InterpolationMode = InterpolationMode.HighQualityBicubic
  220.         g.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
  221.         With _tb
  222.             .TextAlign = TextAlign
  223.             .UseSystemPasswordChar = UseSystemPasswordChar
  224.         End With
  225.         g.FillPath(New SolidBrush(Color.FromArgb(68, 76, 99)), RoundRect(rect, 3))
  226.         g.DrawPath(New Pen(Color.FromArgb(0, 182, 248)), RoundRect(rect, 3))
  227.         e.Graphics.DrawImage(b, New Point(0, 0))
  228.         g.Dispose() : b.Dispose()
  229.     End Sub
  230.  
  231.     Protected Overrides Sub OnResize(e As EventArgs)
  232.         MyBase.OnResize(e)
  233.         If Not MultiLine Then
  234.             Dim tbheight As Integer = _tb.Height
  235.             _tb.Location = New Point(10, CType(((Height / 2) - (tbheight / 2) - 0), Integer))
  236.             _tb.Size = New Size(Width - 20, tbheight)
  237.         Else
  238.             _tb.Location = New Point(10, 10)
  239.             _tb.Size = New Size(Width - 20, Height - 20)
  240.         End If
  241.     End Sub
  242. End Class
  243. Class QubeTextbox : Inherits Control
  244.     Dim WithEvents _tb As New TextBox
  245.  
  246. #Region "Declaration and shits"
  247.     Public Function RoundRect(ByVal rectangle As Rectangle, ByVal curve As Integer) As GraphicsPath
  248.         Dim p As GraphicsPath = New GraphicsPath()
  249.         Dim arcRectangleWidth As Integer = curve * 2
  250.         p.AddArc(New Rectangle(rectangle.X, rectangle.Y, arcRectangleWidth, arcRectangleWidth), -180, 90)
  251.         p.AddArc(New Rectangle(rectangle.Width - arcRectangleWidth + rectangle.X, rectangle.Y, arcRectangleWidth, arcRectangleWidth), -90, 90)
  252.         p.AddArc(New Rectangle(rectangle.Width - arcRectangleWidth + rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y, arcRectangleWidth, arcRectangleWidth), 0, 90)
  253.         p.AddArc(New Rectangle(rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y, arcRectangleWidth, arcRectangleWidth), 90, 90)
  254.         p.AddLine(New Point(rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y), New Point(rectangle.X, curve + rectangle.Y))
  255.         Return p
  256.     End Function
  257.     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
  258.         Dim rectangle As Rectangle = New Rectangle(x, y, width, height)
  259.         Dim p As GraphicsPath = New GraphicsPath()
  260.         Dim arcRectangleWidth As Integer = curve * 2
  261.         p.AddArc(New Rectangle(rectangle.X, rectangle.Y, arcRectangleWidth, arcRectangleWidth), -180, 90)
  262.         p.AddArc(New Rectangle(rectangle.Width - arcRectangleWidth + rectangle.X, rectangle.Y, arcRectangleWidth, arcRectangleWidth), -90, 90)
  263.         p.AddArc(New Rectangle(rectangle.Width - arcRectangleWidth + rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y, arcRectangleWidth, arcRectangleWidth), 0, 90)
  264.         p.AddArc(New Rectangle(rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y, arcRectangleWidth, arcRectangleWidth), 90, 90)
  265.         p.AddLine(New Point(rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y), New Point(rectangle.X, curve + rectangle.Y))
  266.         Return p
  267.     End Function
  268.  
  269.     Private _allowpassword As Boolean = False
  270.     Public Shadows Property UseSystemPasswordChar() As Boolean
  271.         Get
  272.             Return _allowpassword
  273.         End Get
  274.         Set(ByVal value As Boolean)
  275.             _tb.UseSystemPasswordChar = UseSystemPasswordChar
  276.             _allowpassword = value
  277.             Invalidate()
  278.         End Set
  279.     End Property
  280.  
  281.     Private _maxChars As Integer = 32767
  282.     Public Shadows Property MaxLength() As Integer
  283.         Get
  284.             Return _maxChars
  285.         End Get
  286.         Set(ByVal value As Integer)
  287.             _maxChars = value
  288.             _tb.MaxLength = MaxLength
  289.             Invalidate()
  290.         End Set
  291.     End Property
  292.  
  293.     Private _textAlignment As HorizontalAlignment
  294.     Public Shadows Property TextAlign() As HorizontalAlignment
  295.         Get
  296.             Return _textAlignment
  297.         End Get
  298.         Set(ByVal value As HorizontalAlignment)
  299.             _textAlignment = value
  300.             Invalidate()
  301.         End Set
  302.     End Property
  303.  
  304.     Private _multiLine As Boolean = False
  305.     Public Shadows Property MultiLine() As Boolean
  306.         Get
  307.             Return _multiLine
  308.         End Get
  309.         Set(ByVal value As Boolean)
  310.             _multiLine = value
  311.             _tb.Multiline = value
  312.             OnResize(EventArgs.Empty)
  313.             Invalidate()
  314.         End Set
  315.     End Property
  316.  
  317.     Private _readOnly As Boolean = False
  318.     Public Shadows Property [ReadOnly]() As Boolean
  319.         Get
  320.             Return _readOnly
  321.         End Get
  322.         Set(ByVal value As Boolean)
  323.             _readOnly = value
  324.             If _tb IsNot Nothing Then
  325.                 _tb.ReadOnly = value
  326.             End If
  327.         End Set
  328.     End Property
  329.  
  330.     Protected Overrides Sub OnTextChanged(ByVal e As EventArgs)
  331.         MyBase.OnTextChanged(e)
  332.         Invalidate()
  333.     End Sub
  334.  
  335.     Protected Overrides Sub OnBackColorChanged(ByVal e As EventArgs)
  336.         MyBase.OnBackColorChanged(e)
  337.         Invalidate()
  338.     End Sub
  339.  
  340.     Protected Overrides Sub OnForeColorChanged(ByVal e As EventArgs)
  341.         MyBase.OnForeColorChanged(e)
  342.         _tb.ForeColor = ForeColor
  343.         Invalidate()
  344.     End Sub
  345.  
  346.     Protected Overrides Sub OnFontChanged(ByVal e As EventArgs)
  347.         MyBase.OnFontChanged(e)
  348.         _tb.Font = Font
  349.     End Sub
  350.  
  351.     Protected Overrides Sub OnGotFocus(ByVal e As EventArgs)
  352.         MyBase.OnGotFocus(e)
  353.         _tb.Focus()
  354.     End Sub
  355.  
  356.     Private Sub TextChangeTb() Handles _tb.TextChanged
  357.         Text = _tb.Text
  358.     End Sub
  359.  
  360.     Private Sub TextChng() Handles MyBase.TextChanged
  361.         _tb.Text = Text
  362.     End Sub
  363.  
  364. #End Region
  365.  
  366.     Public Sub NewTextBox()
  367.         With _tb
  368.             .Text = String.Empty
  369.             .BackColor = Color.FromArgb(68, 76, 99)
  370.             .ForeColor = ForeColor
  371.             .TextAlign = HorizontalAlignment.Center
  372.             .BorderStyle = BorderStyle.None
  373.             .Location = New Point(3, 3)
  374.             .Font = New Font("Verdana", 10, FontStyle.Regular)
  375.             .Size = New Size(Width - 3, Height - 3)
  376.             .UseSystemPasswordChar = UseSystemPasswordChar
  377.         End With
  378.     End Sub
  379.  
  380.     Sub New()
  381.         MyBase.New()
  382.         NewTextBox()
  383.         Controls.Add(_tb)
  384.         SetStyle(ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  385.         DoubleBuffered = True
  386.         TextAlign = HorizontalAlignment.Center
  387.         BackColor = Color.FromArgb(68, 76, 99)
  388.         ForeColor = Color.FromArgb(255, 255, 251)
  389.         Font = New Font("Verdana", 10, FontStyle.Regular)
  390.         Size = New Size(132, 29)
  391.     End Sub
  392.  
  393.     Protected Overrides Sub OnPaint(ByVal e As Windows.Forms.PaintEventArgs)
  394.         Dim b As Bitmap = New Bitmap(Width, Height)
  395.         Dim g As Graphics = Graphics.FromImage(b)
  396.         Dim rect As Rectangle = New Rectangle(0, 0, Width - 1, Height - 1)
  397.         MyBase.OnPaint(e)
  398.         g.SmoothingMode = SmoothingMode.HighQuality
  399.         g.InterpolationMode = InterpolationMode.HighQualityBicubic
  400.         g.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
  401.         With _tb
  402.             .TextAlign = TextAlign
  403.             .UseSystemPasswordChar = UseSystemPasswordChar
  404.         End With
  405.         g.FillPath(New SolidBrush(Color.FromArgb(68, 76, 99)), RoundRect(rect, 3))
  406.         g.DrawPath(New Pen(Color.FromArgb(0, 182, 248)), RoundRect(rect, 3))
  407.         e.Graphics.DrawImage(b, New Point(0, 0))
  408.         g.Dispose() : b.Dispose()
  409.     End Sub
  410.  
  411.     Protected Overrides Sub OnResize(e As EventArgs)
  412.         MyBase.OnResize(e)
  413.         If Not MultiLine Then
  414.             Dim tbheight As Integer = _tb.Height
  415.             _tb.Location = New Point(10, CType(((Height / 2) - (tbheight / 2) - 0), Integer))
  416.             _tb.Size = New Size(Width - 20, tbheight)
  417.         Else
  418.             _tb.Location = New Point(10, 10)
  419.             _tb.Size = New Size(Width - 20, Height - 20)
  420.         End If
  421.     End Sub
  422. End Class
  423. Class QubeButton : Inherits Control
  424.     Dim _state As MouseState
  425. #Region "Declaration and shits"
  426.     Public Function RoundRect(ByVal rectangle As Rectangle, ByVal curve As Integer) As GraphicsPath
  427.         Dim p As GraphicsPath = New GraphicsPath()
  428.         Dim arcRectangleWidth As Integer = curve * 2
  429.         p.AddArc(New Rectangle(rectangle.X, rectangle.Y, arcRectangleWidth, arcRectangleWidth), -180, 90)
  430.         p.AddArc(New Rectangle(rectangle.Width - arcRectangleWidth + rectangle.X, rectangle.Y, arcRectangleWidth, arcRectangleWidth), -90, 90)
  431.         p.AddArc(New Rectangle(rectangle.Width - arcRectangleWidth + rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y, arcRectangleWidth, arcRectangleWidth), 0, 90)
  432.         p.AddArc(New Rectangle(rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y, arcRectangleWidth, arcRectangleWidth), 90, 90)
  433.         p.AddLine(New Point(rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y), New Point(rectangle.X, curve + rectangle.Y))
  434.         Return p
  435.     End Function
  436.     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
  437.         Dim rectangle As Rectangle = New Rectangle(x, y, width, height)
  438.         Dim p As GraphicsPath = New GraphicsPath()
  439.         Dim arcRectangleWidth As Integer = curve * 2
  440.         p.AddArc(New Rectangle(rectangle.X, rectangle.Y, arcRectangleWidth, arcRectangleWidth), -180, 90)
  441.         p.AddArc(New Rectangle(rectangle.Width - arcRectangleWidth + rectangle.X, rectangle.Y, arcRectangleWidth, arcRectangleWidth), -90, 90)
  442.         p.AddArc(New Rectangle(rectangle.Width - arcRectangleWidth + rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y, arcRectangleWidth, arcRectangleWidth), 0, 90)
  443.         p.AddArc(New Rectangle(rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y, arcRectangleWidth, arcRectangleWidth), 90, 90)
  444.         p.AddLine(New Point(rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y), New Point(rectangle.X, curve + rectangle.Y))
  445.         Return p
  446.     End Function
  447.     Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  448.         MyBase.OnMouseDown(e)
  449.         _state = MouseState.Down
  450.         Invalidate()
  451.     End Sub
  452.  
  453.     Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  454.         MyBase.OnMouseUp(e)
  455.         _state = MouseState.Over
  456.         Invalidate()
  457.     End Sub
  458.  
  459.     Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
  460.         MyBase.OnMouseEnter(e)
  461.         _state = MouseState.Over
  462.         Invalidate()
  463.     End Sub
  464.  
  465.     Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
  466.         MyBase.OnMouseLeave(e)
  467.         _state = MouseState.None
  468.         Invalidate()
  469.     End Sub
  470.  
  471. #End Region
  472.  
  473.  
  474.     Sub New()
  475.         SetStyle(ControlStyles.UserPaint Or ControlStyles.ResizeRedraw Or ControlStyles.SupportsTransparentBackColor, True)
  476.         BackColor = Color.Transparent
  477.         DoubleBuffered = True
  478.         Size = New Size(56, 17)
  479.         _state = MouseState.None
  480.     End Sub
  481.  
  482.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  483.         Dim b As Bitmap = New Bitmap(Width, Height)
  484.         Dim g As Graphics = Graphics.FromImage(b)
  485.         Dim rect As Rectangle = New Rectangle(0, 0, Width - 1, Height - 1)
  486.         Dim btnfont As New Font("Verdana", 10, FontStyle.Regular)
  487.         MyBase.OnPaint(e)
  488.         g.SmoothingMode = SmoothingMode.HighQuality
  489.         g.InterpolationMode = InterpolationMode.HighQualityBicubic
  490.         g.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
  491.         g.Clear(BackColor)
  492.         Dim buttonrect As New LinearGradientBrush(rect, Color.FromArgb(68, 76, 99), Color.FromArgb(68, 76, 99), LinearGradientMode.Vertical)
  493.         g.FillPath(buttonrect, RoundRect(rect, 3))
  494.         g.DrawPath(New Pen(Brushes.Gray), RoundRect(rect, 3))
  495.         Select Case _state
  496.             Case MouseState.None
  497.                 Dim buttonrectnone As New LinearGradientBrush(rect, Color.FromArgb(68, 76, 99), Color.FromArgb(68, 76, 99), LinearGradientMode.Vertical)
  498.                 g.FillPath(buttonrectnone, RoundRect(rect, 3))
  499.                 g.DrawPath(New Pen(Color.FromArgb(68, 76, 99)), RoundRect(rect, 3))
  500.                 g.DrawString(Text, btnfont, Brushes.White, New Rectangle(0, 0, Width - 1, Height - 1), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  501.             Case MouseState.Down
  502.                 Dim buttonrectnone As New LinearGradientBrush(rect, Color.FromArgb(105, 120, 149), Color.FromArgb(105, 120, 149), LinearGradientMode.Vertical)
  503.                 g.FillPath(buttonrectnone, RoundRect(rect, 3))
  504.                 g.DrawPath(New Pen(Color.FromArgb(105, 120, 149)), RoundRect(rect, 3))
  505.                 g.DrawString(Text, btnfont, Brushes.White, New Rectangle(0, 0, Width - 1, Height - 1), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  506.             Case MouseState.Over
  507.                 Dim buttonrectnone As New LinearGradientBrush(rect, Color.FromArgb(68, 76, 99), Color.FromArgb(68, 76, 99), LinearGradientMode.Vertical)
  508.                 g.FillPath(buttonrectnone, RoundRect(rect, 3))
  509.                 g.DrawPath(New Pen(Color.FromArgb(68, 76, 99)), RoundRect(rect, 3))
  510.                 g.DrawString(Text, btnfont, Brushes.White, New Rectangle(0, 0, Width - 1, Height - 1), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  511.         End Select
  512.         e.Graphics.DrawImage(b, New Point(0, 0))
  513.         g.Dispose() : b.Dispose()
  514.     End Sub
  515. End Class
  516. Class QubeProgressBar
  517.     Inherits Control
  518. #Region " Properties "
  519.     Dim WithEvents Pgs As New ProgressBar()
  520.     Sub New()
  521.         Size = New Point(132, 14)
  522.     End Sub
  523.     Private _Maximum As Double
  524.     Public Property Maximum() As Double
  525.         Get
  526.             Return _Maximum
  527.         End Get
  528.         Set(ByVal v As Double)
  529.             _Maximum = v
  530.             Progress = _Current / v * 100
  531.             Invalidate()
  532.         End Set
  533.     End Property
  534.  
  535.  
  536.     Private _Current As Double
  537.     Public Property Current() As Double
  538.         Get
  539.             Return _Current
  540.         End Get
  541.         Set(ByVal v As Double)
  542.             _Current = v
  543.             Progress = v / _Maximum * 100
  544.             Invalidate()
  545.         End Set
  546.     End Property
  547.     Private _Progress As Double
  548.     Public Property Progress() As Double
  549.         Get
  550.             Return _Progress
  551.         End Get
  552.         Set(ByVal v As Double)
  553.             If v < 0 Then v = 0 Else If v > 100 Then v = 100
  554.             _Progress = v
  555.             _Current = v * 0.01 * _Maximum
  556.             Invalidate()
  557.         End Set
  558.     End Property
  559.  
  560.     Private _ShowPercentage As Boolean = True
  561.     Public Property ShowPercentage() As Boolean
  562.         Get
  563.             Return _ShowPercentage
  564.         End Get
  565.         Set(ByVal v As Boolean)
  566.             _ShowPercentage = v
  567.             Invalidate()
  568.         End Set
  569.     End Property
  570. #End Region
  571. #Region "Couleur"
  572.     Protected Overrides Sub OnPaintBackground(ByVal pevent As PaintEventArgs)
  573.     End Sub
  574.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  575.         Using B As New Bitmap(Width, Height)
  576.  
  577.             Using G = Graphics.FromImage(B)
  578.                 G.Clear(Color.FromArgb(68, 76, 99))
  579.                 Dim Glow As New LinearGradientBrush(New Rectangle(3, 3, Width - 7, Height - 7), Color.FromArgb(54, 62, 83), Color.FromArgb(54, 62, 83), -270S)
  580.                 G.FillRectangle(Glow, New Rectangle(3, 3, Width - 7, Height - 7)) '54,62,83
  581.                 G.DrawRectangle(New Pen(Color.FromArgb(54, 62, 83)), New Rectangle(3, 3, Width - 7, Height - 7))
  582.                 Dim W = CInt(_Progress * 0.01 * Width)
  583.  
  584.                 Dim R As New Rectangle(3, 3, W - 7, Height - 6)
  585.  
  586.                 Dim Header As New LinearGradientBrush(R, Color.FromArgb(0, 182, 248), Color.FromArgb(0, 182, 248), 270S)
  587.                 G.FillRectangle(Header, R)
  588.  
  589.                 G.FillRectangle(New SolidBrush(Color.FromArgb(3, Color.White)), R.X, R.Y, R.Width, CInt(R.Height * 0.25))
  590.             End Using
  591.             e.Graphics.DrawImage(B, 0, 0)
  592.         End Using
  593.         MyBase.OnPaint(e)
  594.     End Sub
  595.  
  596.  
  597. #End Region
  598. End Class
  599. Class QubeWhiteProgressBar
  600.     Inherits Control
  601. #Region " Properties "
  602.     Dim WithEvents Pgs As New ProgressBar()
  603.     Sub New()
  604.         Size = New Point(132, 14)
  605.     End Sub
  606.     Private _Maximum As Double
  607.     Public Property Maximum() As Double
  608.         Get
  609.             Return _Maximum
  610.         End Get
  611.         Set(ByVal v As Double)
  612.             _Maximum = v
  613.             Progress = _Current / v * 100
  614.             Invalidate()
  615.         End Set
  616.     End Property
  617.  
  618.  
  619.     Private _Current As Double
  620.     Public Property Current() As Double
  621.         Get
  622.             Return _Current
  623.         End Get
  624.         Set(ByVal v As Double)
  625.             _Current = v
  626.             Progress = v / _Maximum * 100
  627.             Invalidate()
  628.         End Set
  629.     End Property
  630.     Private _Progress As Double
  631.     Public Property Progress() As Double
  632.         Get
  633.             Return _Progress
  634.         End Get
  635.         Set(ByVal v As Double)
  636.             If v < 0 Then v = 0 Else If v > 100 Then v = 100
  637.             _Progress = v
  638.             _Current = v * 0.01 * _Maximum
  639.             Invalidate()
  640.         End Set
  641.     End Property
  642.  
  643.     Private _ShowPercentage As Boolean = True
  644.     Public Property ShowPercentage() As Boolean
  645.         Get
  646.             Return _ShowPercentage
  647.         End Get
  648.         Set(ByVal v As Boolean)
  649.             _ShowPercentage = v
  650.             Invalidate()
  651.         End Set
  652.     End Property
  653. #End Region
  654. #Region "Couleur"
  655.     Protected Overrides Sub OnPaintBackground(ByVal pevent As PaintEventArgs)
  656.     End Sub
  657.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  658.         Using B As New Bitmap(Width, Height)
  659.  
  660.             Using G = Graphics.FromImage(B)
  661.                 G.Clear(Color.FromArgb(255, 255, 255))
  662.                 Dim Glow As New LinearGradientBrush(New Rectangle(3, 3, Width - 7, Height - 7), Color.FromArgb(54, 62, 83), Color.FromArgb(54, 62, 83), -270S)
  663.                 G.FillRectangle(Glow, New Rectangle(3, 3, Width - 7, Height - 7)) '54,62,83
  664.                 G.DrawRectangle(New Pen(Color.FromArgb(54, 62, 83)), New Rectangle(3, 3, Width - 7, Height - 7))
  665.                 Dim W = CInt(_Progress * 0.01 * Width)
  666.  
  667.                 Dim R As New Rectangle(3, 3, W - 7, Height - 6)
  668.  
  669.                 Dim Header As New LinearGradientBrush(R, Color.FromArgb(0, 182, 248), Color.FromArgb(0, 182, 248), 270S)
  670.                 G.FillRectangle(Header, R)
  671.  
  672.                 G.FillRectangle(New SolidBrush(Color.FromArgb(3, Color.White)), R.X, R.Y, R.Width, CInt(R.Height * 0.25))
  673.             End Using
  674.             e.Graphics.DrawImage(B, 0, 0)
  675.         End Using
  676.         MyBase.OnPaint(e)
  677.     End Sub
  678.  
  679.  
  680. #End Region
  681. End Class
  682. <DefaultEvent("CheckedChanged")> Class QubeCheckBox : Inherits Control
  683.  
  684. #Region " Control Help - MouseState & Flicker Control"
  685.     Private State As MouseState = MouseState.None
  686.  
  687.     Public Function RoundRect(ByVal rectangle As Rectangle, ByVal curve As Integer) As GraphicsPath
  688.         Dim p As GraphicsPath = New GraphicsPath()
  689.         Dim arcRectangleWidth As Integer = curve * 2
  690.         p.AddArc(New Rectangle(rectangle.X, rectangle.Y, arcRectangleWidth, arcRectangleWidth), -180, 90)
  691.         p.AddArc(New Rectangle(rectangle.Width - arcRectangleWidth + rectangle.X, rectangle.Y, arcRectangleWidth, arcRectangleWidth), -90, 90)
  692.         p.AddArc(New Rectangle(rectangle.Width - arcRectangleWidth + rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y, arcRectangleWidth, arcRectangleWidth), 0, 90)
  693.         p.AddArc(New Rectangle(rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y, arcRectangleWidth, arcRectangleWidth), 90, 90)
  694.         p.AddLine(New Point(rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y), New Point(rectangle.X, curve + rectangle.Y))
  695.         Return p
  696.     End Function
  697.     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
  698.         Dim rectangle As Rectangle = New Rectangle(x, y, width, height)
  699.         Dim p As GraphicsPath = New GraphicsPath()
  700.         Dim arcRectangleWidth As Integer = curve * 2
  701.         p.AddArc(New Rectangle(rectangle.X, rectangle.Y, arcRectangleWidth, arcRectangleWidth), -180, 90)
  702.         p.AddArc(New Rectangle(rectangle.Width - arcRectangleWidth + rectangle.X, rectangle.Y, arcRectangleWidth, arcRectangleWidth), -90, 90)
  703.         p.AddArc(New Rectangle(rectangle.Width - arcRectangleWidth + rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y, arcRectangleWidth, arcRectangleWidth), 0, 90)
  704.         p.AddArc(New Rectangle(rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y, arcRectangleWidth, arcRectangleWidth), 90, 90)
  705.         p.AddLine(New Point(rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y), New Point(rectangle.X, curve + rectangle.Y))
  706.         Return p
  707.     End Function
  708.  
  709.     Protected Overrides Sub OnMouseEnter(ByVal e As System.EventArgs)
  710.         MyBase.OnMouseEnter(e)
  711.         State = MouseState.Over
  712.         Invalidate()
  713.     End Sub
  714.     Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  715.         MyBase.OnMouseDown(e)
  716.         State = MouseState.Down
  717.         Invalidate()
  718.     End Sub
  719.     Protected Overrides Sub OnMouseLeave(ByVal e As System.EventArgs)
  720.         MyBase.OnMouseLeave(e)
  721.         State = MouseState.None
  722.         Invalidate()
  723.     End Sub
  724.     Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
  725.         MyBase.OnMouseUp(e)
  726.         State = MouseState.Over
  727.         Invalidate()
  728.     End Sub
  729.     Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
  730.         MyBase.OnTextChanged(e)
  731.         Invalidate()
  732.     End Sub
  733.     Private _Checked As Boolean
  734.     Property Checked() As Boolean
  735.         Get
  736.             Return _Checked
  737.         End Get
  738.         Set(ByVal value As Boolean)
  739.             _Checked = value
  740.             Invalidate()
  741.         End Set
  742.     End Property
  743.     Protected Overrides Sub OnResize(ByVal e As System.EventArgs)
  744.         MyBase.OnResize(e)
  745.         Height = 14
  746.     End Sub
  747.     Protected Overrides Sub OnClick(ByVal e As System.EventArgs)
  748.         _Checked = Not _Checked
  749.         RaiseEvent CheckedChanged(Me)
  750.         MyBase.OnClick(e)
  751.     End Sub
  752.     Event CheckedChanged(ByVal sender As Object)
  753. #End Region
  754.  
  755.  
  756.     Sub New()
  757.         MyBase.New()
  758.         SetStyle(ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor Or ControlStyles.OptimizedDoubleBuffer, True)
  759.         BackColor = Color.Transparent
  760.         ForeColor = Color.Black
  761.         Font = New Font("Verdana", 8, FontStyle.Regular)
  762.         Size = New Size(145, 16)
  763.         DoubleBuffered = True
  764.     End Sub
  765.  
  766.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  767.         Dim B As New Bitmap(Width, Height)
  768.         Dim G As Graphics = Graphics.FromImage(B)
  769.         Dim checkBoxRectangle As New Rectangle(0, 0, Height, Height - 1)
  770.         Dim Inner As New Rectangle(0, 0, Height, Height - 1)
  771.  
  772.         G.SmoothingMode = SmoothingMode.HighQuality
  773.         G.InterpolationMode = InterpolationMode.HighQualityBicubic
  774.         G.CompositingQuality = CompositingQuality.HighQuality
  775.         G.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
  776.  
  777.         G.Clear(Color.Transparent)
  778.  
  779.         Dim bodyGrad As New LinearGradientBrush(checkBoxRectangle, Color.FromArgb(68, 76, 99), Color.FromArgb(68, 76, 99), 90S)
  780.         'G.FillRectangle(bodyGrad, bodyGrad.Rectangle)
  781.         G.FillPath(New SolidBrush(Color.FromArgb(68, 76, 99)), RoundRect(checkBoxRectangle, 3))
  782.         'G.DrawRectangle(New Pen(Color.FromArgb(26, 26, 26)), checkBoxRectangle)
  783.         'G.DrawRectangle(New Pen(Color.FromArgb(0, 182, 248)), RoundRect(Inner, 3))
  784.  
  785.         'G.FillPath(New SolidBrush(Color.FromArgb(0, 182, 248)), RoundRect(Inner, 2))
  786.  
  787.         If Checked Then
  788.             Dim t As New Font("Marlett", 10, FontStyle.Regular)
  789.             G.DrawString("a", t, New SolidBrush(Color.FromArgb(222, 222, 222)), -1.5, 0)
  790.             ' G.FillPath(New SolidBrush(Color.FromArgb(0, 182, 248)), RoundRect(Inner, 3))
  791.             'G.DrawRectangle(New Pen(Color.FromArgb(0, 182, 248)), Inner)
  792.  
  793.         End If
  794.  
  795.         Dim drawFont As New Font("Verdana", 8, FontStyle.Regular)
  796.         Dim nb As Brush = New SolidBrush(Color.FromArgb(68, 76, 99))
  797.         G.DrawString(Text, drawFont, nb, New Point(18, 7), New StringFormat With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Center})
  798.  
  799.         e.Graphics.DrawImage(B.Clone(), 0, 0)
  800.         G.Dispose() : B.Dispose()
  801.  
  802.     End Sub
  803.  
  804. End Class
  805. Class QubeTabControl
  806.  
  807.     '----------------------------
  808.     'AviraTabControl
  809.     'Creator: Temploit
  810.     'Version: 1.1
  811.     'Created: 3rd of May / ~1.5hr
  812.     '----------------------------
  813.  
  814.     Inherits TabControl
  815.  
  816.     Private BC As Color = Color.FromArgb(68, 76, 99)
  817.     Private UTC As Brush = New SolidBrush(Color.FromArgb(125, 146, 166))
  818.     Private STC As Brush = Brushes.White
  819.  
  820.     Private BCB As SolidBrush = New SolidBrush(BC)
  821.     Private BCP As Pen = New Pen(BC)
  822.     Private TR, InR, LR, ImR As Rectangle
  823.     Private SF As StringFormat = New StringFormat With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Center}
  824.     Private ICounter As Integer = 0
  825.  
  826.     Sub New()
  827.         SetStyle(ControlStyles.UserPaint Or ControlStyles.Opaque Or ControlStyles.ResizeRedraw Or ControlStyles.AllPaintingInWmPaint Or ControlStyles.Opaque, True)
  828.         SetStyle(ControlStyles.Selectable, False)
  829.         SizeMode = TabSizeMode.Fixed
  830.         Alignment = TabAlignment.Left
  831.         ItemSize = New Size(35, 93)
  832.         DrawMode = TabDrawMode.OwnerDrawFixed
  833.         Font = New Font("Verdana", 8)
  834.     End Sub
  835.  
  836.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  837.         MyBase.OnPaint(e)
  838.         Dim g As Graphics = e.Graphics
  839.  
  840.         If Not SelectedIndex = Nothing AndAlso Not SelectedIndex = -1 AndAlso Not SelectedIndex > TabPages.Count - 1 AndAlso Not TabPages(SelectedIndex).BackColor = Color.Transparent Then
  841.             g.Clear(TabPages(SelectedIndex).BackColor)
  842.         Else
  843.             g.Clear(Color.White)
  844.         End If
  845.         ICounter = 0
  846.         LR = New Rectangle(0, 0, ItemSize.Height + 3, Height)
  847.         g.FillRectangle(BCB, LR)
  848.         g.DrawRectangle(BCP, LR)
  849.  
  850.         g.SmoothingMode = SmoothingMode.AntiAlias
  851.         For i = 0 To TabCount - 1
  852.             TR = GetTabRect(i)
  853.             TR = New Rectangle(TR.X, TR.Y, TR.Width - 1, TR.Height)
  854.             If TabPages(i).Tag IsNot Nothing AndAlso TabPages(i).Tag IsNot String.Empty Then
  855.                 InR = New Rectangle(TR.X + 10, TR.Y, TR.Width - 10, TR.Height)
  856.                 ICounter += 1
  857.             Else
  858.                 If i = SelectedIndex Then
  859.                     InR = New Rectangle(TR.X + 36, TR.Y, TR.Width - 36, TR.Height)
  860.  
  861.                     g.DrawString(TabPages(i).Text, Font, STC, InR, SF)
  862.  
  863.                     If SelectedImageList IsNot Nothing AndAlso SelectedImageList.Images.Count > i - ICounter AndAlso SelectedImageList.Images(i - ICounter) IsNot Nothing Then
  864.                         ImR = New Rectangle(TR.X + 13, TR.Y + ((TR.Height / 2) - 8), 16, 16)
  865.                         g.DrawImage(SelectedImageList.Images(i - ICounter), ImR)
  866.                     End If
  867.  
  868.                 Else
  869.                     InR = New Rectangle(TR.X + 36, TR.Y, TR.Width - 36, TR.Height)
  870.                     g.DrawString(TabPages(i).Text, Font, UTC, InR, SF)
  871.  
  872.                     If UnselectedImageList IsNot Nothing AndAlso UnselectedImageList.Images.Count > i - ICounter AndAlso UnselectedImageList.Images(i - ICounter) IsNot Nothing Then
  873.                         ImR = New Rectangle(TR.X + 13, TR.Y + ((TR.Height / 2) - 8), 16, 16)
  874.                         g.DrawImage(UnselectedImageList.Images(i - ICounter), ImR)
  875.                     End If
  876.  
  877.                 End If
  878.             End If
  879.         Next
  880.  
  881.  
  882.         g.Dispose()
  883.  
  884.     End Sub
  885.  
  886.     Private UnselectedImageList As ImageList
  887.     Public Property ImageList_Unselected As ImageList
  888.         Get
  889.             Return UnselectedImageList
  890.         End Get
  891.         Set(value As ImageList)
  892.             UnselectedImageList = value
  893.             If UnselectedImageList IsNot Nothing AndAlso Not UnselectedImageList.ImageSize = New Size(16, 16) Then
  894.                 UnselectedImageList.ImageSize = New Size(16, 16)
  895.             End If
  896.             Invalidate()
  897.         End Set
  898.     End Property
  899.  
  900.     Private SelectedImageList As ImageList
  901.     Public Property ImageList_Selected As ImageList
  902.         Get
  903.             Return SelectedImageList
  904.         End Get
  905.         Set(value As ImageList)
  906.             SelectedImageList = value
  907.             If SelectedImageList IsNot Nothing AndAlso Not SelectedImageList.ImageSize = New Size(16, 16) Then
  908.                 SelectedImageList.ImageSize = New Size(16, 16)
  909.             End If
  910.             Invalidate()
  911.         End Set
  912.     End Property
  913.  
  914.     Protected Overrides Sub OnSelecting(e As TabControlCancelEventArgs)
  915.         MyBase.OnSelecting(e)
  916.         If e.TabPage IsNot Nothing AndAlso e.TabPage.Tag IsNot Nothing AndAlso e.TabPage.Tag IsNot String.Empty AndAlso Not DesignMode Then
  917.             e.Cancel = True
  918.         End If
  919.     End Sub
  920.  
  921. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement