Finessed

Mystic Theme

Jan 4th, 2016
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 27.97 KB | None | 0 0
  1. Imports System.Drawing
  2. Imports System.Drawing.Drawing2D
  3. Imports System.ComponentModel
  4. Imports System.Drawing.Text
  5.  
  6. ' Get more free themes at ThemesVB.NET
  7.  
  8. Enum MouseState
  9.     None = 0
  10.     Over = 1
  11.     Down = 2
  12. End Enum
  13.  
  14. Class MysticTheme
  15.     Inherits ContainerControl
  16.  
  17. #Region " Declarations "
  18.     Private _Down As Boolean = False
  19.     Private _Header As Integer = 36
  20.     Private _Point As Point
  21. #End Region
  22.  
  23. #Region " Mouse States "
  24.  
  25.     Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
  26.         MyBase.OnMouseUp(e)
  27.         _Down = False
  28.     End Sub
  29.  
  30.     Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
  31.         MyBase.OnMouseDown(e)
  32.         If e.Y < _Header AndAlso e.Button = Windows.Forms.MouseButtons.Left Then
  33.             _Point = e.Location
  34.             _Down = True
  35.         End If
  36.     End Sub
  37. ' Get more free themes at ThemesVB.NET
  38.     Protected Overrides Sub OnMouseMove(e As MouseEventArgs)
  39.         MyBase.OnMouseMove(e)
  40.         If _Down = True Then
  41.             ParentForm.Location = MousePosition - _Point
  42.         End If
  43.     End Sub
  44.  
  45. #End Region
  46.  
  47.     Protected Overrides Sub OnCreateControl()
  48.         MyBase.OnCreateControl()
  49.         ParentForm.FormBorderStyle = FormBorderStyle.None
  50.         ParentForm.TransparencyKey = Color.Fuchsia
  51.         Dock = DockStyle.Fill
  52.         Invalidate()
  53.     End Sub
  54.  
  55.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  56.         MyBase.OnPaint(e)
  57.         Dim G = e.Graphics
  58.         G.Clear(Color.FromArgb(44, 51, 62))
  59.         G.FillRectangle(New LinearGradientBrush(New Point(0, 0), New Point(0, _Header), Color.FromArgb(29, 36, 44), Color.FromArgb(22, 29, 35)), New Rectangle(0, 0, Width, _Header))
  60.  
  61.         G.FillRectangle(Brushes.Fuchsia, New Rectangle(0, 0, 1, 1))
  62.         G.FillRectangle(Brushes.Fuchsia, New Rectangle(1, 0, 1, 1))
  63.         G.FillRectangle(Brushes.Fuchsia, New Rectangle(0, 1, 1, 1))
  64.         G.FillRectangle(Brushes.Fuchsia, New Rectangle(Width - 1, 0, 1, 1))
  65.         G.FillRectangle(Brushes.Fuchsia, New Rectangle(Width - 1, 1, 1, 1))
  66.         G.FillRectangle(Brushes.Fuchsia, New Rectangle(Width - 2, 0, 1, 1))
  67.  
  68.         Dim _StringF As New StringFormat
  69.         _StringF.Alignment = StringAlignment.Center
  70.         _StringF.LineAlignment = StringAlignment.Center
  71.         G.DrawString(Text, New Font("Segoe UI", 11), New SolidBrush(Color.FromArgb(0, 206, 153)), New RectangleF(0, 0, Width, _Header), _StringF)
  72.  
  73.     End Sub
  74.  
  75. End Class
  76.  
  77. Class MysticButton
  78.     Inherits Control
  79.  
  80. #Region " Declarations "
  81.     Private _State As MouseState = MouseState.None
  82. #End Region
  83.  
  84. #Region " Mouse States "
  85.  
  86.     Protected Overrides Sub OnMouseEnter(e As EventArgs)
  87.         MyBase.OnMouseEnter(e)
  88.         _State = MouseState.Over
  89.         Invalidate()
  90.     End Sub
  91.  
  92.     Protected Overrides Sub OnMouseLeave(e As EventArgs)
  93.         MyBase.OnMouseLeave(e)
  94.         _State = MouseState.None
  95.         Invalidate()
  96.     End Sub
  97.  
  98.     Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
  99.         MyBase.OnMouseUp(e)
  100.         _State = MouseState.Over
  101.         Invalidate()
  102.     End Sub
  103.  
  104.     Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
  105.         MyBase.OnMouseDown(e)
  106.         _State = MouseState.Down
  107.         Invalidate()
  108.     End Sub
  109.  
  110. #End Region
  111.  
  112.     Sub New()
  113.         Size = New Size(100, 40)
  114.     End Sub
  115.  
  116.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  117.         MyBase.OnPaint(e)
  118.         Dim G = e.Graphics
  119.         G.Clear(Color.FromArgb(66, 219, 183))
  120.         G.FillRectangle(New LinearGradientBrush(New Point(0, 0), New Point(0, Height), Color.FromArgb(66, 219, 183), Color.FromArgb(3, 122, 95)), New Rectangle(0, 0, Width, Height))
  121.  
  122.         Select Case _State
  123.             Case MouseState.Over
  124.                 G.FillRectangle(New SolidBrush(Color.FromArgb(20, Color.White)), New Rectangle(0, 0, Width, Height))
  125.             Case MouseState.Down
  126.                 G.FillRectangle(New SolidBrush(Color.FromArgb(20, Color.Black)), New Rectangle(0, 0, Width, Height))
  127.         End Select
  128.  
  129.         G.FillRectangle(New SolidBrush(Color.FromArgb(44, 51, 62)), New Rectangle(0, 0, 1, 1))
  130.         G.FillRectangle(New SolidBrush(Color.FromArgb(44, 51, 62)), New Rectangle(1, 0, 1, 1))
  131.         G.FillRectangle(New SolidBrush(Color.FromArgb(44, 51, 62)), New Rectangle(0, 1, 1, 1))
  132.         G.FillRectangle(New SolidBrush(Color.FromArgb(44, 51, 62)), New Rectangle(Width - 1, 0, 1, 1))
  133.         G.FillRectangle(New SolidBrush(Color.FromArgb(44, 51, 62)), New Rectangle(Width - 1, 1, 1, 1))
  134.         G.FillRectangle(New SolidBrush(Color.FromArgb(44, 51, 62)), New Rectangle(Width - 2, 0, 1, 1))
  135.         G.FillRectangle(New SolidBrush(Color.FromArgb(44, 51, 62)), New Rectangle(0, Height - 1, 1, 1))
  136.         G.FillRectangle(New SolidBrush(Color.FromArgb(44, 51, 62)), New Rectangle(1, Height - 1, 1, 1))
  137.         G.FillRectangle(New SolidBrush(Color.FromArgb(44, 51, 62)), New Rectangle(0, Height - 2, 1, 1))
  138.         G.FillRectangle(New SolidBrush(Color.FromArgb(44, 51, 62)), New Rectangle(Width - 1, Height - 1, 1, 1))
  139.         G.FillRectangle(New SolidBrush(Color.FromArgb(44, 51, 62)), New Rectangle(Width - 1, Height - 2, 1, 1))
  140.         G.FillRectangle(New SolidBrush(Color.FromArgb(44, 51, 62)), New Rectangle(Width - 2, Height - 1, 1, 1))
  141.  
  142.         Dim _StringF As New StringFormat
  143.         _StringF.Alignment = StringAlignment.Center
  144.         _StringF.LineAlignment = StringAlignment.Center
  145.         G.DrawString(Text, New Font("Segoe UI", 9, FontStyle.Bold), Brushes.White, New RectangleF(0, 0, Width - 1, Height - 1), _StringF)
  146.  
  147.     End Sub
  148.  
  149. End Class
  150.  
  151. <DefaultEvent("CheckedChanged")>
  152. Class MysticRadioButton
  153.     Inherits Control
  154.  
  155. #Region " Variables "
  156.     Private _State As MouseState = MouseState.None
  157.     Private _Checked As Boolean
  158. #End Region
  159.  
  160. #Region " Properties "
  161.     Property Checked() As Boolean
  162.         Get
  163.             Return _Checked
  164.         End Get
  165.         Set(value As Boolean)
  166.             _Checked = value
  167.             InvalidateControls()
  168.             RaiseEvent CheckedChanged(Me)
  169.             Invalidate()
  170.         End Set
  171.     End Property
  172.     Event CheckedChanged(ByVal sender As Object)
  173.     Protected Overrides Sub OnClick(e As EventArgs)
  174.         If Not _Checked Then Checked = True
  175.         MyBase.OnClick(e)
  176.     End Sub
  177.     Private Sub InvalidateControls()
  178.         If Not IsHandleCreated OrElse Not _Checked Then Return
  179.         For Each C As Control In Parent.Controls
  180.             If C IsNot Me AndAlso TypeOf C Is MysticRadioButton Then
  181.                 DirectCast(C, MysticRadioButton).Checked = False
  182.                 Invalidate()
  183.             End If
  184.         Next
  185.     End Sub
  186.     Protected Overrides Sub OnCreateControl()
  187.         MyBase.OnCreateControl()
  188.         InvalidateControls()
  189.     End Sub
  190.  
  191.  
  192.     Protected Overrides Sub OnResize(e As EventArgs)
  193.         MyBase.OnResize(e)
  194.         Height = 16
  195.     End Sub
  196.  
  197. #Region " Mouse States "
  198. ' Get more free themes at ThemesVB.NET
  199.     Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
  200.         MyBase.OnMouseDown(e)
  201.         _State = MouseState.Down
  202.         If Not _Checked Then Checked = True
  203.         Invalidate()
  204.     End Sub
  205.     Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
  206.         MyBase.OnMouseUp(e)
  207.         _State = MouseState.Over
  208.         Invalidate()
  209.     End Sub
  210.     Protected Overrides Sub OnMouseEnter(e As EventArgs)
  211.         MyBase.OnMouseEnter(e)
  212.         _State = MouseState.Over
  213.         Invalidate()
  214.     End Sub
  215.     Protected Overrides Sub OnMouseLeave(e As EventArgs)
  216.         MyBase.OnMouseLeave(e)
  217.         _State = MouseState.None
  218.         Invalidate()
  219.     End Sub
  220.  
  221. #End Region
  222. #End Region
  223.  
  224.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  225.         MyBase.OnPaint(e)
  226.         Dim G = e.Graphics
  227.         G.SmoothingMode = 2
  228.         G.TextRenderingHint = 5
  229.         G.Clear(Color.FromArgb(44, 51, 62))
  230.         G.FillEllipse(New SolidBrush(Color.FromArgb(36, 39, 46)), New Rectangle(0, 0, 15, 15))
  231.         G.DrawEllipse(New Pen(Color.FromArgb(26, 29, 33)), New Rectangle(0, 0, 15, 15))
  232.         If Checked Then
  233.             G.FillEllipse(New LinearGradientBrush(New Point(3, 3), New Point(3, 12), Color.FromArgb(123, 255, 201), Color.FromArgb(41, 131, 113)), New Rectangle(3, 3, 9, 9))
  234.             G.FillEllipse(New LinearGradientBrush(New Point(4, 4), New Point(4, 11), Color.FromArgb(9, 204, 157), Color.FromArgb(41, 131, 113)), New Rectangle(4, 4, 7, 7))
  235.             G.DrawString(Text, New Font("Segoe UI", 9, FontStyle.Bold), Brushes.White, New Point(18, -1))
  236.         Else
  237.             Select Case _State
  238.                 Case MouseState.None
  239.                     G.DrawString(Text, New Font("Segoe UI", 9, FontStyle.Bold), New SolidBrush(Color.FromArgb(121, 131, 141)), New Point(18, -1))
  240.                 Case MouseState.Over
  241.                     G.DrawEllipse(New Pen(Color.FromArgb(0, 205, 155), 2), New Rectangle(1, 1, 13, 13))
  242.                     G.DrawString(Text, New Font("Segoe UI", 9, FontStyle.Bold), Brushes.White, New Point(18, -1))
  243.                 Case MouseState.Down
  244.                     G.DrawString(Text, New Font("Segoe UI", 9, FontStyle.Bold), Brushes.White, New Point(18, -1))
  245.             End Select
  246.         End If
  247.     End Sub
  248. End Class
  249.  
  250. <DefaultEvent("CheckedChanged")>
  251. Class MysticCheckBox
  252.     Inherits Control
  253.  
  254. #Region " Variables "
  255.     Private _State As MouseState = MouseState.None
  256.     Private _Checked As Boolean
  257. #End Region
  258.  
  259. #Region " Properties "
  260.     Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
  261.         MyBase.OnTextChanged(e)
  262.         Invalidate()
  263.     End Sub
  264.  
  265.     Property Checked() As Boolean
  266.         Get
  267.             Return _Checked
  268.         End Get
  269.         Set(ByVal value As Boolean)
  270.             _Checked = value
  271.             Invalidate()
  272.         End Set
  273.     End Property
  274.  
  275.     Event CheckedChanged(ByVal sender As Object)
  276.     Protected Overrides Sub OnClick(ByVal e As System.EventArgs)
  277.         _Checked = Not _Checked
  278.         RaiseEvent CheckedChanged(Me)
  279.         MyBase.OnClick(e)
  280.     End Sub
  281.  
  282.     Protected Overrides Sub OnResize(e As EventArgs)
  283.         MyBase.OnResize(e)
  284.         Height = 16
  285.     End Sub
  286.  
  287. #End Region
  288.  
  289. #Region " Mouse States "
  290.  
  291.     Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
  292.         MyBase.OnMouseDown(e)
  293.         _State = MouseState.Down
  294.         Invalidate()
  295.     End Sub
  296.     Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
  297.         MyBase.OnMouseUp(e)
  298.         _State = MouseState.Over
  299.         Invalidate()
  300.     End Sub
  301.     Protected Overrides Sub OnMouseEnter(e As EventArgs)
  302.         MyBase.OnMouseEnter(e)
  303.         _State = MouseState.Over
  304.         Invalidate()
  305.     End Sub
  306.     Protected Overrides Sub OnMouseLeave(e As EventArgs)
  307.         MyBase.OnMouseLeave(e)
  308.         _State = MouseState.None
  309.         Invalidate()
  310.     End Sub
  311.  
  312. #End Region
  313.  
  314.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  315.         MyBase.OnPaint(e)
  316.         Dim G = e.Graphics
  317.         G.Clear(Color.FromArgb(44, 51, 62))
  318.         G.FillRectangle(New SolidBrush(Color.FromArgb(36, 39, 46)), New Rectangle(0, 0, 15, 15))
  319.         G.DrawLine(New Pen(Color.FromArgb(26, 29, 33)), New Point(0, 0), New Point(0, 14))
  320.         G.DrawLine(New Pen(Color.FromArgb(26, 29, 33)), New Point(0, 0), New Point(14, 0))
  321.         If Checked Then
  322.             G.FillRectangle(New LinearGradientBrush(New Point(3, 3), New Point(3, 13), Color.FromArgb(123, 255, 201), Color.FromArgb(41, 131, 113)), New Rectangle(3, 3, 9, 9))
  323.             G.FillRectangle(New LinearGradientBrush(New Point(4, 4), New Point(4, 11), Color.FromArgb(9, 204, 157), Color.FromArgb(41, 131, 113)), New Rectangle(4, 4, 7, 7))
  324.             G.DrawString(Text, New Font("Segoe UI", 9, FontStyle.Bold), Brushes.White, New Point(18, -1))
  325.         Else
  326.             Select Case _State
  327.                 Case MouseState.None
  328.                     G.DrawString(Text, New Font("Segoe UI", 9, FontStyle.Bold), New SolidBrush(Color.FromArgb(121, 131, 141)), New Point(18, -1))
  329.                 Case MouseState.Over
  330.                     G.DrawRectangle(New Pen(Color.FromArgb(0, 205, 155), 2), New Rectangle(1, 1, 13, 13))
  331.                     G.DrawString(Text, New Font("Segoe UI", 9, FontStyle.Bold), Brushes.White, New Point(18, -1))
  332.                 Case MouseState.Down
  333.                     G.DrawString(Text, New Font("Segoe UI", 9, FontStyle.Bold), Brushes.White, New Point(18, -1))
  334.             End Select
  335.         End If
  336.     End Sub
  337. End Class
  338.  
  339. Class MysticProgressBar
  340.     Inherits Control
  341.  
  342. #Region " Variables "
  343.  
  344.     Private _Value As Integer = 0
  345.     Private _Maximum As Integer = 100
  346.  
  347. #End Region
  348.  
  349. #Region " Control "
  350.     <Category("Control")>
  351.     Public Property Maximum() As Integer
  352.         Get
  353.             Return _Maximum
  354.         End Get
  355.         Set(V As Integer)
  356.             Select Case V
  357.                 Case Is < _Value
  358.                     _Value = V
  359.             End Select
  360.             _Maximum = V
  361.             Invalidate()
  362.         End Set
  363.     End Property
  364.  
  365.     <Category("Control")>
  366.     Public Property Value() As Integer
  367.         Get
  368.             Select Case _Value
  369.                 Case 0
  370.                     Return 0
  371.                     Invalidate()
  372.                 Case Else
  373.                     Return _Value
  374.                     Invalidate()
  375.             End Select
  376.         End Get
  377.         Set(V As Integer)
  378.             Select Case V
  379.                 Case Is > _Maximum
  380.                     V = _Maximum
  381.                     Invalidate()
  382.             End Select
  383.             _Value = V
  384.             Invalidate()
  385.         End Set
  386.     End Property
  387. #End Region
  388.  
  389. #Region " Events "
  390.     Protected Overrides Sub OnResize(e As EventArgs)
  391.         MyBase.OnResize(e)
  392.         Height = 25
  393.     End Sub
  394.  
  395.     Protected Overrides Sub CreateHandle()
  396.         MyBase.CreateHandle()
  397.         Height = 25
  398.     End Sub
  399.  
  400.     Public Sub Increment(ByVal Amount As Integer)
  401.         Value += Amount
  402.     End Sub
  403. #End Region
  404.  
  405.     Sub New()
  406.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or _
  407.                  ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer, True)
  408.         DoubleBuffered = True
  409.     End Sub
  410.  
  411.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  412.         MyBase.OnPaint(e)
  413.         Dim G = e.Graphics
  414.         G.SmoothingMode = SmoothingMode.HighQuality
  415.         G.PixelOffsetMode = PixelOffsetMode.HighQuality
  416.         G.Clear(Color.FromArgb(32, 37, 41))
  417.         Dim _Progress As Integer = CInt(_Value / _Maximum * Width)
  418.         G.FillRectangle(New SolidBrush(Color.FromArgb(0, 163, 123)), New Rectangle(0, 0, _Progress - 1, Height))
  419.         For i As Integer = 0 To _Progress - 1 Step 16
  420.             G.DrawLine(New Pen(Color.FromArgb(0, 124, 95), 8), i, 0 - 2, i + 20, Height + 2)
  421.         Next
  422.         G.FillRectangle(New LinearGradientBrush(New Point(0, 0), New Point(0, Height), Color.FromArgb(80, Color.White), Color.FromArgb(100, Color.Black)), New Rectangle(0, 0, _Progress - 1, Height))
  423.         G.FillRectangle(New SolidBrush(Color.FromArgb(32, 37, 41)), New Rectangle(_Progress - 1, 0, Width - _Progress, Height))
  424.  
  425.         G.FillRectangle(New SolidBrush(Color.FromArgb(44, 51, 62)), New Rectangle(0, 0, 1, 1))
  426.         G.FillRectangle(New SolidBrush(Color.FromArgb(44, 51, 62)), New Rectangle(Width - 1, 0, 1, 1))
  427.         G.FillRectangle(New SolidBrush(Color.FromArgb(44, 51, 62)), New Rectangle(0, Height - 1, 1, 1))
  428.         G.FillRectangle(New SolidBrush(Color.FromArgb(44, 51, 62)), New Rectangle(Width - 1, Height - 1, 1, 1))
  429.  
  430.         G.InterpolationMode = CType(7, InterpolationMode)
  431.     End Sub
  432. End Class
  433.  
  434. <DefaultEvent("TextChanged")>
  435. Class MysticTextBox
  436.     Inherits Control
  437.  
  438. #Region " Variables "
  439.  
  440.     Private _State As MouseState = MouseState.None
  441.     Private WithEvents _TextBox As Windows.Forms.TextBox
  442.     Private _Focus As Boolean = False
  443. #End Region
  444.  
  445. #Region " Properties "
  446.  
  447. #Region " TextBox Properties "
  448.  
  449.     Private _TextAlign As HorizontalAlignment = HorizontalAlignment.Left
  450.     <Category("Options")> _
  451.     Property TextAlign() As HorizontalAlignment
  452.         Get
  453.             Return _TextAlign
  454.         End Get
  455.         Set(ByVal value As HorizontalAlignment)
  456.             _TextAlign = value
  457.             If _TextBox IsNot Nothing Then
  458.                 _TextBox.TextAlign = value
  459.             End If
  460.         End Set
  461.     End Property
  462.     Private _MaxLength As Integer = 32767
  463.     <Category("Options")> _
  464.     Property MaxLength() As Integer
  465.         Get
  466.             Return _MaxLength
  467.         End Get
  468.         Set(ByVal value As Integer)
  469.             _MaxLength = value
  470.             If _TextBox IsNot Nothing Then
  471.                 _TextBox.MaxLength = value
  472.             End If
  473.         End Set
  474.     End Property
  475.     Private _ReadOnly As Boolean
  476.     <Category("Options")> _
  477.     Property [ReadOnly]() As Boolean
  478.         Get
  479.             Return _ReadOnly
  480.         End Get
  481.         Set(ByVal value As Boolean)
  482.             _ReadOnly = value
  483.             If _TextBox IsNot Nothing Then
  484.                 _TextBox.ReadOnly = value
  485.             End If
  486.         End Set
  487.     End Property
  488.     Private _UseSystemPasswordChar As Boolean
  489.     <Category("Options")> _
  490.     Property UseSystemPasswordChar() As Boolean
  491.         Get
  492.             Return _UseSystemPasswordChar
  493.         End Get
  494.         Set(ByVal value As Boolean)
  495.             _UseSystemPasswordChar = value
  496.             If _TextBox IsNot Nothing Then
  497.                 _TextBox.UseSystemPasswordChar = value
  498.             End If
  499.         End Set
  500.     End Property
  501.     Private _Multiline As Boolean
  502.     <Category("Options")> _
  503.     Property Multiline() As Boolean
  504.         Get
  505.             Return _Multiline
  506.         End Get
  507.         Set(ByVal value As Boolean)
  508.             _Multiline = value
  509.             If _TextBox IsNot Nothing Then
  510.                 _TextBox.Multiline = value
  511.  
  512.                 If value Then
  513.                     _TextBox.Height = Height - 11
  514.                 Else
  515.                     Height = _TextBox.Height + 11
  516.                 End If
  517.  
  518.             End If
  519.         End Set
  520.     End Property
  521.     <Category("Options")> _
  522.     Overrides Property Text As String
  523.         Get
  524.             Return MyBase.Text
  525.         End Get
  526.         Set(ByVal value As String)
  527.             MyBase.Text = value
  528.             If _TextBox IsNot Nothing Then
  529.                 _TextBox.Text = value
  530.             End If
  531.         End Set
  532.     End Property
  533.     <Category("Options")> _
  534.     Overrides Property Font As Font
  535.         Get
  536.             Return MyBase.Font
  537.         End Get
  538.         Set(ByVal value As Font)
  539.             MyBase.Font = value
  540.             If _TextBox IsNot Nothing Then
  541.                 _TextBox.Font = value
  542.                 _TextBox.Location = New Point(3, 5)
  543.                 _TextBox.Width = Width - 6
  544.  
  545.                 If Not _Multiline Then
  546.                     Height = _TextBox.Height + 11
  547.                 End If
  548.             End If
  549.         End Set
  550.     End Property
  551.  
  552.     Protected Overrides Sub OnCreateControl()
  553.         MyBase.OnCreateControl()
  554.         If Not Controls.Contains(_TextBox) Then
  555.             Controls.Add(_TextBox)
  556.         End If
  557.     End Sub
  558.     Private Sub OnBaseTextChanged(ByVal s As Object, ByVal e As EventArgs)
  559.         Text = _TextBox.Text
  560.     End Sub
  561.     Private Sub OnBaseKeyDown(ByVal s As Object, ByVal e As KeyEventArgs)
  562.         If e.Control AndAlso e.KeyCode = Keys.A Then
  563.             _TextBox.SelectAll()
  564.             e.SuppressKeyPress = True
  565.         End If
  566.         If e.Control AndAlso e.KeyCode = Keys.C Then
  567.             _TextBox.Copy()
  568.             e.SuppressKeyPress = True
  569.         End If
  570.     End Sub
  571.     Protected Overrides Sub OnResize(ByVal e As EventArgs)
  572.         _TextBox.Location = New Point(5, 5)
  573.         _TextBox.Width = Width - 10
  574.  
  575.         If _Multiline Then
  576.             _TextBox.Height = Height - 11
  577.         Else
  578.             Height = _TextBox.Height + 11
  579.         End If
  580.  
  581.         MyBase.OnResize(e)
  582.     End Sub
  583.  
  584.     Protected Overrides Sub OnGotFocus(e As EventArgs)
  585.         MyBase.OnGotFocus(e)
  586.         _Focus = True
  587.         Invalidate()
  588.     End Sub
  589.  
  590.     Protected Overrides Sub OnLostFocus(e As EventArgs)
  591.         MyBase.OnLostFocus(e)
  592.         _Focus = False
  593.         Invalidate()
  594.     End Sub
  595.  
  596. #End Region
  597.  
  598. #Region " Mouse States "
  599.  
  600.     Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
  601.         MyBase.OnMouseDown(e)
  602.         _State = MouseState.Down
  603.         Invalidate()
  604.     End Sub
  605.     Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
  606.         MyBase.OnMouseUp(e)
  607.         _State = MouseState.Over
  608.         _TextBox.Focus()
  609.         Invalidate()
  610.     End Sub
  611.     Protected Overrides Sub OnMouseEnter(e As EventArgs)
  612.         MyBase.OnMouseEnter(e)
  613.         _State = MouseState.Over
  614.         _TextBox.Focus()
  615.         Invalidate()
  616.     End Sub
  617.     Protected Overrides Sub OnMouseLeave(e As EventArgs)
  618.         MyBase.OnMouseLeave(e)
  619.         _State = MouseState.None
  620.         Invalidate()
  621.     End Sub
  622.  
  623. #End Region
  624.  
  625. #End Region
  626.  
  627.     Sub New()
  628.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or _
  629.                  ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer Or _
  630.                  ControlStyles.SupportsTransparentBackColor, True)
  631.         DoubleBuffered = True
  632.  
  633.         BackColor = Color.Transparent
  634.  
  635.         _TextBox = New Windows.Forms.TextBox
  636.         _TextBox.Font = New Font("Segoe UI", 9, FontStyle.Bold)
  637.         _TextBox.Text = Text
  638.         _TextBox.BackColor = Color.FromArgb(34, 37, 44)
  639.         _TextBox.ForeColor = Color.White
  640.         _TextBox.MaxLength = _MaxLength
  641.         _TextBox.Multiline = _Multiline
  642.         _TextBox.ReadOnly = _ReadOnly
  643.         _TextBox.UseSystemPasswordChar = _UseSystemPasswordChar
  644.         _TextBox.BorderStyle = BorderStyle.None
  645.         _TextBox.Location = New Point(5, 5)
  646.         _TextBox.Width = Width - 10
  647.  
  648.         _TextBox.Cursor = Cursors.IBeam
  649.  
  650.         If _Multiline Then
  651.             _TextBox.Height = Height - 11
  652.         Else
  653.             Height = _TextBox.Height + 11
  654.         End If
  655.  
  656.         AddHandler _TextBox.TextChanged, AddressOf OnBaseTextChanged
  657.         AddHandler _TextBox.KeyDown, AddressOf OnBaseKeyDown
  658.     End Sub
  659.  
  660.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  661.         MyBase.OnPaint(e)
  662.         Dim G = e.Graphics
  663.         G.Clear(Color.FromArgb(34, 37, 44))
  664.  
  665.         G.DrawRectangle(New Pen(Color.FromArgb(0, 206, 153), 2), New Rectangle(1, 1, Width - 2, Height - 2))
  666.  
  667.         G.FillRectangle(New SolidBrush(Color.FromArgb(44, 51, 62)), New Rectangle(0, 0, 1, 1))
  668.         G.FillRectangle(New SolidBrush(Color.FromArgb(44, 51, 62)), New Rectangle(Width - 1, 0, 1, 1))
  669.         G.FillRectangle(New SolidBrush(Color.FromArgb(44, 51, 62)), New Rectangle(0, Height - 1, 1, 1))
  670.         G.FillRectangle(New SolidBrush(Color.FromArgb(44, 51, 62)), New Rectangle(Width - 1, Height - 1, 1, 1))
  671.     End Sub
  672.  
  673. End Class
  674.  
  675. Class MysticGroupBox
  676.     Inherits ContainerControl
  677.  
  678.     Sub New()
  679.         Size = New Size(200, 100)
  680.     End Sub
  681.  
  682.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  683.         MyBase.OnPaint(e)
  684.         Dim G = e.Graphics
  685.  
  686.         G.Clear(Color.FromArgb(44, 51, 62))
  687.  
  688.         G.DrawRectangle(New Pen(Color.FromArgb(0, 206, 153), 2), New Rectangle(1, 1, Width - 2, Height - 2))
  689.  
  690.         G.DrawString(Text, New Font("Segoe UI", 9, FontStyle.Bold), New SolidBrush(Color.FromArgb(0, 206, 153)), New Point(7, 5))
  691.  
  692.         G.FillRectangle(New SolidBrush(Color.FromArgb(44, 51, 62)), New Rectangle(0, 0, 1, 1))
  693.         G.FillRectangle(New SolidBrush(Color.FromArgb(44, 51, 62)), New Rectangle(Width - 1, 0, 1, 1))
  694.         G.FillRectangle(New SolidBrush(Color.FromArgb(44, 51, 62)), New Rectangle(0, Height - 1, 1, 1))
  695.         G.FillRectangle(New SolidBrush(Color.FromArgb(44, 51, 62)), New Rectangle(Width - 1, Height - 1, 1, 1))
  696.  
  697.     End Sub
  698.  
  699. End Class
  700.  
  701. Class MysticClose
  702.     Inherits Control
  703.  
  704. #Region " Declarations "
  705.     Private _State As MouseState
  706. #End Region
  707.  
  708. #Region " Mouse States "
  709.     Protected Overrides Sub OnMouseEnter(e As EventArgs)
  710.         MyBase.OnMouseEnter(e)
  711.         _State = MouseState.Over
  712.         Invalidate()
  713.     End Sub
  714.  
  715.     Protected Overrides Sub OnMouseLeave(e As EventArgs)
  716.         MyBase.OnMouseLeave(e)
  717.         _State = MouseState.None
  718.         Invalidate()
  719.     End Sub
  720.  
  721.     Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
  722.         MyBase.OnMouseDown(e)
  723.         _State = MouseState.Down
  724.         Invalidate()
  725.     End Sub
  726.  
  727.     Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
  728.         MyBase.OnMouseUp(e)
  729.         _State = MouseState.Over
  730.         Invalidate()
  731.     End Sub
  732.  
  733.     Protected Overrides Sub OnClick(e As EventArgs)
  734.         MyBase.OnClick(e)
  735.         Environment.Exit(0)
  736.     End Sub
  737. #End Region
  738.  
  739.     Protected Overrides Sub OnResize(e As EventArgs)
  740.         MyBase.OnResize(e)
  741.         Size = New Size(12, 12)
  742.     End Sub
  743.  
  744.     Sub New()
  745.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or _
  746.                 ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.SupportsTransparentBackColor, True)
  747.         DoubleBuffered = True
  748.         Size = New Size(12, 12)
  749.     End Sub
  750.  
  751.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  752.         MyBase.OnPaint(e)
  753.         Dim G = e.Graphics
  754.         BackColor = Color.Transparent
  755.  
  756.         Dim _StringF As New StringFormat
  757.         _StringF.Alignment = StringAlignment.Center
  758.         _StringF.LineAlignment = StringAlignment.Center
  759.  
  760.         G.DrawString("r", New Font("Marlett", 11), New LinearGradientBrush(New Point(0, 0), New Point(0, Height), Color.FromArgb(9, 204, 157), Color.FromArgb(41, 131, 113)), New RectangleF(0, 0, Width, Height), _StringF)
  761.  
  762.         Select Case _State
  763.             Case MouseState.Down
  764.                 G.DrawString("r", New Font("Marlett", 11), New SolidBrush(Color.FromArgb(40, Color.Black)), New RectangleF(0, 0, Width, Height), _StringF)
  765.         End Select
  766.  
  767.     End Sub
  768.  
  769. End Class
  770.  
  771. Class MysticMini
  772.     Inherits Control
  773.  
  774. #Region " Declarations "
  775.     Private _State As MouseState
  776. #End Region
  777. ' Get more free themes at ThemesVB.NET
  778. #Region " Mouse States "
  779.     Protected Overrides Sub OnMouseEnter(e As EventArgs)
  780.         MyBase.OnMouseEnter(e)
  781.         _State = MouseState.Over
  782.         Invalidate()
  783.     End Sub
  784.  
  785.     Protected Overrides Sub OnMouseLeave(e As EventArgs)
  786.         MyBase.OnMouseLeave(e)
  787.         _State = MouseState.None
  788.         Invalidate()
  789.     End Sub
  790.  
  791.     Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
  792.         MyBase.OnMouseDown(e)
  793.         _State = MouseState.Down
  794.         Invalidate()
  795.     End Sub
  796.  
  797.     Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
  798.         MyBase.OnMouseUp(e)
  799.         _State = MouseState.Over
  800.         Invalidate()
  801.     End Sub
  802.  
  803.     Protected Overrides Sub OnClick(e As EventArgs)
  804.         MyBase.OnClick(e)
  805.         FindForm.WindowState = FormWindowState.Minimized
  806.     End Sub
  807. #End Region
  808.  
  809.     Protected Overrides Sub OnResize(e As EventArgs)
  810.         MyBase.OnResize(e)
  811.         Size = New Size(12, 12)
  812.     End Sub
  813. ' Get more free themes at ThemesVB.NET
  814.     Sub New()
  815.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or _
  816.                 ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.SupportsTransparentBackColor, True)
  817.         DoubleBuffered = True
  818.         Size = New Size(12, 12)
  819.     End Sub
  820.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  821.         MyBase.OnPaint(e)
  822.         Dim G = e.Graphics
  823.         BackColor = Color.Transparent
  824.         Dim _StringF As New StringFormat
  825.         _StringF.Alignment = StringAlignment.Center
  826.         _StringF.LineAlignment = StringAlignment.Center
  827.         G.DrawString("0", New Font("Marlett", 11), New LinearGradientBrush(New Point(0, 0), New Point(0, Height), Color.FromArgb(9, 204, 157), Color.FromArgb(41, 131, 113)), New RectangleF(0, 0, Width, Height), _StringF)
  828.         Select Case _State
  829.             Case MouseState.Down
  830.                 G.DrawString("0", New Font("Marlett", 11), New SolidBrush(Color.FromArgb(40, Color.Black)), New RectangleF(0, 0, Width, Height), _StringF)
  831.         End Select
  832.     End Sub
  833. End Class
Add Comment
Please, Sign In to add comment