Finessed

Knight Theme

Jan 4th, 2016
585
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 19.58 KB | None | 0 0
  1. Imports System.Drawing
  2. Imports System.Drawing.Drawing2D
  3. Imports System.ComponentModel
  4.  
  5. ' Get more free themes at ThemesVB.NET
  6.  
  7. Enum MouseState
  8.     None = 0
  9.     Over = 1
  10.     Down = 2
  11. End Enum
  12.  
  13. Class KnightTheme
  14.     Inherits ContainerControl
  15.  
  16. #Region " Declarations "
  17.     Private _Header As Integer = 38
  18.     Private _Down As Boolean = False
  19.     Private _MousePoint As Point
  20. #End Region
  21.  
  22. #Region " MouseStates "
  23. ' Get more free themes at ThemesVB.NET
  24.     Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
  25.         MyBase.OnMouseUp(e)
  26.         _Down = False
  27.     End Sub
  28.  
  29.     Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
  30.         MyBase.OnMouseDown(e)
  31.         If e.Location.Y < _Header AndAlso e.Button = Windows.Forms.MouseButtons.Left Then
  32.             _Down = True
  33.             _MousePoint = e.Location
  34.         End If
  35.     End Sub
  36.  
  37.     Protected Overrides Sub OnMouseMove(e As MouseEventArgs)
  38.         MyBase.OnMouseMove(e)
  39.         If _Down = True Then
  40.             ParentForm.Location = MousePosition - _MousePoint
  41.         End If
  42.     End Sub
  43.  
  44. #End Region
  45. ' Get more free themes at ThemesVB.NET
  46.     Protected Overrides Sub OnCreateControl()
  47.         MyBase.OnCreateControl()
  48.         ParentForm.FormBorderStyle = FormBorderStyle.None
  49.         ParentForm.TransparencyKey = Color.Fuchsia
  50.         Dock = DockStyle.Fill
  51.         Invalidate()
  52.     End Sub
  53.  
  54.     Sub New()
  55.         BackColor = Color.FromArgb(46, 49, 61)
  56.     End Sub
  57.  
  58.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  59.         MyBase.OnPaint(e)
  60.         Dim G = e.Graphics
  61.         G.Clear(Color.FromArgb(236, 73, 99))
  62.         G.FillRectangle(New SolidBrush(Color.FromArgb(46, 49, 61)), New Rectangle(0, _Header, Width, Height - _Header))
  63.         G.FillRectangle(Brushes.Fuchsia, New Rectangle(0, 0, 1, 1))
  64.         G.FillRectangle(Brushes.Fuchsia, New Rectangle(1, 0, 1, 1))
  65.         G.FillRectangle(Brushes.Fuchsia, New Rectangle(0, 1, 1, 1))
  66.         G.FillRectangle(Brushes.Fuchsia, New Rectangle(Width - 1, 0, 1, 1))
  67.         G.FillRectangle(Brushes.Fuchsia, New Rectangle(Width - 2, 0, 1, 1))
  68.         G.FillRectangle(Brushes.Fuchsia, New Rectangle(Width - 1, 1, 1, 1))
  69.         Dim _StringF As New StringFormat
  70.         _StringF.Alignment = StringAlignment.Center
  71.         _StringF.LineAlignment = StringAlignment.Center
  72.         G.DrawString(Text, New Font("Segoe UI", 12), Brushes.White, New RectangleF(0, 0, Width, _Header), _StringF)
  73.     End Sub
  74.  
  75. End Class
  76.  
  77. Class KnightButton
  78.     Inherits Control
  79.  
  80. #Region " Declarations "
  81.     Private _State As MouseState = MouseState.None
  82. #End Region
  83.  
  84. #Region " MouseStates "
  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 OnMouseDown(e As MouseEventArgs)
  99.         MyBase.OnMouseDown(e)
  100.         _State = MouseState.Down
  101.         Invalidate()
  102.     End Sub
  103.  
  104.     Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
  105.         MyBase.OnMouseUp(e)
  106.         _State = MouseState.Over
  107.         Invalidate()
  108.     End Sub
  109.  
  110. #End Region
  111. ' Get more free themes at ThemesVB.NET
  112. #Region " Properties "
  113.     Private _Rounded As Boolean
  114.     Public Property RoundedCorners() As Boolean
  115.         Get
  116.             Return _Rounded
  117.         End Get
  118.         Set(ByVal value As Boolean)
  119.             _Rounded = value
  120.         End Set
  121.     End Property
  122. #End Region
  123.  
  124.     Sub New()
  125.         Size = New Size(90, 30)
  126.     End Sub
  127.  
  128.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  129.         MyBase.OnPaint(e)
  130.         Dim G = e.Graphics
  131.         G.Clear(Color.FromArgb(236, 73, 99))
  132.         Select Case _State
  133.             Case MouseState.Over
  134.                 G.FillRectangle(New SolidBrush(Color.FromArgb(25, Color.White)), New Rectangle(0, 0, Width, Height))
  135.  
  136.             Case MouseState.Down
  137.                 G.FillRectangle(New SolidBrush(Color.FromArgb(25, Color.Black)), New Rectangle(0, 0, Width, Height))
  138.         End Select
  139.         If _Rounded Then
  140.             G.FillRectangle(New SolidBrush(Parent.BackColor), New Rectangle(0, 0, 1, 1))
  141.             G.FillRectangle(New SolidBrush(Parent.BackColor), New Rectangle(Width - 1, 0, 1, 1))
  142.             G.FillRectangle(New SolidBrush(Parent.BackColor), New Rectangle(0, Height - 1, 1, 1))
  143.             G.FillRectangle(New SolidBrush(Parent.BackColor), New Rectangle(Width - 1, Height - 1, 1, 1))
  144.         End If
  145.         Dim _StringF As New StringFormat
  146.         _StringF.Alignment = StringAlignment.Center
  147.         _StringF.LineAlignment = StringAlignment.Center
  148.         G.DrawString(Text, New Font("Segoe UI", 10), Brushes.White, New RectangleF(0, 0, Width - 1, Height - 1), _StringF)
  149.     End Sub
  150. End Class
  151.  
  152. Class KnightGroupBox
  153.     Inherits ContainerControl
  154.  
  155.     Sub New()
  156.         Size = New Size(200, 100)
  157.         BackColor = Color.FromArgb(37, 39, 48)
  158.     End Sub
  159.  
  160.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  161.         MyBase.OnPaint(e)
  162.         Dim G = e.Graphics
  163.         G.Clear(BackColor)
  164.         G.DrawRectangle(New Pen(Color.FromArgb(236, 73, 99)), New Rectangle(0, 0, Width - 1, Height - 1))
  165.         G.FillRectangle(New SolidBrush(Color.FromArgb(46, 49, 61)), New Rectangle(0, 0, 1, 1))
  166.         G.FillRectangle(New SolidBrush(Color.FromArgb(46, 49, 61)), New Rectangle(Width - 1, 0, 1, 1))
  167.         G.FillRectangle(New SolidBrush(Color.FromArgb(46, 49, 61)), New Rectangle(0, Height - 1, 1, 1))
  168.         G.FillRectangle(New SolidBrush(Color.FromArgb(46, 49, 61)), New Rectangle(Width - 1, Height - 1, 1, 1))
  169.         G.DrawString(Text, New Font("Segoe UI", 10), Brushes.White, New Point(7, 5))
  170.     End Sub
  171.  
  172. End Class
  173.  
  174. <DefaultEvent("CheckedChanged")>
  175. Class KnightRadioButton
  176.     Inherits Control
  177.  
  178. #Region " Variables"
  179.     Private _Checked As Boolean
  180. #End Region
  181.  
  182. #Region " Properties"
  183.     Property Checked() As Boolean
  184.         Get
  185.             Return _Checked
  186.         End Get
  187.         Set(value As Boolean)
  188.             _Checked = value
  189.             InvalidateControls()
  190.             RaiseEvent CheckedChanged(Me)
  191.             Invalidate()
  192.         End Set
  193.     End Property
  194.     Event CheckedChanged(ByVal sender As Object)
  195.     Protected Overrides Sub OnClick(e As EventArgs)
  196.         If Not _Checked Then Checked = True
  197.         MyBase.OnClick(e)
  198.     End Sub
  199.     Private Sub InvalidateControls()
  200.         If Not IsHandleCreated OrElse Not _Checked Then Return
  201.         For Each C As Control In Parent.Controls
  202.             If C IsNot Me AndAlso TypeOf C Is KnightRadioButton Then
  203.                 DirectCast(C, KnightRadioButton).Checked = False
  204.                 Invalidate()
  205.             End If
  206.         Next
  207.     End Sub
  208.     Protected Overrides Sub OnCreateControl()
  209.         MyBase.OnCreateControl()
  210.         InvalidateControls()
  211.     End Sub
  212.  
  213.  
  214.     Protected Overrides Sub OnResize(e As EventArgs)
  215.         MyBase.OnResize(e)
  216.         Height = 16
  217.     End Sub
  218.  
  219. #End Region
  220.  
  221.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  222.         MyBase.OnPaint(e)
  223.         Dim G = e.Graphics
  224.         G.SmoothingMode = 2
  225.         G.TextRenderingHint = 5
  226.         G.Clear(Parent.BackColor)
  227.         If Parent.BackColor = Color.FromArgb(46, 49, 61) Then
  228.             G.FillEllipse(New SolidBrush(Color.FromArgb(37, 39, 48)), New Rectangle(0, 0, 15, 15))
  229.         Else
  230.             G.FillEllipse(New SolidBrush(Color.FromArgb(24, 25, 31)), New Rectangle(0, 0, 15, 15))
  231.         End If
  232.         If Checked Then
  233.             G.FillEllipse(New SolidBrush(Color.FromArgb(236, 73, 99)), New Rectangle(4, 4, 7, 7))
  234.         End If
  235.         G.DrawString(Text, New Font("Segoe UI", 10), Brushes.White, New Point(18, -2))
  236.     End Sub
  237.  
  238. End Class
  239.  
  240. <DefaultEvent("CheckedChanged")>
  241. Class KnightCheckBox
  242.     Inherits Control
  243.  
  244. #Region "Variables"
  245.     Private _Checked As Boolean
  246. #End Region
  247.  
  248. #Region " Properties"
  249.     Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
  250.         MyBase.OnTextChanged(e)
  251.         Invalidate()
  252.     End Sub
  253.  
  254.     Property Checked() As Boolean
  255.         Get
  256.             Return _Checked
  257.         End Get
  258.         Set(ByVal value As Boolean)
  259.             _Checked = value
  260.             Invalidate()
  261.         End Set
  262.     End Property
  263.  
  264.     Event CheckedChanged(ByVal sender As Object)
  265.     Protected Overrides Sub OnClick(ByVal e As System.EventArgs)
  266.         If Not _Checked Then
  267.             Checked = True
  268.         Else
  269.             Checked = False
  270.         End If
  271.         RaiseEvent CheckedChanged(Me)
  272.         MyBase.OnClick(e)
  273.     End Sub
  274.  
  275.     Protected Overrides Sub OnResize(e As EventArgs)
  276.         MyBase.OnResize(e)
  277.         Height = 16
  278.     End Sub
  279.  
  280. #End Region
  281.  
  282.  
  283.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  284.         MyBase.OnPaint(e)
  285.         Dim G = e.Graphics
  286.         G.Clear(BackColor)
  287.  
  288.         If Parent.BackColor = Color.FromArgb(46, 49, 61) Then
  289.             G.FillRectangle(New SolidBrush(Color.FromArgb(37, 39, 48)), New Rectangle(0, 0, 15, 15))
  290.         Else
  291.             G.FillRectangle(New SolidBrush(Color.FromArgb(24, 25, 31)), New Rectangle(0, 0, 15, 15))
  292.         End If
  293.         If Checked Then
  294.             G.FillRectangle(New SolidBrush(Color.FromArgb(236, 73, 99)), New Rectangle(4, 4, 7, 7))
  295.         End If
  296.  
  297.         G.DrawString(Text, New Font("Segoe UI", 10), Brushes.White, New Point(18, -2))
  298.  
  299.     End Sub
  300. End Class
  301.  
  302. <DefaultEvent("TextChanged")>
  303. Class KnightTextBox
  304.     Inherits Control
  305.  
  306. #Region " Variables"
  307.     Private WithEvents _TextBox As Windows.Forms.TextBox
  308. #End Region
  309.  
  310. #Region " Properties"
  311.  
  312. #Region " TextBox Properties"
  313.  
  314.     Private _TextAlign As HorizontalAlignment = HorizontalAlignment.Left
  315.     <Category("Options")> _
  316.     Property TextAlign() As HorizontalAlignment
  317.         Get
  318.             Return _TextAlign
  319.         End Get
  320.         Set(ByVal value As HorizontalAlignment)
  321.             _TextAlign = value
  322.             If _TextBox IsNot Nothing Then
  323.                 _TextBox.TextAlign = value
  324.             End If
  325.         End Set
  326.     End Property
  327.     Private _MaxLength As Integer = 32767
  328.     <Category("Options")> _
  329.     Property MaxLength() As Integer
  330.         Get
  331.             Return _MaxLength
  332.         End Get
  333.         Set(ByVal value As Integer)
  334.             _MaxLength = value
  335.             If _TextBox IsNot Nothing Then
  336.                 _TextBox.MaxLength = value
  337.             End If
  338.         End Set
  339.     End Property
  340.     Private _ReadOnly As Boolean
  341.     <Category("Options")> _
  342.     Property [ReadOnly]() As Boolean
  343.         Get
  344.             Return _ReadOnly
  345.         End Get
  346.         Set(ByVal value As Boolean)
  347.             _ReadOnly = value
  348.             If _TextBox IsNot Nothing Then
  349.                 _TextBox.ReadOnly = value
  350.             End If
  351.         End Set
  352.     End Property
  353.     Private _UseSystemPasswordChar As Boolean
  354.     <Category("Options")> _
  355.     Property UseSystemPasswordChar() As Boolean
  356.         Get
  357.             Return _UseSystemPasswordChar
  358.         End Get
  359.         Set(ByVal value As Boolean)
  360.             _UseSystemPasswordChar = value
  361.             If _TextBox IsNot Nothing Then
  362.                 _TextBox.UseSystemPasswordChar = value
  363.             End If
  364.         End Set
  365.     End Property
  366.     Private _Multiline As Boolean
  367.     <Category("Options")> _
  368.     Property Multiline() As Boolean
  369.         Get
  370.             Return _Multiline
  371.         End Get
  372.         Set(ByVal value As Boolean)
  373.             _Multiline = value
  374.             If _TextBox IsNot Nothing Then
  375.                 _TextBox.Multiline = value
  376.  
  377.                 If value Then
  378.                     _TextBox.Height = Height - 11
  379.                 Else
  380.                     Height = _TextBox.Height + 11
  381.                 End If
  382.  
  383.             End If
  384.         End Set
  385.     End Property
  386.     <Category("Options")> _
  387.     Overrides Property Text As String
  388.         Get
  389.             Return MyBase.Text
  390.         End Get
  391.         Set(ByVal value As String)
  392.             MyBase.Text = value
  393.             If _TextBox IsNot Nothing Then
  394.                 _TextBox.Text = value
  395.             End If
  396.         End Set
  397.     End Property
  398.     <Category("Options")> _
  399.     Overrides Property Font As Font
  400.         Get
  401.             Return MyBase.Font
  402.         End Get
  403.         Set(ByVal value As Font)
  404.             MyBase.Font = value
  405.             If _TextBox IsNot Nothing Then
  406.                 _TextBox.Font = value
  407.                 _TextBox.Location = New Point(3, 5)
  408.                 _TextBox.Width = Width - 6
  409.  
  410.                 If Not _Multiline Then
  411.                     Height = _TextBox.Height + 11
  412.                 End If
  413.             End If
  414.         End Set
  415.     End Property
  416.  
  417.     Protected Overrides Sub OnCreateControl()
  418.         MyBase.OnCreateControl()
  419.         If Not Controls.Contains(_TextBox) Then
  420.             Controls.Add(_TextBox)
  421.         End If
  422.     End Sub
  423.     Private Sub OnBaseTextChanged(ByVal s As Object, ByVal e As EventArgs)
  424.         Text = _TextBox.Text
  425.     End Sub
  426.     Private Sub OnBaseKeyDown(ByVal s As Object, ByVal e As KeyEventArgs)
  427.         If e.Control AndAlso e.KeyCode = Keys.A Then
  428.             _TextBox.SelectAll()
  429.             e.SuppressKeyPress = True
  430.         End If
  431.         If e.Control AndAlso e.KeyCode = Keys.C Then
  432.             _TextBox.Copy()
  433.             e.SuppressKeyPress = True
  434.         End If
  435.     End Sub
  436.     Protected Overrides Sub OnResize(ByVal e As EventArgs)
  437.         _TextBox.Location = New Point(5, 5)
  438.         _TextBox.Width = Width - 10
  439.  
  440.         If _Multiline Then
  441.             _TextBox.Height = Height - 11
  442.         Else
  443.             Height = _TextBox.Height + 11
  444.         End If
  445.         MyBase.OnResize(e)
  446.     End Sub
  447.  
  448. #End Region
  449. #End Region
  450.     Sub New()
  451.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or _
  452.                  ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer Or _
  453.                  ControlStyles.SupportsTransparentBackColor, True)
  454.         DoubleBuffered = True
  455.  
  456.         BackColor = Color.Transparent
  457.  
  458.         _TextBox = New Windows.Forms.TextBox
  459.         _TextBox.Font = New Font("Segoe UI", 10)
  460.         _TextBox.Text = Text
  461.         _TextBox.BackColor = Color.FromArgb(37, 39, 48)
  462.         _TextBox.ForeColor = Color.White
  463.         _TextBox.MaxLength = _MaxLength
  464.         _TextBox.Multiline = _Multiline
  465.         _TextBox.ReadOnly = _ReadOnly
  466.         _TextBox.UseSystemPasswordChar = _UseSystemPasswordChar
  467.         _TextBox.BorderStyle = BorderStyle.None
  468.         _TextBox.Location = New Point(5, 5)
  469.         _TextBox.Width = Width - 10
  470.  
  471.         _TextBox.Cursor = Cursors.IBeam
  472.  
  473.         If _Multiline Then
  474.             _TextBox.Height = Height - 11
  475.         Else
  476.             Height = _TextBox.Height + 11
  477.         End If
  478.  
  479.         AddHandler _TextBox.TextChanged, AddressOf OnBaseTextChanged
  480.         AddHandler _TextBox.KeyDown, AddressOf OnBaseKeyDown
  481.     End Sub
  482.  
  483.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  484.         MyBase.OnPaint(e)
  485.         Dim G = e.Graphics
  486.         G.Clear(Color.FromArgb(37, 39, 48))
  487.         G.DrawRectangle(New Pen(Color.FromArgb(236, 73, 99)), New Rectangle(0, 0, Width - 1, Height - 1))
  488.     End Sub
  489. End Class
  490. ' Get more free themes at ThemesVB.NET
  491. Class KnightClose
  492.     Inherits Control
  493.  
  494. #Region " Declarations "
  495.     Private _State As MouseState
  496. #End Region
  497.  
  498. #Region " MouseStates "
  499.     Protected Overrides Sub OnMouseEnter(e As EventArgs)
  500.         MyBase.OnMouseEnter(e)
  501.         _State = MouseState.Over
  502.         Invalidate()
  503.     End Sub
  504.  
  505.     Protected Overrides Sub OnMouseLeave(e As EventArgs)
  506.         MyBase.OnMouseLeave(e)
  507.         _State = MouseState.None
  508.         Invalidate()
  509.     End Sub
  510.  
  511.     Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
  512.         MyBase.OnMouseDown(e)
  513.         _State = MouseState.Down
  514.         Invalidate()
  515.     End Sub
  516.  
  517.     Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
  518.         MyBase.OnMouseUp(e)
  519.         _State = MouseState.Over
  520.         Invalidate()
  521.     End Sub
  522.  
  523.     Protected Overrides Sub OnClick(e As EventArgs)
  524.         MyBase.OnClick(e)
  525.         Environment.Exit(0)
  526.     End Sub
  527. #End Region
  528.  
  529.     Protected Overrides Sub OnResize(e As EventArgs)
  530.         MyBase.OnResize(e)
  531.         Size = New Size(12, 12)
  532.     End Sub
  533.  
  534.     Sub New()
  535.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or _
  536.                 ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer, True)
  537.         DoubleBuffered = True
  538.         Size = New Size(12, 12)
  539.     End Sub
  540.  
  541.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  542.         MyBase.OnPaint(e)
  543.         Dim G = e.Graphics
  544.  
  545.         G.Clear(Color.FromArgb(236, 73, 99))
  546.  
  547.         Dim _StringF As New StringFormat
  548.         _StringF.Alignment = StringAlignment.Center
  549.         _StringF.LineAlignment = StringAlignment.Center
  550.  
  551.         G.DrawString("r", New Font("Marlett", 11), Brushes.White, New RectangleF(0, 0, Width, Height), _StringF)
  552.  
  553.         Select Case _State
  554.             Case MouseState.Over
  555.                 G.DrawString("r", New Font("Marlett", 11), New SolidBrush(Color.FromArgb(25, Color.White)), New RectangleF(0, 0, Width, Height), _StringF)
  556.  
  557.             Case MouseState.Down
  558.                 G.DrawString("r", New Font("Marlett", 11), New SolidBrush(Color.FromArgb(40, Color.Black)), New RectangleF(0, 0, Width, Height), _StringF)
  559.  
  560.         End Select
  561.  
  562.     End Sub
  563.  
  564. End Class
  565. ' Get more free themes at ThemesVB.NET
  566. Class KnightMini
  567.     Inherits Control
  568.  
  569. #Region " Declarations "
  570.     Private _State As MouseState
  571. #End Region
  572.  
  573. #Region " MouseStates "
  574.     Protected Overrides Sub OnMouseEnter(e As EventArgs)
  575.         MyBase.OnMouseEnter(e)
  576.         _State = MouseState.Over
  577.         Invalidate()
  578.     End Sub
  579.  
  580.     Protected Overrides Sub OnMouseLeave(e As EventArgs)
  581.         MyBase.OnMouseLeave(e)
  582.         _State = MouseState.None
  583.         Invalidate()
  584.     End Sub
  585.  
  586.     Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
  587.         MyBase.OnMouseDown(e)
  588.         _State = MouseState.Down
  589.         Invalidate()
  590.     End Sub
  591.  
  592.     Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
  593.         MyBase.OnMouseUp(e)
  594.         _State = MouseState.Over
  595.         Invalidate()
  596.     End Sub
  597.  
  598.     Protected Overrides Sub OnClick(e As EventArgs)
  599.         MyBase.OnClick(e)
  600.         FindForm.WindowState = FormWindowState.Minimized
  601.     End Sub
  602. #End Region
  603.  
  604.     Protected Overrides Sub OnResize(e As EventArgs)
  605.         MyBase.OnResize(e)
  606.         Size = New Size(12, 12)
  607.     End Sub
  608. ' Get more free themes at ThemesVB.NET
  609.     Sub New()
  610.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or _
  611.                 ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer, True)
  612.         DoubleBuffered = True
  613.         Size = New Size(12, 12)
  614.     End Sub
  615.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  616.         MyBase.OnPaint(e)
  617.         Dim G = e.Graphics
  618.  
  619.         G.Clear(Color.FromArgb(236, 73, 99))
  620.  
  621.         Dim _StringF As New StringFormat
  622.         _StringF.Alignment = StringAlignment.Center
  623.         _StringF.LineAlignment = StringAlignment.Center
  624.  
  625.         G.DrawString("0", New Font("Marlett", 11), Brushes.White, New RectangleF(0, 0, Width, Height), _StringF)
  626.  
  627.         Select Case _State
  628.             Case MouseState.Over
  629.                 G.DrawString("0", New Font("Marlett", 11), New SolidBrush(Color.FromArgb(25, Color.White)), New RectangleF(0, 0, Width, Height), _StringF)
  630.  
  631.             Case MouseState.Down
  632.                 G.DrawString("0", New Font("Marlett", 11), New SolidBrush(Color.FromArgb(40, Color.Black)), New RectangleF(0, 0, Width, Height), _StringF)
  633.  
  634.         End Select
  635.  
  636.     End Sub
  637.  
  638. End Class
Add Comment
Please, Sign In to add comment