Advertisement
Guest User

Firefox Theme : AeroRev9 [29/07 (2)]

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