Finessed

Firefox Theme

Jan 4th, 2016
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 35.57 KB | None | 0 0
  1. Imports System.ComponentModel
  2. Imports System.Drawing.Drawing2D
  3. Imports System.Drawing.Text
  4.  
  5. ' Get more free themes at ThemesVB.NET
  6.  
  7. Module Theme
  8. ' Get more free themes at ThemesVB.NET
  9.     Public ReadOnly Property GlobalFont(B As FontStyle, S As Integer) As Font
  10.         Get
  11.             Return New Font("Segoe UI", S, B)
  12.         End Get
  13.     End Property
  14.  
  15.     Public Function GetCheckMark() As String
  16.         Return "iVBORw0KGgoAAAANSUhEUgAAABMAAAAQCAYAAAD0xERiAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAEySURBVDhPY/hPRUBdw/79+/efVHz77bf/X37+wRAn2bDff/7+91l+83/YmtsYBpJs2ITjz/8rTbrwP2Dlrf9XXn5FkSPJsD13P/y3nHsVbNjyy28w5Ik27NWXX//TNt8DG1S19zFWNRiGvfzy8//ccy9RxEB4wvFnYIMMZl7+//brLwx5EEYx7MP33/9dF18Ha1py8RVcHBR7mlMvgsVXX8X0Hgwz/P379z8yLtz5AKxJdcpFcBj9+v3nf/CqW2Cx5E13UdSiYwzDvv36/d9/BUSzzvRL/0t2PQSzQd57+vEHilp0jGEYCJ9+8hnuGhiee+4Vhjp0jNUwEN566/1/m/mQZJC/48H/zz9+YVWHjHEaBsKgwAZ59eH771jl0TFew0D48osvWMWxYYKGEY///gcAqiuA6kEmfEMAAAAASUVORK5CYII="
  17.     End Function
  18.  
  19. End Module
  20.  
  21. Module Helpers
  22. ' Get more free themes at ThemesVB.NET
  23.     Public Enum MouseState As Byte
  24.         None = 0
  25.         Over = 1
  26.         Down = 2
  27.     End Enum
  28.  
  29.     Public Function FullRectangle(S As Size, Subtract As Boolean) As Rectangle
  30.         If Subtract Then
  31.             Return New Rectangle(0, 0, S.Width - 1, S.Height - 1)
  32.         Else
  33.             Return New Rectangle(0, 0, S.Width, S.Height)
  34.         End If
  35.     End Function
  36.  
  37.     Public Function GreyColor(G As UInteger) As Color
  38.         Return Color.FromArgb(G, G, G)
  39.     End Function
  40.  
  41.     Public Sub CenterString(G As Graphics, T As String, F As Font, C As Color, R As Rectangle)
  42.         Dim TS As SizeF = G.MeasureString(T, F)
  43.  
  44.         Using B As New SolidBrush(C)
  45.             G.DrawString(T, F, B, New Point(R.Width / 2 - (TS.Width / 2), R.Height / 2 - (TS.Height / 2)))
  46.         End Using
  47.     End Sub
  48. ' Get more free themes at ThemesVB.NET
  49.     Public Sub FillRoundRect(G As Graphics, R As Rectangle, Curve As Integer, C As Color)
  50.  
  51.         Using B As New SolidBrush(C)
  52.             G.FillPie(B, R.X, R.Y, Curve, Curve, 180, 90)
  53.             G.FillPie(B, R.X + R.Width - Curve, R.Y, Curve, Curve, 270, 90)
  54.             G.FillPie(B, R.X, R.Y + R.Height - Curve, Curve, Curve, 90, 90)
  55.             G.FillPie(B, R.X + R.Width - Curve, R.Y + R.Height - Curve, Curve, Curve, 0, 90)
  56.             G.FillRectangle(B, CInt(R.X + Curve / 2), R.Y, R.Width - Curve, CInt(Curve / 2))
  57.             G.FillRectangle(B, R.X, CInt(R.Y + Curve / 2), R.Width, R.Height - Curve)
  58.             G.FillRectangle(B, CInt(R.X + Curve / 2), CInt(R.Y + R.Height - Curve / 2), R.Width - Curve, CInt(Curve / 2))
  59.         End Using
  60.  
  61.     End Sub
  62.  
  63.     Public Sub DrawRoundRect(G As Graphics, R As Rectangle, Curve As Integer, C As Color)
  64.  
  65.         Using P As New Pen(C)
  66.             G.DrawArc(P, R.X, R.Y, Curve, Curve, 180, 90)
  67.             G.DrawLine(P, CInt(R.X + Curve / 2), R.Y, CInt(R.X + R.Width - Curve / 2), R.Y)
  68.             G.DrawArc(P, R.X + R.Width - Curve, R.Y, Curve, Curve, 270, 90)
  69.             G.DrawLine(P, R.X, CInt(R.Y + Curve / 2), R.X, CInt(R.Y + R.Height - Curve / 2))
  70.             G.DrawLine(P, CInt(R.X + R.Width), CInt(R.Y + Curve / 2), CInt(R.X + R.Width), CInt(R.Y + R.Height - Curve / 2))
  71.             G.DrawLine(P, CInt(R.X + Curve / 2), CInt(R.Y + R.Height), CInt(R.X + R.Width - Curve / 2), CInt(R.Y + R.Height))
  72.             G.DrawArc(P, R.X, R.Y + R.Height - Curve, Curve, Curve, 90, 90)
  73.             G.DrawArc(P, R.X + R.Width - Curve, R.Y + R.Height - Curve, Curve, Curve, 0, 90)
  74.         End Using
  75.  
  76.     End Sub
  77.  
  78.     Public Sub CenterStringTab(G As Graphics, text As String, font As Font, brush As Brush, rect As Rectangle, Optional shadow As Boolean = False, Optional yOffset As Integer = 0)
  79.  
  80.         Dim textSize As SizeF = G.MeasureString(text, font)
  81.         Dim textX As Integer = rect.X + (rect.Width / 2) - (textSize.Width / 2)
  82.         Dim textY As Integer = rect.Y + (rect.Height / 2) - (textSize.Height / 2) + yOffset
  83.  
  84.         If shadow Then G.DrawString(text, font, Brushes.Black, textX + 1, textY + 1)
  85.         G.DrawString(text, font, brush, textX, textY + 1)
  86.  
  87.     End Sub
  88.  
  89. End Module
  90.  
  91.  
  92. <DefaultEvent("CheckedChanged")>
  93. Class FirefoxRadioButton
  94.     Inherits Control
  95.  
  96. #Region " Public "
  97.     Public Event CheckedChanged(sender As Object, e As EventArgs)
  98. #End Region
  99.  
  100. #Region " Private "
  101.     Private State As MouseState
  102.     Private ETC As Color = Nothing
  103.     Private G As Graphics
  104.  
  105.     Private _EnabledCalc As Boolean
  106.     Private _Checked As Boolean
  107.     Private _Bold As Boolean
  108. #End Region
  109.  
  110. #Region " Properties "
  111.  
  112.     Public Property Checked As Boolean
  113.         Get
  114.             Return _Checked
  115.         End Get
  116.         Set(value As Boolean)
  117.             _Checked = value
  118.             Invalidate()
  119.         End Set
  120.     End Property
  121.  
  122.     Public Shadows Property Enabled As Boolean
  123.         Get
  124.             Return EnabledCalc
  125.         End Get
  126.         Set(value As Boolean)
  127.             _EnabledCalc = value
  128.             Invalidate()
  129.         End Set
  130.     End Property
  131.  
  132.     <DisplayName("Enabled")>
  133.     Public Property EnabledCalc As Boolean
  134.         Get
  135.             Return _EnabledCalc
  136.         End Get
  137.         Set(value As Boolean)
  138.             Enabled = value
  139.             Invalidate()
  140.         End Set
  141.     End Property
  142.  
  143.     Public Property Bold As Boolean
  144.         Get
  145.             Return _Bold
  146.         End Get
  147.         Set(value As Boolean)
  148.             _Bold = value
  149.             Invalidate()
  150.         End Set
  151.     End Property
  152.  
  153. #End Region
  154.  
  155. #Region " Control "
  156.  
  157.     Sub New()
  158.         DoubleBuffered = True
  159.         ForeColor = Color.FromArgb(66, 78, 90)
  160.         Font = GlobalFont(FontStyle.Regular, 10)
  161.         Size = New Size(160, 27)
  162.         Enabled = True
  163.     End Sub
  164.  
  165.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  166.  
  167.         G = e.Graphics
  168.         G.SmoothingMode = SmoothingMode.HighQuality
  169.         G.TextRenderingHint = TextRenderingHint.ClearTypeGridFit
  170.  
  171.         MyBase.OnPaint(e)
  172.  
  173.         G.Clear(Parent.BackColor)
  174.  
  175.         If Enabled Then
  176.             ETC = Color.FromArgb(66, 78, 90)
  177.  
  178.             Select Case State
  179.  
  180.                 Case MouseState.Over, MouseState.Down
  181.  
  182.                     Using P As New Pen(Color.FromArgb(34, 146, 208))
  183.                         G.DrawEllipse(P, New Rectangle(2, 2, 22, 22))
  184.                     End Using
  185.  
  186.                 Case Else
  187.  
  188.                     Using P As New Pen(GreyColor(190))
  189.                         G.DrawEllipse(P, New Rectangle(2, 2, 22, 22))
  190.                     End Using
  191.  
  192.             End Select
  193.  
  194.             If Checked Then
  195.  
  196.                 Using B As New SolidBrush(Color.FromArgb(34, 146, 208))
  197.                     G.FillEllipse(B, New Rectangle(7, 7, 12, 12))
  198.                 End Using
  199.  
  200.             End If
  201.  
  202.         Else
  203.             ETC = GreyColor(170)
  204.  
  205.             Using P As New Pen(GreyColor(210))
  206.                 G.DrawEllipse(P, New Rectangle(2, 2, 22, 22))
  207.             End Using
  208.  
  209.             If Checked Then
  210.  
  211.                 Using B As New SolidBrush(Color.FromArgb(34, 146, 208))
  212.                     G.FillEllipse(B, New Rectangle(7, 7, 12, 12))
  213.                 End Using
  214.  
  215.             End If
  216.  
  217.         End If
  218.  
  219.         Using B As New SolidBrush(ETC)
  220.  
  221.             If Bold Then
  222.                 G.DrawString(Text, GlobalFont(FontStyle.Bold, 10), B, New Point(32, 4))
  223.             Else
  224.                 G.DrawString(Text, GlobalFont(FontStyle.Regular, 10), B, New Point(32, 4))
  225.             End If
  226.  
  227.         End Using
  228.  
  229.  
  230.     End Sub
  231.  
  232.     Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
  233.         MyBase.OnMouseDown(e)
  234.         State = MouseState.Down : Invalidate()
  235.     End Sub
  236.  
  237.     Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
  238.         MyBase.OnMouseUp(e)
  239.  
  240.         If Enabled Then
  241.  
  242.             If Not Checked Then
  243.  
  244.                 For Each C As Control In Parent.Controls
  245.                     If TypeOf C Is FirefoxRadioButton Then
  246.                         DirectCast(C, FirefoxRadioButton).Checked = False
  247.                     End If
  248.                 Next
  249.  
  250.             End If
  251.  
  252.             Checked = True
  253.             RaiseEvent CheckedChanged(Me, e)
  254.         End If
  255.  
  256.         State = MouseState.Over : Invalidate()
  257.     End Sub
  258.  
  259.     Protected Overrides Sub OnMouseEnter(e As EventArgs)
  260.         MyBase.OnMouseEnter(e)
  261.         State = MouseState.Over : Invalidate()
  262.     End Sub
  263.  
  264.     Protected Overrides Sub OnMouseLeave(e As EventArgs)
  265.         MyBase.OnMouseLeave(e)
  266.         State = MouseState.None : Invalidate()
  267.     End Sub
  268.  
  269. #End Region
  270.  
  271. End Class
  272.  
  273. <DefaultEvent("CheckedChanged")>
  274. Class FirefoxCheckBox
  275.     Inherits Control
  276.  
  277. #Region " Public "
  278.     Public Event CheckedChanged(sender As Object, e As EventArgs)
  279. #End Region
  280.  
  281. #Region " Private "
  282.     Private State As MouseState
  283.     Private ETC As Color = Nothing
  284.     Private G As Graphics
  285.  
  286.     Private _EnabledCalc As Boolean
  287.     Private _Checked As Boolean
  288.     Private _Bold As Boolean
  289. #End Region
  290.  
  291. #Region " Properties "
  292.  
  293.     Public Property Checked As Boolean
  294.         Get
  295.             Return _Checked
  296.         End Get
  297.         Set(value As Boolean)
  298.             _Checked = value
  299.             Invalidate()
  300.         End Set
  301.     End Property
  302.  
  303.     Public Shadows Property Enabled As Boolean
  304.         Get
  305.             Return EnabledCalc
  306.         End Get
  307.         Set(value As Boolean)
  308.             _EnabledCalc = value
  309.             Invalidate()
  310.         End Set
  311.     End Property
  312.  
  313.     <DisplayName("Enabled")>
  314.     Public Property EnabledCalc As Boolean
  315.         Get
  316.             Return _EnabledCalc
  317.         End Get
  318.         Set(value As Boolean)
  319.             Enabled = value
  320.             Invalidate()
  321.         End Set
  322.     End Property
  323.  
  324.     Public Property Bold As Boolean
  325.         Get
  326.             Return _Bold
  327.         End Get
  328.         Set(value As Boolean)
  329.             _Bold = value
  330.             Invalidate()
  331.         End Set
  332.     End Property
  333.  
  334. #End Region
  335.  
  336. #Region " Control "
  337.  
  338.     Sub New()
  339.         DoubleBuffered = True
  340.         ForeColor = Color.FromArgb(66, 78, 90)
  341.         Font = GlobalFont(FontStyle.Regular, 10)
  342.         Size = New Size(160, 27)
  343.         Enabled = True
  344.     End Sub
  345.  
  346.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  347.  
  348.         G = e.Graphics
  349.         G.SmoothingMode = SmoothingMode.HighQuality
  350.         G.TextRenderingHint = TextRenderingHint.ClearTypeGridFit
  351.  
  352.         MyBase.OnPaint(e)
  353.  
  354.         G.Clear(Parent.BackColor)
  355.  
  356.         If Enabled Then
  357.             ETC = Color.FromArgb(66, 78, 90)
  358.  
  359.             Select Case State
  360.  
  361.                 Case MouseState.Over, MouseState.Down
  362.                     DrawRoundRect(G, New Rectangle(3, 3, 20, 20), 3, Color.FromArgb(44, 156, 218))
  363.  
  364.                 Case Else
  365.                     DrawRoundRect(G, New Rectangle(3, 3, 20, 20), 3, GreyColor(200))
  366.  
  367.             End Select
  368.  
  369.             If Checked Then
  370.  
  371.                 Using I As Image = Image.FromStream(New IO.MemoryStream(Convert.FromBase64String(GetCheckMark)))
  372.                     G.DrawImage(I, New Point(4, 5))
  373.                 End Using
  374.  
  375.             End If
  376.  
  377.         Else
  378.  
  379.             ETC = GreyColor(170)
  380.             DrawRoundRect(G, New Rectangle(3, 3, 20, 20), 3, GreyColor(220))
  381.  
  382.             If Checked Then
  383.  
  384.                 Using I As Image = Image.FromStream(New IO.MemoryStream(Convert.FromBase64String(GetCheckMark)))
  385.                     G.DrawImage(I, New Point(4, 5))
  386.                 End Using
  387.  
  388.             End If
  389.  
  390.         End If
  391.  
  392.  
  393.         Using B As New SolidBrush(ETC)
  394.  
  395.             If Bold Then
  396.                 G.DrawString(Text, GlobalFont(FontStyle.Bold, 10), B, New Point(32, 4))
  397.             Else
  398.                 G.DrawString(Text, GlobalFont(FontStyle.Regular, 10), B, New Point(32, 4))
  399.             End If
  400.  
  401.         End Using
  402.  
  403.  
  404.     End Sub
  405.  
  406.     Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
  407.         MyBase.OnMouseDown(e)
  408.         State = MouseState.Down : Invalidate()
  409.     End Sub
  410.  
  411.     Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
  412.         MyBase.OnMouseUp(e)
  413.  
  414.         If Enabled Then
  415.             Checked = Not Checked
  416.             RaiseEvent CheckedChanged(Me, e)
  417.         End If
  418.  
  419.         State = MouseState.Over : Invalidate()
  420.     End Sub
  421.  
  422.     Protected Overrides Sub OnMouseEnter(e As EventArgs)
  423.         MyBase.OnMouseEnter(e)
  424.         State = MouseState.Over : Invalidate()
  425.     End Sub
  426.  
  427.     Protected Overrides Sub OnMouseLeave(e As EventArgs)
  428.         MyBase.OnMouseLeave(e)
  429.         State = MouseState.None : Invalidate()
  430.     End Sub
  431.  
  432. #End Region
  433.  
  434. End Class
  435.  
  436. Class FirefoxH1
  437.     Inherits Label
  438.  
  439. #Region " Private "
  440.     Private G As Graphics
  441. #End Region
  442.  
  443. #Region " Control "
  444.  
  445.     Sub New()
  446.         DoubleBuffered = True
  447.         AutoSize = False
  448.         Font = New Font("Segoe UI Semibold", 20)
  449.         ForeColor = Color.FromArgb(76, 88, 100)
  450.     End Sub
  451.  
  452.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  453.  
  454.         G = e.Graphics
  455.         G.SmoothingMode = SmoothingMode.HighQuality
  456.         G.TextRenderingHint = TextRenderingHint.ClearTypeGridFit
  457.  
  458.         MyBase.OnPaint(e)
  459.  
  460.         Using P As New Pen(GreyColor(200))
  461.             G.DrawLine(P, New Point(0, 50), New Point(Width, 50))
  462.         End Using
  463.  
  464.     End Sub
  465.  
  466. #End Region
  467.  
  468. End Class
  469.  
  470. Class FirefoxH2
  471.     Inherits Label
  472.  
  473. #Region " Control "
  474.  
  475.     Sub New()
  476.         Font = GlobalFont(FontStyle.Bold, 10)
  477.         ForeColor = Color.FromArgb(76, 88, 100)
  478.         BackColor = Color.White
  479.     End Sub
  480.  
  481. #End Region
  482.  
  483. End Class
  484.  
  485. Class FirefoxButton
  486.     Inherits Control
  487.  
  488. #Region " Private "
  489.     Private State As MouseState
  490.     Private ETC As Color = Nothing
  491.     Private G As Graphics
  492.  
  493.     Private _EnabledCalc As Boolean
  494. #End Region
  495.  
  496. #Region " Properties "
  497.  
  498.     Public Shadows Property Enabled As Boolean
  499.         Get
  500.             Return EnabledCalc
  501.         End Get
  502.         Set(value As Boolean)
  503.             _EnabledCalc = value
  504.             Invalidate()
  505.         End Set
  506.     End Property
  507.  
  508.     <DisplayName("Enabled")>
  509.     Public Property EnabledCalc As Boolean
  510.         Get
  511.             Return _EnabledCalc
  512.         End Get
  513.         Set(value As Boolean)
  514.             Enabled = value
  515.             Invalidate()
  516.         End Set
  517.     End Property
  518.  
  519. #End Region
  520.  
  521. #Region " Control "
  522.  
  523.     Sub New()
  524.         DoubleBuffered = True
  525.         Enabled = True
  526.         ForeColor = Color.FromArgb(56, 68, 80)
  527.         Font = GlobalFont(FontStyle.Regular, 10)
  528.     End Sub
  529.  
  530.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  531.  
  532.         G = e.Graphics
  533.         G.SmoothingMode = SmoothingMode.HighQuality
  534.         G.TextRenderingHint = TextRenderingHint.ClearTypeGridFit
  535.  
  536.         MyBase.OnPaint(e)
  537.  
  538.         G.Clear(Parent.BackColor)
  539.  
  540.         If Enabled Then
  541.             ETC = Color.FromArgb(56, 68, 80)
  542.  
  543.             Select Case State
  544.  
  545.                 Case MouseState.None
  546.  
  547.                     Using B As New SolidBrush(GreyColor(245))
  548.                         G.FillRectangle(B, New Rectangle(1, 1, Width - 2, Height - 2))
  549.                     End Using
  550.  
  551.                     DrawRoundRect(G, FullRectangle(Size, True), 2, GreyColor(193))
  552.  
  553.                 Case MouseState.Over
  554.  
  555.                     Using B As New SolidBrush(GreyColor(232))
  556.                         G.FillRectangle(B, New Rectangle(1, 1, Width - 2, Height - 2))
  557.                     End Using
  558.  
  559.                     DrawRoundRect(G, FullRectangle(Size, True), 2, GreyColor(193))
  560.  
  561.                 Case Else
  562.  
  563.                     Using B As New SolidBrush(GreyColor(212))
  564.                         G.FillRectangle(B, New Rectangle(1, 1, Width - 2, Height - 2))
  565.                     End Using
  566.  
  567.                     DrawRoundRect(G, FullRectangle(Size, True), 2, GreyColor(193))
  568.  
  569.             End Select
  570.  
  571.         Else
  572.             ETC = GreyColor(170)
  573.  
  574.             Using B As New SolidBrush(GreyColor(245))
  575.                 G.FillRectangle(B, New Rectangle(1, 1, Width - 2, Height - 2))
  576.             End Using
  577.  
  578.             DrawRoundRect(G, FullRectangle(Size, True), 2, GreyColor(223))
  579.  
  580.         End If
  581.  
  582.         CenterString(G, Text, GlobalFont(FontStyle.Regular, 10), ETC, FullRectangle(Size, False))
  583.  
  584.     End Sub
  585.  
  586.     Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
  587.         MyBase.OnMouseUp(e)
  588.         State = MouseState.Over : Invalidate()
  589.     End Sub
  590.  
  591.     Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
  592.         MyBase.OnMouseUp(e)
  593.         State = MouseState.Down : Invalidate()
  594.     End Sub
  595.  
  596.     Protected Overrides Sub OnMouseEnter(e As EventArgs)
  597.         MyBase.OnMouseEnter(e)
  598.         State = MouseState.Over : Invalidate()
  599.     End Sub
  600.  
  601.     Protected Overrides Sub OnMouseLeave(e As EventArgs)
  602.         MyBase.OnMouseEnter(e)
  603.         State = MouseState.None : Invalidate()
  604.     End Sub
  605.  
  606. #End Region
  607.  
  608. End Class
  609.  
  610. Class FirefoxRedirect
  611.     Inherits Control
  612.  
  613. #Region " Private "
  614.     Private State As MouseState
  615.     Private G As Graphics
  616.  
  617.     Private FC As Color = Nothing
  618.     Private FF As Font = Nothing
  619. #End Region
  620.  
  621. #Region " Control "
  622.  
  623.     Sub New()
  624.         DoubleBuffered = True
  625.         Cursor = Cursors.Hand
  626.         BackColor = Color.White
  627.     End Sub
  628.  
  629.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  630.  
  631.         G = e.Graphics
  632.         G.SmoothingMode = SmoothingMode.HighQuality
  633.         G.TextRenderingHint = TextRenderingHint.ClearTypeGridFit
  634.  
  635.         MyBase.OnPaint(e)
  636.  
  637.         Select Case State
  638.  
  639.             Case MouseState.Over
  640.                 FC = Color.FromArgb(23, 140, 229)
  641.                 FF = GlobalFont(FontStyle.Underline, 10)
  642.  
  643.             Case MouseState.Down
  644.                 FC = Color.FromArgb(255, 149, 0)
  645.                 FF = GlobalFont(FontStyle.Regular, 10)
  646.  
  647.             Case Else
  648.                 FC = Color.FromArgb(0, 149, 221)
  649.                 FF = GlobalFont(FontStyle.Regular, 10)
  650.  
  651.         End Select
  652.  
  653.         Using B As New SolidBrush(FC)
  654.             G.DrawString(Text, FF, B, New Point(0, 0))
  655.         End Using
  656.  
  657.     End Sub
  658.  
  659.     Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
  660.         MyBase.OnMouseUp(e)
  661.         State = MouseState.Over : Invalidate()
  662.     End Sub
  663.  
  664.     Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
  665.         MyBase.OnMouseUp(e)
  666.         State = MouseState.Down : Invalidate()
  667.     End Sub
  668.  
  669.     Protected Overrides Sub OnMouseEnter(e As EventArgs)
  670.         MyBase.OnMouseEnter(e)
  671.         State = MouseState.Over : Invalidate()
  672.     End Sub
  673.  
  674.     Protected Overrides Sub OnMouseLeave(e As EventArgs)
  675.         MyBase.OnMouseEnter(e)
  676.         State = MouseState.None : Invalidate()
  677.     End Sub
  678.  
  679. #End Region
  680.  
  681. End Class
  682.  
  683. Class FirefoxSubTabControl
  684.     Inherits TabControl
  685.  
  686. #Region " Private "
  687.     Private G As Graphics
  688.     Private TabRect As Rectangle
  689. #End Region
  690.  
  691. #Region " Control "
  692.  
  693.     Sub New()
  694.         DoubleBuffered = True
  695.         Alignment = TabAlignment.Top
  696.     End Sub
  697.  
  698.     Protected Overrides Sub OnCreateControl()
  699.         MyBase.OnCreateControl()
  700.         SetStyle(ControlStyles.UserPaint, True)
  701.         ItemSize = New Size(100, 40)
  702.         SizeMode = TabSizeMode.Fixed
  703.     End Sub
  704.  
  705.     Protected Overrides Sub OnControlAdded(e As ControlEventArgs)
  706.         MyBase.OnControlAdded(e)
  707.         Try
  708.             For i As Integer = 0 To TabPages.Count - 1
  709.                 TabPages(i).BackColor = Color.White
  710.                 TabPages(i).ForeColor = Color.FromArgb(66, 79, 90)
  711.                 TabPages(i).Font = GlobalFont(FontStyle.Regular, 10)
  712.             Next
  713.         Catch
  714.         End Try
  715.     End Sub
  716.  
  717.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  718.  
  719.         G = e.Graphics
  720.         G.SmoothingMode = SmoothingMode.HighQuality
  721.         G.TextRenderingHint = TextRenderingHint.ClearTypeGridFit
  722.  
  723.         MyBase.OnPaint(e)
  724.  
  725.         G.Clear(Parent.BackColor)
  726.  
  727.         For i As Integer = 0 To TabPages.Count - 1
  728.  
  729.             TabRect = GetTabRect(i)
  730.  
  731.             If GetTabRect(i).Contains(Me.PointToClient(Cursor.Position)) And Not SelectedIndex = i Then
  732.  
  733.                 Using B As New SolidBrush(GreyColor(240))
  734.                     G.FillRectangle(B, New Rectangle(GetTabRect(i).Location.X - 2, GetTabRect(i).Location.Y - 2, GetTabRect(i).Width, GetTabRect(i).Height + 1))
  735.                 End Using
  736.  
  737.             ElseIf SelectedIndex = i
  738.  
  739.                 Using B As New SolidBrush(GreyColor(240))
  740.                     G.FillRectangle(B, New Rectangle(GetTabRect(i).Location.X - 2, GetTabRect(i).Location.Y - 2, GetTabRect(i).Width, GetTabRect(i).Height + 1))
  741.                 End Using
  742.  
  743.                 Using P As New Pen(Color.FromArgb(255, 149, 0), 4)
  744.                     G.DrawLine(P, New Point(TabRect.X - 2, TabRect.Y + ItemSize.Height - 2), New Point(TabRect.X + TabRect.Width - 2, TabRect.Y + ItemSize.Height - 2))
  745.                 End Using
  746.  
  747.             ElseIf Not SelectedIndex = i
  748.                 G.FillRectangle(Brushes.White, GetTabRect(i))
  749.             End If
  750.  
  751.             Using B As New SolidBrush(Color.FromArgb(56, 69, 80))
  752.                 CenterStringTab(G, TabPages(i).Text, GlobalFont(FontStyle.Regular, 10), B, GetTabRect(i))
  753.             End Using
  754.  
  755.         Next
  756.  
  757.         Using P As New Pen(GreyColor(200))
  758.             G.DrawLine(P, New Point(0, ItemSize.Height + 2), New Point(Width, ItemSize.Height + 2))
  759.         End Using
  760.  
  761.     End Sub
  762.  
  763. #End Region
  764.  
  765. End Class
  766.  
  767. Class FirefoxMainTabControl
  768.     Inherits TabControl
  769.  
  770. #Region " Private "
  771.     Private G As Graphics
  772.     Private TabRect As Rectangle
  773.     Private FC As Color = Nothing
  774. #End Region
  775.  
  776. #Region " Control "
  777.  
  778.     Sub New()
  779.         DoubleBuffered = True
  780.         ItemSize = New Size(43, 152)
  781.         Alignment = TabAlignment.Left
  782.         SizeMode = TabSizeMode.Fixed
  783.     End Sub
  784.  
  785.     Protected Overrides Sub OnCreateControl()
  786.         MyBase.OnCreateControl()
  787.         SetStyle(ControlStyles.UserPaint, True)
  788.     End Sub
  789.  
  790.     Protected Overrides Sub OnControlAdded(e As ControlEventArgs)
  791.         MyBase.OnControlAdded(e)
  792.         Try
  793.             For i As Integer = 0 To TabPages.Count - 1
  794.                 TabPages(i).BackColor = Color.White
  795.                 TabPages(i).ForeColor = Color.FromArgb(66, 79, 90)
  796.                 TabPages(i).Font = GlobalFont(FontStyle.Regular, 10)
  797.             Next
  798.         Catch
  799.         End Try
  800.     End Sub
  801.  
  802.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  803.  
  804.         G = e.Graphics
  805.         G.SmoothingMode = SmoothingMode.HighQuality
  806.         G.TextRenderingHint = TextRenderingHint.ClearTypeGridFit
  807.  
  808.         MyBase.OnPaint(e)
  809.  
  810.         G.Clear(Color.FromArgb(66, 79, 90))
  811.  
  812.         For i As Integer = 0 To TabPages.Count - 1
  813.  
  814.             TabRect = GetTabRect(i)
  815.  
  816.             If SelectedIndex = i Then
  817.  
  818.                 Using B As New SolidBrush(Color.FromArgb(52, 63, 72))
  819.                     G.FillRectangle(B, TabRect)
  820.                 End Using
  821.  
  822.                 FC = GreyColor(245)
  823.  
  824.                 Using B As New SolidBrush(Color.FromArgb(255, 175, 54))
  825.                     G.FillRectangle(B, New Rectangle(TabRect.Location.X - 3, TabRect.Location.Y + 1, 5, TabRect.Height - 2))
  826.                 End Using
  827.  
  828.             Else
  829.                 FC = GreyColor(192)
  830.  
  831.                 Using B As New SolidBrush(Color.FromArgb(66, 79, 90))
  832.                     G.FillRectangle(B, TabRect)
  833.                 End Using
  834.  
  835.             End If
  836.  
  837.             Using B As New SolidBrush(FC)
  838.                 G.DrawString(TabPages(i).Text, GlobalFont(FontStyle.Regular, 10), B, New Point(TabRect.X + 50, TabRect.Y + 12))
  839.             End Using
  840.  
  841.             If Not IsNothing(ImageList) Then
  842.                 If Not TabPages(i).ImageIndex < 0 Then
  843.                     G.DrawImage(ImageList.Images(TabPages(i).ImageIndex), New Rectangle(TabRect.X + 19, TabRect.Y + ((TabRect.Height / 2) - 10), 18, 18))
  844.                 End If
  845.             End If
  846.  
  847.         Next
  848.  
  849.     End Sub
  850.  
  851. #End Region
  852.  
  853. End Class
  854.  
  855. <DefaultEvent("TextChanged")>
  856. Class FirefoxTextbox
  857.     Inherits Control
  858. ' Get more free themes at ThemesVB.NET
  859. #Region " Private "
  860.     Private WithEvents TB As New TextBox
  861.     Private G As Graphics
  862.     Private State As MouseState
  863.     Private IsDown As Boolean
  864.  
  865.     Private _EnabledCalc As Boolean
  866.     Private _allowpassword As Boolean = False
  867.     Private _maxChars As Integer = 32767
  868.     Private _textAlignment As HorizontalAlignment
  869.     Private _multiLine As Boolean = False
  870.     Private _readOnly As Boolean = False
  871. #End Region
  872.  
  873. #Region " Properties "
  874.  
  875.     Public Shadows Property Enabled As Boolean
  876.         Get
  877.             Return EnabledCalc
  878.         End Get
  879.         Set(value As Boolean)
  880.             TB.Enabled = value
  881.             _EnabledCalc = value
  882.             Invalidate()
  883.         End Set
  884.     End Property
  885.  
  886.     <DisplayName("Enabled")>
  887.     Public Property EnabledCalc As Boolean
  888.         Get
  889.             Return _EnabledCalc
  890.         End Get
  891.         Set(value As Boolean)
  892.             Enabled = value
  893.             Invalidate()
  894.         End Set
  895.     End Property
  896.  
  897.     Public Shadows Property UseSystemPasswordChar() As Boolean
  898.         Get
  899.             Return _allowpassword
  900.         End Get
  901.         Set(ByVal value As Boolean)
  902.             TB.UseSystemPasswordChar = UseSystemPasswordChar
  903.             _allowpassword = value
  904.             Invalidate()
  905.         End Set
  906.     End Property
  907.  
  908.     Public Shadows Property MaxLength() As Integer
  909.         Get
  910.             Return _maxChars
  911.         End Get
  912.         Set(ByVal value As Integer)
  913.             _maxChars = value
  914.             TB.MaxLength = MaxLength
  915.             Invalidate()
  916.         End Set
  917.     End Property
  918.  
  919.     Public Shadows Property TextAlign() As HorizontalAlignment
  920.         Get
  921.             Return _textAlignment
  922.         End Get
  923.         Set(ByVal value As HorizontalAlignment)
  924.             _textAlignment = value
  925.             Invalidate()
  926.         End Set
  927.     End Property
  928.  
  929.     Public Shadows Property MultiLine() As Boolean
  930.         Get
  931.             Return _multiLine
  932.         End Get
  933.         Set(ByVal value As Boolean)
  934.             _multiLine = value
  935.             TB.Multiline = value
  936.             OnResize(EventArgs.Empty)
  937.             Invalidate()
  938.         End Set
  939.     End Property
  940.  
  941.     Public Shadows Property [ReadOnly]() As Boolean
  942.         Get
  943.             Return _readOnly
  944.         End Get
  945.         Set(ByVal value As Boolean)
  946.             _readOnly = value
  947.             If TB IsNot Nothing Then
  948.                 TB.ReadOnly = value
  949.             End If
  950.         End Set
  951.     End Property
  952.  
  953. #End Region
  954.  
  955. #Region " Control "
  956.  
  957.     Protected Overrides Sub OnTextChanged(ByVal e As EventArgs)
  958.         MyBase.OnTextChanged(e)
  959.         Invalidate()
  960.     End Sub
  961.  
  962.     Protected Overrides Sub OnBackColorChanged(ByVal e As EventArgs)
  963.         MyBase.OnBackColorChanged(e)
  964.         Invalidate()
  965.     End Sub
  966.  
  967.     Protected Overrides Sub OnForeColorChanged(ByVal e As EventArgs)
  968.         MyBase.OnForeColorChanged(e)
  969.         TB.ForeColor = ForeColor
  970.         Invalidate()
  971.     End Sub
  972.  
  973.     Protected Overrides Sub OnFontChanged(ByVal e As EventArgs)
  974.         MyBase.OnFontChanged(e)
  975.         TB.Font = Font
  976.     End Sub
  977.  
  978.     Protected Overrides Sub OnGotFocus(ByVal e As EventArgs)
  979.         MyBase.OnGotFocus(e)
  980.         TB.Focus()
  981.     End Sub
  982.  
  983.     Private Sub TextChangeTb() Handles TB.TextChanged
  984.         Text = TB.Text
  985.     End Sub
  986.  
  987.     Private Sub TextChng() Handles MyBase.TextChanged
  988.         TB.Text = Text
  989.     End Sub
  990.  
  991.     Public Sub NewTextBox()
  992.         With TB
  993.             .Text = String.Empty
  994.             .BackColor = Color.White
  995.             .ForeColor = Color.FromArgb(66, 78, 90)
  996.             .TextAlign = HorizontalAlignment.Left
  997.             .BorderStyle = BorderStyle.None
  998.             .Location = New Point(3, 3)
  999.             .Font = GlobalFont(FontStyle.Regular, 10)
  1000.             .Size = New Size(Width - 3, Height - 3)
  1001.             .UseSystemPasswordChar = UseSystemPasswordChar
  1002.         End With
  1003.     End Sub
  1004.  
  1005.     Sub New()
  1006.         MyBase.New()
  1007.         NewTextBox()
  1008.         Controls.Add(TB)
  1009.         SetStyle(ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  1010.         DoubleBuffered = True
  1011.         TextAlign = HorizontalAlignment.Left
  1012.         ForeColor = Color.FromArgb(66, 78, 90)
  1013.         Font = GlobalFont(FontStyle.Regular, 10)
  1014.         Size = New Size(130, 29)
  1015.         Enabled = True
  1016.     End Sub
  1017.  
  1018.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  1019.  
  1020.         G = e.Graphics
  1021.         G.SmoothingMode = SmoothingMode.HighQuality
  1022.         G.TextRenderingHint = TextRenderingHint.ClearTypeGridFit
  1023.  
  1024.         MyBase.OnPaint(e)
  1025.  
  1026.         G.Clear(Parent.BackColor)
  1027.  
  1028.         If Enabled Then
  1029.  
  1030.             TB.ForeColor = Color.FromArgb(66, 78, 90)
  1031.  
  1032.             If State = MouseState.Down Then
  1033.                 DrawRoundRect(G, FullRectangle(Size, True), 3, Color.FromArgb(44, 156, 218))
  1034.             Else
  1035.                 DrawRoundRect(G, FullRectangle(Size, True), 3, GreyColor(200))
  1036.             End If
  1037.  
  1038.         Else
  1039.             TB.ForeColor = GreyColor(170)
  1040.             DrawRoundRect(G, FullRectangle(Size, True), 3, GreyColor(230))
  1041.         End If
  1042.  
  1043.         TB.TextAlign = TextAlign
  1044.         TB.UseSystemPasswordChar = UseSystemPasswordChar
  1045.  
  1046.     End Sub
  1047.  
  1048.     Protected Overrides Sub OnResize(e As EventArgs)
  1049.         MyBase.OnResize(e)
  1050.         If Not MultiLine Then
  1051.             Dim tbheight As Integer = TB.Height
  1052.             TB.Location = New Point(10, CType(((Height / 2) - (tbheight / 2) - 0), Integer))
  1053.             TB.Size = New Size(Width - 20, tbheight)
  1054.         Else
  1055.             TB.Location = New Point(10, 10)
  1056.             TB.Size = New Size(Width - 20, Height - 20)
  1057.         End If
  1058.     End Sub
  1059.  
  1060.     Protected Overrides Sub OnEnter(e As EventArgs)
  1061.         MyBase.OnEnter(e)
  1062.         State = MouseState.Down : Invalidate()
  1063.     End Sub
  1064.  
  1065.     Protected Overrides Sub OnLeave(e As EventArgs)
  1066.         MyBase.OnLeave(e)
  1067.         State = MouseState.None : Invalidate()
  1068.     End Sub
  1069.  
  1070. #End Region
  1071.  
  1072. End Class
  1073.  
  1074. Class FirefoxNumericUpDown
  1075.     Inherits Control
  1076.  
  1077. #Region " Private "
  1078.     Private G As Graphics
  1079.     Private _Value As Integer
  1080.     Private _Min As Integer
  1081.     Private _Max As Integer
  1082.     Private Loc As Point
  1083.     Private Down As Boolean
  1084.     Private _EnabledCalc As Boolean
  1085.     Private ETC As Color = Nothing
  1086. #End Region
  1087.  
  1088. #Region " Properties "
  1089.  
  1090.     Public Shadows Property Enabled As Boolean
  1091.         Get
  1092.             Return EnabledCalc
  1093.         End Get
  1094.         Set(value As Boolean)
  1095.             _EnabledCalc = value
  1096.             Invalidate()
  1097.         End Set
  1098.     End Property
  1099.  
  1100.     <DisplayName("Enabled")>
  1101.     Public Property EnabledCalc As Boolean
  1102.         Get
  1103.             Return _EnabledCalc
  1104.         End Get
  1105.         Set(value As Boolean)
  1106.             Enabled = value
  1107.             Invalidate()
  1108.         End Set
  1109.     End Property
  1110.  
  1111.     Public Property Value As Integer
  1112.         Get
  1113.             Return _Value
  1114.         End Get
  1115.         Set(v As Integer)
  1116.  
  1117.             If v <= _Max And v >= Minimum Then
  1118.                 _Value = v
  1119.             End If
  1120.  
  1121.             Invalidate()
  1122.  
  1123.         End Set
  1124.     End Property
  1125.  
  1126.     Public Property Minimum As Integer
  1127.         Get
  1128.             Return _Min
  1129.         End Get
  1130.         Set(v As Integer)
  1131.  
  1132.             If v < Maximum Then
  1133.                 _Min = v
  1134.             End If
  1135.  
  1136.             If Value < Minimum Then
  1137.                 Value = Minimum
  1138.             End If
  1139.  
  1140.             Invalidate()
  1141.         End Set
  1142.     End Property
  1143.  
  1144.     Public Property Maximum As Integer
  1145.         Get
  1146.             Return _Max
  1147.         End Get
  1148.         Set(v As Integer)
  1149.  
  1150.             If v > Minimum Then
  1151.                 _Max = v
  1152.             End If
  1153.  
  1154.             If Value > Maximum Then
  1155.                 Value = Maximum
  1156.             End If
  1157.  
  1158.             Invalidate()
  1159.         End Set
  1160.     End Property
  1161.  
  1162. #End Region
  1163.  
  1164. #Region " Control "
  1165.  
  1166.     Sub New()
  1167.         DoubleBuffered = True
  1168.         Value = 0
  1169.         Minimum = 0
  1170.         Maximum = 100
  1171.         Cursor = Cursors.IBeam
  1172.         BackColor = Color.White
  1173.         ForeColor = Color.FromArgb(66, 78, 90)
  1174.         Font = GlobalFont(FontStyle.Regular, 10)
  1175.         Enabled = True
  1176.     End Sub
  1177.  
  1178.     Protected Overrides Sub OnMouseMove(e As MouseEventArgs)
  1179.         MyBase.OnMouseMove(e)
  1180.         Loc.X = e.X
  1181.         Loc.Y = e.Y
  1182.         Invalidate()
  1183.  
  1184.         If Loc.X < Width - 23 Then
  1185.             Cursor = Cursors.IBeam
  1186.         Else
  1187.             Cursor = Cursors.Default
  1188.         End If
  1189.  
  1190.     End Sub
  1191.  
  1192.     Protected Overrides Sub OnResize(ByVal e As EventArgs)
  1193.         MyBase.OnResize(e)
  1194.         Height = 30
  1195.     End Sub
  1196.  
  1197.     Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  1198.         MyBase.OnMouseClick(e)
  1199.  
  1200.         If Enabled Then
  1201.  
  1202.             If Loc.X > Width - 21 AndAlso Loc.X < Width - 3 Then
  1203.                 If Loc.Y < 15 Then
  1204.                     If (Value + 1) <= Maximum Then
  1205.                         Value += 1
  1206.                     End If
  1207.                 Else
  1208.                     If (Value - 1) >= Minimum Then
  1209.                         Value -= 1
  1210.                     End If
  1211.                 End If
  1212.             Else
  1213.                 Down = Not Down
  1214.                 Focus()
  1215.             End If
  1216.  
  1217.         End If
  1218.  
  1219.         Invalidate()
  1220.     End Sub
  1221.  
  1222.     Protected Overrides Sub OnKeyPress(ByVal e As System.Windows.Forms.KeyPressEventArgs)
  1223.         MyBase.OnKeyPress(e)
  1224.         Try
  1225.             If Down Then
  1226.                 Value = Value & e.KeyChar.ToString
  1227.             End If
  1228.  
  1229.             If Value > Maximum Then
  1230.                 Value = Maximum
  1231.             End If
  1232.  
  1233.         Catch
  1234.         End Try
  1235.     End Sub
  1236. ' Get more free themes at ThemesVB.NET
  1237.     Protected Overrides Sub OnKeyup(ByVal e As System.Windows.Forms.KeyEventArgs)
  1238.         MyBase.OnKeyUp(e)
  1239.  
  1240.         If e.KeyCode = Keys.Up Then
  1241.  
  1242.             If (Value + 1) <= Maximum Then
  1243.                 Value += 1
  1244.             End If
  1245.  
  1246.             Invalidate()
  1247.  
  1248.         ElseIf e.KeyCode = Keys.Down Then
  1249.  
  1250.             If (Value - 1) >= Minimum Then
  1251.                 Value -= 1
  1252.             End If
  1253.  
  1254.         ElseIf e.KeyCode = Keys.Back Then
  1255.             Dim BC As String = Value.ToString()
  1256.             BC = BC.Remove(Convert.ToInt32(BC.Length - 1))
  1257.  
  1258.             If (BC.Length = 0) Then
  1259.                 BC = "0"
  1260.             End If
  1261.  
  1262.             Value = Convert.ToInt32(BC)
  1263.  
  1264.         End If
  1265.  
  1266.         Invalidate()
  1267.  
  1268.     End Sub
  1269.  
  1270.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  1271.         G = e.Graphics
  1272.         G.SmoothingMode = SmoothingMode.HighQuality
  1273.         G.TextRenderingHint = TextRenderingHint.ClearTypeGridFit
  1274.  
  1275.         MyBase.OnPaint(e)
  1276.  
  1277.         G.Clear(Parent.BackColor)
  1278.  
  1279.         If Enabled Then
  1280.  
  1281.             ETC = Color.FromArgb(66, 78, 90)
  1282.  
  1283.             Using P As New Pen(GreyColor(190))
  1284.                 DrawRoundRect(G, FullRectangle(Size, True), 2, GreyColor(190))
  1285.                 G.DrawLine(P, New Point(Width - 24, 13.5F), New Point(Width - 5, 13.5F))
  1286.             End Using
  1287.  
  1288.             DrawRoundRect(G, New Rectangle(Width - 24, 4, 19, 21), 3, GreyColor(200))
  1289.  
  1290.         Else
  1291.             ETC = GreyColor(170)
  1292.  
  1293.             Using P As New Pen(GreyColor(230))
  1294.                 DrawRoundRect(G, FullRectangle(Size, True), 2, GreyColor(190))
  1295.                 G.DrawLine(P, New Point(Width - 24, 13.5F), New Point(Width - 5, 13.5F))
  1296.             End Using
  1297.  
  1298.             DrawRoundRect(G, New Rectangle(Width - 24, 4, 19, 21), 3, GreyColor(220))
  1299.  
  1300.         End If
  1301. ' Get more free themes at ThemesVB.NET
  1302.         Using B As New SolidBrush(ETC)
  1303.             G.DrawString("t", New Font("Marlett", 8, FontStyle.Bold), B, New Point(Width - 22, 5))
  1304.             G.DrawString("u", New Font("Marlett", 8, FontStyle.Bold), B, New Point(Width - 22, 13))
  1305.             CenterString(G, Value, New Font("Segoe UI", 10), ETC, New Rectangle(Width / 2 - 10, 0, Width - 5, Height))
  1306.         End Using
  1307.  
  1308.     End Sub
  1309.  
  1310. #End Region
  1311.  
  1312. End Class
Add Comment
Please, Sign In to add comment