Advertisement
Guest User

VibeLander Theme - By UnReLaTeD

a guest
Oct 26th, 2012
2,226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Imports System.Drawing.Drawing2D
  2. Imports System.ComponentModel
  3. Imports System.Runtime.InteropServices
  4. '.::Tweety Theme::.
  5. 'Author:   UnReLaTeDScript
  6. 'Credits:  Aeonhack [Themebase]
  7. 'Version:  1.0
  8. MustInherit Class Theme
  9.     Inherits ContainerControl
  10.  
  11. #Region " Initialization "
  12.  
  13.     Protected G As Graphics
  14.     Sub New()
  15.         SetStyle(DirectCast(139270, ControlStyles), True)
  16.     End Sub
  17.  
  18.     Private ParentIsForm As Boolean
  19.     Protected Overrides Sub OnHandleCreated(ByVal e As EventArgs)
  20.         Dock = DockStyle.Fill
  21.         ParentIsForm = TypeOf Parent Is Form
  22.         If ParentIsForm Then
  23.             If Not _TransparencyKey = Color.Empty Then ParentForm.TransparencyKey = _TransparencyKey
  24.             ParentForm.FormBorderStyle = FormBorderStyle.None
  25.         End If
  26.         MyBase.OnHandleCreated(e)
  27.     End Sub
  28.  
  29.     Overrides Property Text() As String
  30.         Get
  31.             Return MyBase.Text
  32.         End Get
  33.         Set(ByVal v As String)
  34.             MyBase.Text = v
  35.             Invalidate()
  36.         End Set
  37.     End Property
  38. #End Region
  39.  
  40. #Region " Sizing and Movement "
  41.  
  42.     Private _Resizable As Boolean = True
  43.     Property Resizable() As Boolean
  44.         Get
  45.             Return _Resizable
  46.         End Get
  47.         Set(ByVal value As Boolean)
  48.             _Resizable = value
  49.         End Set
  50.     End Property
  51.  
  52.     Private _MoveHeight As Integer = 24
  53.     Property MoveHeight() As Integer
  54.         Get
  55.             Return _MoveHeight
  56.         End Get
  57.         Set(ByVal v As Integer)
  58.             _MoveHeight = v
  59.             Header = New Rectangle(7, 7, Width - 14, _MoveHeight - 7)
  60.         End Set
  61.     End Property
  62.  
  63.     Private Flag As IntPtr
  64.     Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  65.         If Not e.Button = MouseButtons.Left Then Return
  66.         If ParentIsForm Then If ParentForm.WindowState = FormWindowState.Maximized Then Return
  67.  
  68.         If Header.Contains(e.Location) Then
  69.             Flag = New IntPtr(2)
  70.         ElseIf Current.Position = 0 Or Not _Resizable Then
  71.             Return
  72.         Else
  73.             Flag = New IntPtr(Current.Position)
  74.         End If
  75.  
  76.         Capture = False
  77.         DefWndProc(Message.Create(Parent.Handle, 161, Flag, Nothing))
  78.  
  79.         MyBase.OnMouseDown(e)
  80.     End Sub
  81.  
  82.     Private Structure Pointer
  83.         ReadOnly Cursor As Cursor, Position As Byte
  84.         Sub New(ByVal c As Cursor, ByVal p As Byte)
  85.             Cursor = c
  86.             Position = p
  87.         End Sub
  88.     End Structure
  89.  
  90.     Private F1, F2, F3, F4 As Boolean, PTC As Point
  91.     Private Function GetPointer() As Pointer
  92.         PTC = PointToClient(MousePosition)
  93.         F1 = PTC.X < 7
  94.         F2 = PTC.X > Width - 7
  95.         F3 = PTC.Y < 7
  96.         F4 = PTC.Y > Height - 7
  97.  
  98.         If F1 And F3 Then Return New Pointer(Cursors.SizeNWSE, 13)
  99.         If F1 And F4 Then Return New Pointer(Cursors.SizeNESW, 16)
  100.         If F2 And F3 Then Return New Pointer(Cursors.SizeNESW, 14)
  101.         If F2 And F4 Then Return New Pointer(Cursors.SizeNWSE, 17)
  102.         If F1 Then Return New Pointer(Cursors.SizeWE, 10)
  103.         If F2 Then Return New Pointer(Cursors.SizeWE, 11)
  104.         If F3 Then Return New Pointer(Cursors.SizeNS, 12)
  105.         If F4 Then Return New Pointer(Cursors.SizeNS, 15)
  106.         Return New Pointer(Cursors.Default, 0)
  107.     End Function
  108.  
  109.     Private Current, Pending As Pointer
  110.     Private Sub SetCurrent()
  111.         Pending = GetPointer()
  112.         If Current.Position = Pending.Position Then Return
  113.         Current = GetPointer()
  114.         Cursor = Current.Cursor
  115.     End Sub
  116.  
  117.     Protected Overrides Sub OnMouseMove(ByVal e As MouseEventArgs)
  118.         If _Resizable Then SetCurrent()
  119.         MyBase.OnMouseMove(e)
  120.     End Sub
  121.  
  122.     Protected Header As Rectangle
  123.     Protected Overrides Sub OnSizeChanged(ByVal e As EventArgs)
  124.         If Width = 0 OrElse Height = 0 Then Return
  125.         Header = New Rectangle(7, 7, Width - 14, _MoveHeight - 7)
  126.         Invalidate()
  127.         MyBase.OnSizeChanged(e)
  128.     End Sub
  129.  
  130. #End Region
  131.  
  132. #Region " Convienence "
  133.  
  134.     MustOverride Sub PaintHook()
  135.     Protected NotOverridable Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  136.         If Width = 0 OrElse Height = 0 Then Return
  137.         G = e.Graphics
  138.         PaintHook()
  139.     End Sub
  140.  
  141.     Private _TransparencyKey As Color
  142.     Property TransparencyKey() As Color
  143.         Get
  144.             Return _TransparencyKey
  145.         End Get
  146.         Set(ByVal v As Color)
  147.             _TransparencyKey = v
  148.             Invalidate()
  149.         End Set
  150.     End Property
  151.  
  152.     Private _Image As Image
  153.     Property Image() As Image
  154.         Get
  155.             Return _Image
  156.         End Get
  157.         Set(ByVal value As Image)
  158.             _Image = value
  159.             Invalidate()
  160.         End Set
  161.     End Property
  162.     ReadOnly Property ImageWidth() As Integer
  163.         Get
  164.             If _Image Is Nothing Then Return 0
  165.             Return _Image.Width
  166.         End Get
  167.     End Property
  168.  
  169.     Private _Size As Size
  170.     Private _Rectangle As Rectangle
  171.     Private _Gradient As LinearGradientBrush
  172.     Private _Brush As SolidBrush
  173.  
  174.     Protected Sub DrawCorners(ByVal c As Color, ByVal rect As Rectangle)
  175.         _Brush = New SolidBrush(c)
  176.         G.FillRectangle(_Brush, rect.X, rect.Y, 1, 1)
  177.         G.FillRectangle(_Brush, rect.X + (rect.Width - 1), rect.Y, 1, 1)
  178.         G.FillRectangle(_Brush, rect.X, rect.Y + (rect.Height - 1), 1, 1)
  179.         G.FillRectangle(_Brush, rect.X + (rect.Width - 1), rect.Y + (rect.Height - 1), 1, 1)
  180.     End Sub
  181.  
  182.     Protected Sub DrawBorders(ByVal p1 As Pen, ByVal p2 As Pen, ByVal rect As Rectangle)
  183.         G.DrawRectangle(p1, rect.X, rect.Y, rect.Width - 1, rect.Height - 1)
  184.         G.DrawRectangle(p2, rect.X + 1, rect.Y + 1, rect.Width - 3, rect.Height - 3)
  185.     End Sub
  186.  
  187.     Protected Sub DrawText(ByVal a As HorizontalAlignment, ByVal c As Color, ByVal x As Integer)
  188.         DrawText(a, c, x, 0)
  189.     End Sub
  190.     Protected Sub DrawText(ByVal a As HorizontalAlignment, ByVal c As Color, ByVal x As Integer, ByVal y As Integer)
  191.         If String.IsNullOrEmpty(Text) Then Return
  192.         _Size = G.MeasureString(Text, Font).ToSize
  193.         _Brush = New SolidBrush(c)
  194.  
  195.         Select Case a
  196.             Case HorizontalAlignment.Left
  197.                 G.DrawString(Text, Font, _Brush, x, _MoveHeight \ 2 - _Size.Height \ 2 + y)
  198.             Case HorizontalAlignment.Right
  199.                 G.DrawString(Text, Font, _Brush, Width - _Size.Width - x, _MoveHeight \ 2 - _Size.Height \ 2 + y)
  200.             Case HorizontalAlignment.Center
  201.                 G.DrawString(Text, Font, _Brush, Width \ 2 - _Size.Width \ 2 + x, _MoveHeight \ 2 - _Size.Height \ 2 + y)
  202.         End Select
  203.     End Sub
  204.  
  205.     Protected Sub DrawIcon(ByVal a As HorizontalAlignment, ByVal x As Integer)
  206.         DrawIcon(a, x, 0)
  207.     End Sub
  208.     Protected Sub DrawIcon(ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
  209.         If _Image Is Nothing Then Return
  210.         Select Case a
  211.             Case HorizontalAlignment.Left
  212.                 G.DrawImage(_Image, x, _MoveHeight \ 2 - _Image.Height \ 2 + y)
  213.             Case HorizontalAlignment.Right
  214.                 G.DrawImage(_Image, Width - _Image.Width - x, _MoveHeight \ 2 - _Image.Height \ 2 + y)
  215.             Case HorizontalAlignment.Center
  216.                 G.DrawImage(_Image, Width \ 2 - _Image.Width \ 2, _MoveHeight \ 2 - _Image.Height \ 2)
  217.         End Select
  218.     End Sub
  219.  
  220.     Protected Sub DrawGradient(ByVal c1 As Color, ByVal c2 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal angle As Single)
  221.         _Rectangle = New Rectangle(x, y, width, height)
  222.         _Gradient = New LinearGradientBrush(_Rectangle, c1, c2, angle)
  223.         G.FillRectangle(_Gradient, _Rectangle)
  224.     End Sub
  225.  
  226. #End Region
  227.  
  228. End Class
  229. Module Draw
  230.     Public Function RoundRect(ByVal Rectangle As Rectangle, ByVal Curve As Integer) As GraphicsPath
  231.         Dim P As GraphicsPath = New GraphicsPath()
  232.         Dim ArcRectangleWidth As Integer = Curve * 2
  233.         P.AddArc(New Rectangle(Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -180, 90)
  234.         P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -90, 90)
  235.         P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 0, 90)
  236.         P.AddArc(New Rectangle(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 90, 90)
  237.         P.AddLine(New Point(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y), New Point(Rectangle.X, Curve + Rectangle.Y))
  238.         Return P
  239.     End Function
  240.     '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
  241.    '    Dim Rectangle As Rectangle = New Rectangle(X, Y, Width, Height)
  242.    '    Dim P As GraphicsPath = New GraphicsPath()
  243.    '    Dim ArcRectangleWidth As Integer = Curve * 2
  244.    '    P.AddArc(New Rectangle(Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -180, 90)
  245.    '    P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -90, 90)
  246.    '    P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 0, 90)
  247.    '    P.AddArc(New Rectangle(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 90, 90)
  248.    '    P.AddLine(New Point(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y), New Point(Rectangle.X, Curve + Rectangle.Y))
  249.    '    Return P
  250.    'End Function
  251. End Module
  252. MustInherit Class ThemeControl
  253.     Inherits Control
  254.  
  255. #Region " Initialization "
  256.  
  257.     Protected G As Graphics, B As Bitmap
  258.     Sub New()
  259.         SetStyle(DirectCast(139270, ControlStyles), True)
  260.         B = New Bitmap(1, 1)
  261.         G = Graphics.FromImage(B)
  262.     End Sub
  263.  
  264.     Sub AllowTransparent()
  265.         SetStyle(ControlStyles.Opaque, False)
  266.         SetStyle(ControlStyles.SupportsTransparentBackColor, True)
  267.     End Sub
  268.  
  269.     Overrides Property Text() As String
  270.         Get
  271.             Return MyBase.Text
  272.         End Get
  273.         Set(ByVal v As String)
  274.             MyBase.Text = v
  275.             Invalidate()
  276.         End Set
  277.     End Property
  278. #End Region
  279.  
  280. #Region " Mouse Handling "
  281.  
  282.     Protected Enum State As Byte
  283.         MouseNone = 0
  284.         MouseOver = 1
  285.         MouseDown = 2
  286.     End Enum
  287.  
  288.     Protected MouseState As State
  289.     Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
  290.         ChangeMouseState(State.MouseNone)
  291.         MyBase.OnMouseLeave(e)
  292.     End Sub
  293.     Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
  294.         ChangeMouseState(State.MouseOver)
  295.         MyBase.OnMouseEnter(e)
  296.     End Sub
  297.     Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  298.         ChangeMouseState(State.MouseOver)
  299.         MyBase.OnMouseUp(e)
  300.     End Sub
  301.     Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  302.         If e.Button = MouseButtons.Left Then ChangeMouseState(State.MouseDown)
  303.         MyBase.OnMouseDown(e)
  304.     End Sub
  305.  
  306.     Private Sub ChangeMouseState(ByVal e As State)
  307.         MouseState = e
  308.         Invalidate()
  309.     End Sub
  310.  
  311. #End Region
  312.  
  313. #Region " Convienence "
  314.  
  315.     MustOverride Sub PaintHook()
  316.     Protected NotOverridable Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  317.         If Width = 0 OrElse Height = 0 Then Return
  318.         PaintHook()
  319.         e.Graphics.DrawImage(B, 0, 0)
  320.     End Sub
  321.  
  322.     Protected Overrides Sub OnSizeChanged(ByVal e As EventArgs)
  323.         If Not Width = 0 AndAlso Not Height = 0 Then
  324.             B = New Bitmap(Width, Height)
  325.             G = Graphics.FromImage(B)
  326.             Invalidate()
  327.         End If
  328.         MyBase.OnSizeChanged(e)
  329.     End Sub
  330.  
  331.     Private _NoRounding As Boolean
  332.     Property NoRounding() As Boolean
  333.         Get
  334.             Return _NoRounding
  335.         End Get
  336.         Set(ByVal v As Boolean)
  337.             _NoRounding = v
  338.             Invalidate()
  339.         End Set
  340.     End Property
  341.  
  342.     Private _Image As Image
  343.     Property Image() As Image
  344.         Get
  345.             Return _Image
  346.         End Get
  347.         Set(ByVal value As Image)
  348.             _Image = value
  349.             Invalidate()
  350.         End Set
  351.     End Property
  352.     ReadOnly Property ImageWidth() As Integer
  353.         Get
  354.             If _Image Is Nothing Then Return 0
  355.             Return _Image.Width
  356.         End Get
  357.     End Property
  358.     ReadOnly Property ImageTop() As Integer
  359.         Get
  360.             If _Image Is Nothing Then Return 0
  361.             Return Height \ 2 - _Image.Height \ 2
  362.         End Get
  363.     End Property
  364.  
  365.     Private _Size As Size
  366.     Private _Rectangle As Rectangle
  367.     Private _Gradient As LinearGradientBrush
  368.     Private _Brush As SolidBrush
  369.  
  370.     Protected Sub DrawCorners(ByVal c As Color, ByVal rect As Rectangle)
  371.         If _NoRounding Then Return
  372.  
  373.         B.SetPixel(rect.X, rect.Y, c)
  374.         B.SetPixel(rect.X + (rect.Width - 1), rect.Y, c)
  375.         B.SetPixel(rect.X, rect.Y + (rect.Height - 1), c)
  376.         B.SetPixel(rect.X + (rect.Width - 1), rect.Y + (rect.Height - 1), c)
  377.     End Sub
  378.  
  379.     Protected Sub DrawBorders(ByVal p1 As Pen, ByVal p2 As Pen, ByVal rect As Rectangle)
  380.         G.DrawRectangle(p1, rect.X, rect.Y, rect.Width - 1, rect.Height - 1)
  381.         G.DrawRectangle(p2, rect.X + 1, rect.Y + 1, rect.Width - 3, rect.Height - 3)
  382.     End Sub
  383.  
  384.     Protected Sub DrawText(ByVal a As HorizontalAlignment, ByVal c As Color, ByVal x As Integer)
  385.         DrawText(a, c, x, 0)
  386.     End Sub
  387.     Protected Sub DrawText(ByVal a As HorizontalAlignment, ByVal c As Color, ByVal x As Integer, ByVal y As Integer)
  388.         If String.IsNullOrEmpty(Text) Then Return
  389.         _Size = G.MeasureString(Text, Font).ToSize
  390.         _Brush = New SolidBrush(c)
  391.  
  392.         Select Case a
  393.             Case HorizontalAlignment.Left
  394.                 G.DrawString(Text, Font, _Brush, x, Height \ 2 - _Size.Height \ 2 + y)
  395.             Case HorizontalAlignment.Right
  396.                 G.DrawString(Text, Font, _Brush, Width - _Size.Width - x, Height \ 2 - _Size.Height \ 2 + y)
  397.             Case HorizontalAlignment.Center
  398.                 G.DrawString(Text, Font, _Brush, Width \ 2 - _Size.Width \ 2 + x, Height \ 2 - _Size.Height \ 2 + y)
  399.         End Select
  400.     End Sub
  401.  
  402.     Protected Sub DrawIcon(ByVal a As HorizontalAlignment, ByVal x As Integer)
  403.         DrawIcon(a, x, 0)
  404.     End Sub
  405.     Protected Sub DrawIcon(ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
  406.         If _Image Is Nothing Then Return
  407.         Select Case a
  408.             Case HorizontalAlignment.Left
  409.                 G.DrawImage(_Image, x, Height \ 2 - _Image.Height \ 2 + y)
  410.             Case HorizontalAlignment.Right
  411.                 G.DrawImage(_Image, Width - _Image.Width - x, Height \ 2 - _Image.Height \ 2 + y)
  412.             Case HorizontalAlignment.Center
  413.                 G.DrawImage(_Image, Width \ 2 - _Image.Width \ 2, Height \ 2 - _Image.Height \ 2)
  414.         End Select
  415.     End Sub
  416.  
  417.     Protected Sub DrawGradient(ByVal c1 As Color, ByVal c2 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal angle As Single)
  418.         _Rectangle = New Rectangle(x, y, width, height)
  419.         _Gradient = New LinearGradientBrush(_Rectangle, c1, c2, angle)
  420.         G.FillRectangle(_Gradient, _Rectangle)
  421.     End Sub
  422. #End Region
  423.  
  424. End Class
  425. MustInherit Class ThemeContainerControl
  426.     Inherits ContainerControl
  427.  
  428. #Region " Initialization "
  429.  
  430.     Protected G As Graphics, B As Bitmap
  431.     Sub New()
  432.         SetStyle(DirectCast(139270, ControlStyles), True)
  433.         B = New Bitmap(1, 1)
  434.         G = Graphics.FromImage(B)
  435.     End Sub
  436.  
  437.     Sub AllowTransparent()
  438.         SetStyle(ControlStyles.Opaque, False)
  439.         SetStyle(ControlStyles.SupportsTransparentBackColor, True)
  440.     End Sub
  441.  
  442. #End Region
  443. #Region " Convienence "
  444.  
  445.     MustOverride Sub PaintHook()
  446.     Protected NotOverridable Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  447.         If Width = 0 OrElse Height = 0 Then Return
  448.         PaintHook()
  449.         e.Graphics.DrawImage(B, 0, 0)
  450.     End Sub
  451.  
  452.     Protected Overrides Sub OnSizeChanged(ByVal e As EventArgs)
  453.         If Not Width = 0 AndAlso Not Height = 0 Then
  454.             B = New Bitmap(Width, Height)
  455.             G = Graphics.FromImage(B)
  456.             Invalidate()
  457.         End If
  458.         MyBase.OnSizeChanged(e)
  459.     End Sub
  460.  
  461.     Private _NoRounding As Boolean
  462.     Property NoRounding() As Boolean
  463.         Get
  464.             Return _NoRounding
  465.         End Get
  466.         Set(ByVal v As Boolean)
  467.             _NoRounding = v
  468.             Invalidate()
  469.         End Set
  470.     End Property
  471.  
  472.     Private _Rectangle As Rectangle
  473.     Private _Gradient As LinearGradientBrush
  474.  
  475.     Protected Sub DrawCorners(ByVal c As Color, ByVal rect As Rectangle)
  476.         If _NoRounding Then Return
  477.         B.SetPixel(rect.X, rect.Y, c)
  478.         B.SetPixel(rect.X + (rect.Width - 1), rect.Y, c)
  479.         B.SetPixel(rect.X, rect.Y + (rect.Height - 1), c)
  480.         B.SetPixel(rect.X + (rect.Width - 1), rect.Y + (rect.Height - 1), c)
  481.     End Sub
  482.  
  483.     Protected Sub DrawBorders(ByVal p1 As Pen, ByVal p2 As Pen, ByVal rect As Rectangle)
  484.         G.DrawRectangle(p1, rect.X, rect.Y, rect.Width - 1, rect.Height - 1)
  485.         G.DrawRectangle(p2, rect.X + 1, rect.Y + 1, rect.Width - 3, rect.Height - 3)
  486.     End Sub
  487.  
  488.     Protected Sub DrawGradient(ByVal c1 As Color, ByVal c2 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal angle As Single)
  489.         _Rectangle = New Rectangle(x, y, width, height)
  490.         _Gradient = New LinearGradientBrush(_Rectangle, c1, c2, angle)
  491.         G.FillRectangle(_Gradient, _Rectangle)
  492.     End Sub
  493. #End Region
  494.  
  495. End Class
  496.  
  497. Class TxtBox
  498.     Inherits ThemeControl
  499.     Dim WithEvents txtbox As New TextBox
  500. #Region "lol"
  501.     Private _passmask As Boolean = False
  502.     Public Shadows Property UseSystemPasswordChar() As Boolean
  503.         Get
  504.             Return _passmask
  505.         End Get
  506.         Set(ByVal v As Boolean)
  507.             txtbox.UseSystemPasswordChar = UseSystemPasswordChar
  508.             _passmask = v
  509.             Invalidate()
  510.         End Set
  511.     End Property
  512.     Private _maxchars As Integer = 32767
  513.     Public Shadows Property MaxLength() As Integer
  514.         Get
  515.             Return _maxchars
  516.         End Get
  517.         Set(ByVal v As Integer)
  518.             _maxchars = v
  519.             txtbox.MaxLength = MaxLength
  520.             Invalidate()
  521.         End Set
  522.     End Property
  523.     Private _align As HorizontalAlignment
  524.     Public Shadows Property TextAlignment() As HorizontalAlignment
  525.         Get
  526.             Return _align
  527.         End Get
  528.         Set(ByVal v As HorizontalAlignment)
  529.             _align = v
  530.             Invalidate()
  531.         End Set
  532.     End Property
  533.  
  534.     Protected Overrides Sub OnPaintBackground(ByVal pevent As System.Windows.Forms.PaintEventArgs)
  535.     End Sub
  536.     Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
  537.         MyBase.OnTextChanged(e)
  538.         Invalidate()
  539.     End Sub
  540.     Protected Overrides Sub OnBackColorChanged(ByVal e As System.EventArgs)
  541.         MyBase.OnBackColorChanged(e)
  542.         txtbox.BackColor = BackColor
  543.         Invalidate()
  544.     End Sub
  545.     Protected Overrides Sub OnForeColorChanged(ByVal e As System.EventArgs)
  546.         MyBase.OnForeColorChanged(e)
  547.         txtbox.ForeColor = ForeColor
  548.         Invalidate()
  549.     End Sub
  550.     Protected Overrides Sub OnFontChanged(ByVal e As System.EventArgs)
  551.         MyBase.OnFontChanged(e)
  552.         txtbox.Font = Font
  553.     End Sub
  554.     Protected Overrides Sub OnGotFocus(ByVal e As System.EventArgs)
  555.         MyBase.OnGotFocus(e)
  556.         txtbox.Focus()
  557.     End Sub
  558.     Sub TextChngTxtBox() Handles txtbox.TextChanged
  559.         Text = txtbox.Text
  560.     End Sub
  561.     Sub TextChng() Handles MyBase.TextChanged
  562.         txtbox.Text = Text
  563.     End Sub
  564.  
  565. #End Region
  566.  
  567.     Protected Overrides Sub WndProc(ByRef m As Message)
  568.         Select Case m.Msg
  569.             Case 15
  570.                 Invalidate()
  571.                 MyBase.WndProc(m)
  572.                 Me.PaintHook()
  573.                 Exit Select
  574.             Case Else
  575.                 MyBase.WndProc(m)
  576.                 Exit Select
  577.         End Select
  578.     End Sub
  579.  
  580.     Sub New()
  581.         MyBase.New()
  582.  
  583.         Controls.Add(txtbox)
  584.         With txtbox
  585.             .Multiline = False
  586.             .BackColor = Color.FromArgb(0, 0, 0)
  587.             .ForeColor = ForeColor
  588.             .Text = String.Empty
  589.             .TextAlign = HorizontalAlignment.Center
  590.             .BorderStyle = BorderStyle.None
  591.             .Location = New Point(5, 8)
  592.             .Font = New Font("Arial", 8.25F, FontStyle.Bold)
  593.             .Size = New Size(Width - 8, Height - 11)
  594.             .UseSystemPasswordChar = UseSystemPasswordChar
  595.         End With
  596.  
  597.         Text = ""
  598.  
  599.         DoubleBuffered = True
  600.     End Sub
  601.  
  602.     Overrides Sub PaintHook()
  603.         Me.BackColor = Color.White
  604.         G.Clear(Parent.BackColor)
  605.         Dim p As New Pen(Color.FromArgb(204, 204, 204), 1)
  606.         Dim o As New Pen(Color.FromArgb(249, 249, 249), 8)
  607.         G.FillPath(Brushes.White, Draw.RoundRect(New Rectangle(0, 0, Width - 1, Height - 1), 2))
  608.         G.DrawPath(o, Draw.RoundRect(New Rectangle(0, 0, Width - 1, Height - 1), 2))
  609.         G.DrawPath(p, Draw.RoundRect(New Rectangle(0, 0, Width - 1, Height - 1), 2))
  610.         Height = txtbox.Height + 16
  611.         Dim drawFont As New Font("Tahoma", 9, FontStyle.Regular)
  612.         With txtbox
  613.             .Width = Width - 12
  614.             .ForeColor = Color.FromArgb(72, 72, 72)
  615.             .Font = drawFont
  616.             .TextAlign = TextAlignment
  617.             .UseSystemPasswordChar = UseSystemPasswordChar
  618.         End With
  619.         DrawCorners(Parent.BackColor, ClientRectangle)
  620.     End Sub
  621. End Class
  622.  
  623. Class PanelBox
  624.     Inherits ThemeContainerControl
  625.     Private _Checked As Boolean
  626.     Sub New()
  627.         AllowTransparent()
  628.     End Sub
  629.     Overrides Sub PaintHook()
  630.         Me.Font = New Font("Tahoma", 10)
  631.         Me.ForeColor = Color.FromArgb(40, 40, 40)
  632.         G.SmoothingMode = SmoothingMode.AntiAlias
  633.         G.FillRectangle(New SolidBrush(Color.FromArgb(235, 235, 235)), New Rectangle(2, 0, Width, Height))
  634.         G.FillRectangle(New SolidBrush(Color.FromArgb(249, 249, 249)), New Rectangle(1, 0, Width - 3, Height - 4))
  635.         G.DrawRectangle(New Pen(Color.FromArgb(214, 214, 214)), 0, 0, Width - 2, Height - 3)
  636.     End Sub
  637. End Class
  638. Class GroupDropBox
  639.     Inherits ThemeContainerControl
  640.     Private _Checked As Boolean
  641.     Private X As Integer
  642.     Private y As Integer
  643.     Private _OpenedSize As Size
  644.  
  645.     Public Property Checked As Boolean
  646.         Get
  647.             Return _Checked
  648.         End Get
  649.         Set(ByVal V As Boolean)
  650.             _Checked = V
  651.             Invalidate()
  652.         End Set
  653.     End Property
  654.     Public Property OpenSize As Size
  655.         Get
  656.             Return _OpenedSize
  657.         End Get
  658.         Set(ByVal V As Size)
  659.             _OpenedSize = V
  660.             Invalidate()
  661.         End Set
  662.     End Property
  663.     Sub New()
  664.         AllowTransparent()
  665.         Size = New Size(90, 30)
  666.         MinimumSize = New Size(5, 30)
  667.         _Checked = True
  668.     End Sub
  669.     Overrides Sub PaintHook()
  670.         Me.Font = New Font("Tahoma", 10)
  671.         Me.ForeColor = Color.FromArgb(40, 40, 40)
  672.         If _Checked = True Then
  673.             G.SmoothingMode = SmoothingMode.AntiAlias
  674.             G.Clear(Color.FromArgb(245, 245, 245))
  675.             G.FillRectangle(New SolidBrush(Color.FromArgb(231, 231, 231)), New Rectangle(0, 0, Width, 30))
  676.             G.DrawLine(New Pen(Color.FromArgb(233, 238, 240)), 1, 1, Width - 2, 1)
  677.             G.DrawRectangle(New Pen(Color.FromArgb(214, 214, 214)), 0, 0, Width - 1, Height - 1)
  678.             G.DrawRectangle(New Pen(Color.FromArgb(214, 214, 214)), 0, 0, Width - 1, 30)
  679.             Me.Size = _OpenedSize
  680.             G.DrawString("t", New Font("Marlett", 12), New SolidBrush(Me.ForeColor), Width - 25, 5)
  681.         Else
  682.             G.SmoothingMode = SmoothingMode.AntiAlias
  683.             G.Clear(Color.FromArgb(245, 245, 245))
  684.             G.FillRectangle(New SolidBrush(Color.FromArgb(231, 231, 231)), New Rectangle(0, 0, Width, 30))
  685.             G.DrawLine(New Pen(Color.FromArgb(231, 236, 238)), 1, 1, Width - 2, 1)
  686.             G.DrawRectangle(New Pen(Color.FromArgb(214, 214, 214)), 0, 0, Width - 1, Height - 1)
  687.             G.DrawRectangle(New Pen(Color.FromArgb(214, 214, 214)), 0, 0, Width - 1, 30)
  688.             Me.Size = New Size(Width, 30)
  689.             G.DrawString("u", New Font("Marlett", 12), New SolidBrush(Me.ForeColor), Width - 25, 5)
  690.         End If
  691.         G.DrawString(Text, Font, New SolidBrush(Me.ForeColor), 7, 6)
  692.     End Sub
  693.  
  694.     Private Sub meResize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
  695.         If _Checked = True Then
  696.             _OpenedSize = Me.Size
  697.         Else
  698.         End If
  699.     End Sub
  700.  
  701.  
  702.     Protected Overrides Sub OnMouseMove(ByVal e As System.Windows.Forms.MouseEventArgs)
  703.         MyBase.OnMouseMove(e)
  704.         X = e.X
  705.         y = e.Y
  706.         Invalidate()
  707.     End Sub
  708.  
  709.     Sub changeCheck() Handles Me.MouseDown
  710.  
  711.  
  712.         If X >= Width - 22 Then
  713.             If y <= 30 Then
  714.                 Select Case Checked
  715.                     Case True
  716.                         Checked = False
  717.                     Case False
  718.                         Checked = True
  719.                 End Select
  720.             End If
  721.         End If
  722.     End Sub
  723. End Class
  724. Class GroupPanelBox
  725.     Inherits ThemeContainerControl
  726.     Private _Checked As Boolean
  727.     Sub New()
  728.         AllowTransparent()
  729.     End Sub
  730.     Overrides Sub PaintHook()
  731.         Me.Font = New Font("Tahoma", 10)
  732.         Me.ForeColor = Color.FromArgb(40, 40, 40)
  733.         G.SmoothingMode = SmoothingMode.AntiAlias
  734.         G.Clear(Color.FromArgb(245, 245, 245))
  735.         G.FillRectangle(New SolidBrush(Color.FromArgb(231, 231, 231)), New Rectangle(0, 0, Width, 30))
  736.         G.DrawLine(New Pen(Color.FromArgb(233, 238, 240)), 1, 1, Width - 2, 1)
  737.         G.DrawRectangle(New Pen(Color.FromArgb(214, 214, 214)), 0, 0, Width - 1, Height - 1)
  738.         G.DrawRectangle(New Pen(Color.FromArgb(214, 214, 214)), 0, 0, Width - 1, 30)
  739.         G.DrawString(Text, Font, New SolidBrush(Me.ForeColor), 7, 6)
  740.     End Sub
  741. End Class
  742.  
  743. Class ButtonGreen
  744.     Inherits ThemeControl
  745.     Overrides Sub PaintHook()
  746.         Me.Font = New Font("Arial", 10)
  747.         G.Clear(Me.BackColor)
  748.         G.SmoothingMode = SmoothingMode.HighQuality
  749.         Select Case MouseState
  750.             Case State.MouseNone
  751.                 Dim p As New Pen(Color.FromArgb(120, 159, 22), 1)
  752.                 Dim x As New LinearGradientBrush(ClientRectangle, Color.FromArgb(157, 209, 57), Color.FromArgb(130, 181, 18), LinearGradientMode.Vertical)
  753.                 G.FillPath(x, Draw.RoundRect(ClientRectangle, 4))
  754.                 G.DrawPath(p, Draw.RoundRect(New Rectangle(0, 0, Width - 1, Height - 1), 3))
  755.                 G.DrawLine(New Pen(Color.FromArgb(190, 232, 109)), 2, 1, Width - 3, 1)
  756.                 DrawText(HorizontalAlignment.Center, Color.FromArgb(240, 240, 240), 0)
  757.             Case State.MouseDown
  758.                 Dim p As New Pen(Color.FromArgb(120, 159, 22), 1)
  759.                 Dim x As New LinearGradientBrush(ClientRectangle, Color.FromArgb(125, 171, 25), Color.FromArgb(142, 192, 40), LinearGradientMode.Vertical)
  760.                 G.FillPath(x, Draw.RoundRect(ClientRectangle, 4))
  761.                 G.DrawPath(p, Draw.RoundRect(New Rectangle(0, 0, Width - 1, Height - 1), 3))
  762.                 G.DrawLine(New Pen(Color.FromArgb(142, 172, 30)), 2, 1, Width - 3, 1)
  763.                 DrawText(HorizontalAlignment.Center, Color.FromArgb(250, 250, 250), 1)
  764.             Case State.MouseOver
  765.                 Dim p As New Pen(Color.FromArgb(120, 159, 22), 1)
  766.                 Dim x As New LinearGradientBrush(ClientRectangle, Color.FromArgb(165, 220, 59), Color.FromArgb(137, 191, 18), LinearGradientMode.Vertical)
  767.                 G.FillPath(x, Draw.RoundRect(ClientRectangle, 4))
  768.                 G.DrawPath(p, Draw.RoundRect(New Rectangle(0, 0, Width - 1, Height - 1), 3))
  769.                 G.DrawLine(New Pen(Color.FromArgb(190, 232, 109)), 2, 1, Width - 3, 1)
  770.                 DrawText(HorizontalAlignment.Center, Color.FromArgb(240, 240, 240), -1)
  771.         End Select
  772.         Me.Cursor = Cursors.Hand
  773.     End Sub
  774. End Class
  775. Class ButtonBlue
  776.     Inherits ThemeControl
  777.     Overrides Sub PaintHook()
  778.         Me.Font = New Font("Arial", 10)
  779.         G.Clear(Me.BackColor)
  780.         G.SmoothingMode = SmoothingMode.HighQuality
  781.         Select Case MouseState
  782.             Case State.MouseNone
  783.                 Dim p As New Pen(Color.FromArgb(34, 112, 171), 1)
  784.                 Dim x As New LinearGradientBrush(ClientRectangle, Color.FromArgb(51, 159, 231), Color.FromArgb(33, 128, 206), LinearGradientMode.Vertical)
  785.                 G.FillPath(x, Draw.RoundRect(ClientRectangle, 4))
  786.                 G.DrawPath(p, Draw.RoundRect(New Rectangle(0, 0, Width - 1, Height - 1), 3))
  787.                 G.DrawLine(New Pen(Color.FromArgb(131, 197, 241)), 2, 1, Width - 3, 1)
  788.                 DrawText(HorizontalAlignment.Center, Color.FromArgb(240, 240, 240), 0)
  789.             Case State.MouseDown
  790.                 Dim p As New Pen(Color.FromArgb(34, 112, 171), 1)
  791.                 Dim x As New LinearGradientBrush(ClientRectangle, Color.FromArgb(37, 124, 196), Color.FromArgb(53, 153, 219), LinearGradientMode.Vertical)
  792.                 G.FillPath(x, Draw.RoundRect(ClientRectangle, 4))
  793.                 G.DrawPath(p, Draw.RoundRect(New Rectangle(0, 0, Width - 1, Height - 1), 3))
  794.  
  795.                 DrawText(HorizontalAlignment.Center, Color.FromArgb(250, 250, 250), 1)
  796.             Case State.MouseOver
  797.                 Dim p As New Pen(Color.FromArgb(34, 112, 171), 1)
  798.                 Dim x As New LinearGradientBrush(ClientRectangle, Color.FromArgb(54, 167, 243), Color.FromArgb(35, 165, 217), LinearGradientMode.Vertical)
  799.                 G.FillPath(x, Draw.RoundRect(ClientRectangle, 4))
  800.                 G.DrawPath(p, Draw.RoundRect(New Rectangle(0, 0, Width - 1, Height - 1), 3))
  801.                 G.DrawLine(New Pen(Color.FromArgb(131, 197, 241)), 2, 1, Width - 3, 1)
  802.                 DrawText(HorizontalAlignment.Center, Color.FromArgb(240, 240, 240), -1)
  803.         End Select
  804.         Me.Cursor = Cursors.Hand
  805.     End Sub
  806. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement