Guest User

Aether Theme

a guest
Oct 7th, 2015
4,171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 33.30 KB | None | 0 0
  1. ' Aether Theme made by AeroRev9
  2. ' 07/10/2015.
  3.  
  4. Module Helpers
  5.  
  6.     Public Enum MouseState As Byte
  7.         None = 0
  8.         Over = 1
  9.         Down = 2
  10.     End Enum
  11.  
  12.     Public Function FullRectangle(S As Size, Subtract As Boolean) As Rectangle
  13.         If Subtract Then
  14.             Return New Rectangle(0, 0, S.Width - 1, S.Height - 1)
  15.         Else
  16.             Return New Rectangle(0, 0, S.Width, S.Height)
  17.         End If
  18.     End Function
  19.  
  20.     Public Function GreyColor(G As UInteger) As Color
  21.         Return Color.FromArgb(G, G, G)
  22.     End Function
  23.  
  24.     Public Sub CenterString(G As Graphics, T As String, F As Font, C As Color, R As Rectangle)
  25.         Dim TS As SizeF = G.MeasureString(T, F)
  26.  
  27.         Using B As New SolidBrush(C)
  28.             G.DrawString(T, F, B, New Point(R.Width / 2 - (TS.Width / 2), R.Height / 2 - (TS.Height / 2)))
  29.         End Using
  30.  
  31.     End Sub
  32.  
  33.     Public Sub FillRoundRect(G As Graphics, R As Rectangle, Curve As Integer, B As Brush)
  34.         G.FillPie(B, R.X, R.Y, Curve, Curve, 180, 90)
  35.         G.FillPie(B, R.X + R.Width - Curve, R.Y, Curve, Curve, 270, 90)
  36.         G.FillPie(B, R.X, R.Y + R.Height - Curve, Curve, Curve, 90, 90)
  37.         G.FillPie(B, R.X + R.Width - Curve, R.Y + R.Height - Curve, Curve, Curve, 0, 90)
  38.         G.FillRectangle(B, CInt(R.X + Curve / 2), R.Y, R.Width - Curve, CInt(Curve / 2))
  39.         G.FillRectangle(B, R.X, CInt(R.Y + Curve / 2), R.Width, R.Height - Curve)
  40.         G.FillRectangle(B, CInt(R.X + Curve / 2), CInt(R.Y + R.Height - Curve / 2), R.Width - Curve, CInt(Curve / 2))
  41.     End Sub
  42.  
  43.     Public Sub DrawRoundRect(G As Graphics, R As Rectangle, Curve As Integer, PP As Pen)
  44.         G.DrawArc(PP, R.X, R.Y, Curve, Curve, 180, 90)
  45.         G.DrawLine(PP, CInt(R.X + Curve / 2), R.Y, CInt(R.X + R.Width - Curve / 2), R.Y)
  46.         G.DrawArc(PP, R.X + R.Width - Curve, R.Y, Curve, Curve, 270, 90)
  47.         G.DrawLine(PP, R.X, CInt(R.Y + Curve / 2), R.X, CInt(R.Y + R.Height - Curve / 2))
  48.         G.DrawLine(PP, CInt(R.X + R.Width), CInt(R.Y + Curve / 2), CInt(R.X + R.Width), CInt(R.Y + R.Height - Curve / 2))
  49.         G.DrawLine(PP, CInt(R.X + Curve / 2), CInt(R.Y + R.Height), CInt(R.X + R.Width - Curve / 2), CInt(R.Y + R.Height))
  50.         G.DrawArc(PP, R.X, R.Y + R.Height - Curve, Curve, Curve, 90, 90)
  51.         G.DrawArc(PP, R.X + R.Width - Curve, R.Y + R.Height - Curve, Curve, Curve, 0, 90)
  52.     End Sub
  53.  
  54.     Public Enum Direction As Byte
  55.         Up = 0
  56.         Down = 1
  57.         Left = 2
  58.         Right = 3
  59.     End Enum
  60.  
  61.     Public Sub DrawTriangle(G As Graphics, Rect As Rectangle, D As Direction, C As Color)
  62.         Dim halfWidth As Integer = Rect.Width / 2
  63.         Dim halfHeight As Integer = Rect.Height / 2
  64.         Dim p0 As Point = Point.Empty
  65.         Dim p1 As Point = Point.Empty
  66.         Dim p2 As Point = Point.Empty
  67.  
  68.         Select Case D
  69.             Case Direction.Up
  70.                 p0 = New Point(Rect.Left + halfWidth, Rect.Top)
  71.                 p1 = New Point(Rect.Left, Rect.Bottom)
  72.                 p2 = New Point(Rect.Right, Rect.Bottom)
  73.  
  74.             Case Direction.Down
  75.                 p0 = New Point(Rect.Left + halfWidth, Rect.Bottom)
  76.                 p1 = New Point(Rect.Left, Rect.Top)
  77.                 p2 = New Point(Rect.Right, Rect.Top)
  78.  
  79.             Case Direction.Left
  80.                 p0 = New Point(Rect.Left, Rect.Top + halfHeight)
  81.                 p1 = New Point(Rect.Right, Rect.Top)
  82.                 p2 = New Point(Rect.Right, Rect.Bottom)
  83.  
  84.             Case Direction.Right
  85.                 p0 = New Point(Rect.Right, Rect.Top + halfHeight)
  86.                 p1 = New Point(Rect.Left, Rect.Bottom)
  87.                 p2 = New Point(Rect.Left, Rect.Top)
  88.  
  89.         End Select
  90.  
  91.         Using B As New SolidBrush(C)
  92.             G.FillPolygon(B, New Point() {p0, p1, p2})
  93.         End Using
  94.  
  95.     End Sub
  96.  
  97.     Public Function ColorFromHex(Hex As String) As Color
  98.         Dim R, G, B As String
  99.         Hex = Replace(Hex, "#", "")
  100.         R = Val("&H" & Mid(Hex, 1, 2))
  101.         G = Val("&H" & Mid(Hex, 3, 2))
  102.         B = Val("&H" & Mid(Hex, 5, 2))
  103.         Return Color.FromArgb(R, G, B)
  104.     End Function
  105.  
  106. End Module
  107.  
  108. Public Class AetherTabControl
  109.     Inherits TabControl
  110.  
  111.     Private G As Graphics
  112.     Private Rect As Rectangle
  113.     Private MS1 As SizeF
  114.     Private MS2 As SizeF
  115.  
  116.     Public Property UpperText As Boolean = True
  117.  
  118.     Sub New()
  119.         DoubleBuffered = True
  120.         Alignment = TabAlignment.Left
  121.         SizeMode = TabSizeMode.Fixed
  122.         ItemSize = New Size(40, 190)
  123.         Dock = DockStyle.Fill
  124.     End Sub
  125.  
  126.     Protected Overrides Sub OnCreateControl()
  127.         MyBase.OnCreateControl()
  128.         SetStyle(ControlStyles.UserPaint, True)
  129.     End Sub
  130.  
  131.     Protected Overrides Sub OnControlAdded(e As ControlEventArgs)
  132.         MyBase.OnControlAdded(e)
  133.         e.Control.BackColor = Color.White
  134.         e.Control.ForeColor = ColorFromHex("#343843")
  135.  
  136.         Using F1 As New Font("Segoe UI", 9)
  137.             e.Control.Font = F1
  138.         End Using
  139.  
  140.     End Sub
  141.  
  142.     Protected Overrides ReadOnly Property CreateParams() As CreateParams
  143.         Get
  144.             Dim cp As CreateParams = MyBase.CreateParams
  145.             cp.ExStyle = cp.ExStyle Or &H2000000
  146.             Return cp
  147.         End Get
  148.     End Property
  149.  
  150.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  151.  
  152.         G = e.Graphics
  153.         G.SmoothingMode = Drawing2D.SmoothingMode.HighQuality
  154.         G.TextRenderingHint = Drawing.Text.TextRenderingHint.ClearTypeGridFit
  155.  
  156.         MyBase.OnPaint(e)
  157.  
  158.         G.Clear(ColorFromHex("#343843"))
  159.  
  160.         For I As Integer = 0 To TabPages.Count - 1
  161.  
  162.             Rect = GetTabRect(I)
  163.  
  164.             If SelectedIndex = I Then
  165.  
  166.                 Using B1 As New SolidBrush(ColorFromHex("#3A3E49"))
  167.                     G.FillRectangle(B1, New Rectangle(Rect.X - 4, Rect.Y + 1, Rect.Width + 6, Rect.Height))
  168.                 End Using
  169.  
  170.             End If
  171.  
  172.             Using B1 As New SolidBrush(ColorFromHex("#737A8A"))
  173.  
  174.                 If UpperText Then
  175.  
  176.                     Using F1 As New Font("Segoe UI", 7.75, FontStyle.Bold)
  177.                         G.DrawString(TabPages(I).Text.ToUpper, F1, B1, New Point(Rect.X + 50, Rect.Y + 13))
  178.                     End Using
  179.  
  180.                 Else
  181.  
  182.                     Using F1 As New Font("Segoe UI semibold", 9)
  183.                         G.DrawString(TabPages(I).Text, F1, B1, New Point(Rect.X + 50, Rect.Y + 11))
  184.                     End Using
  185.  
  186.                 End If
  187.  
  188.             End Using
  189.  
  190.             If Not String.IsNullOrEmpty(TabPages(I).Tag) Then
  191.  
  192.                 If UpperText Then
  193.  
  194.                     Using F1 As New Font("Segoe UI", 7.75, FontStyle.Bold)
  195.                         MS1 = G.MeasureString(TabPages(I).Text, F1)
  196.                     End Using
  197.  
  198.                 Else
  199.  
  200.                     Using F1 As New Font("Segoe UI semibold", 9)
  201.                         MS1 = G.MeasureString(TabPages(I).Text, F1)
  202.                     End Using
  203.  
  204.                 End If
  205.  
  206.                 Using F1 As New Font("Segoe UI", 9)
  207.                     MS2 = G.MeasureString(TabPages(I).Tag, F1)
  208.                 End Using
  209.  
  210.                 Using B1 As New SolidBrush(ColorFromHex("#424452")), P1 As New Pen(ColorFromHex("#323541")), B2 As New SolidBrush(ColorFromHex("#737A8A"))
  211.                     G.FillRectangle(B1, New Rectangle(Rect.X + MS1.Width + 72, Rect.Y + 13, MS2.Width + 5, 15))
  212.                     DrawRoundRect(G, New Rectangle(Rect.X + MS1.Width + 72, Rect.Y + 13, MS2.Width + 5, 15), 3, P1)
  213.  
  214.                     If IsNumeric(TabPages(I).Tag) Then
  215.  
  216.                         Using F1 As New Font("Segoe UI", 8, FontStyle.Bold)
  217.                             G.DrawString(TabPages(I).Tag, F1, B2, New Point(Rect.X + MS1.Width + 75, Rect.Y + 14))
  218.                         End Using
  219.  
  220.                     Else
  221.  
  222.                         Using F1 As New Font("Segoe UI", 7, FontStyle.Bold)
  223.                             G.DrawString(TabPages(I).Tag.ToString.ToUpper, F1, B2, New Point(Rect.X + MS1.Width + 75, Rect.Y + 14))
  224.                         End Using
  225.  
  226.                     End If
  227.  
  228.                 End Using
  229.  
  230.             End If
  231.  
  232.             If Not I = 0 Then
  233.  
  234.                 Using P1 As New Pen(ColorFromHex("#3B3D49")), P2 As New Pen(ColorFromHex("#2F323C"))
  235.                     G.DrawLine(P1, New Point(Rect.X - 4, Rect.Y + 1), New Point(Rect.Width + 4, Rect.Y + 1))
  236.                     G.DrawLine(P2, New Point(Rect.X - 4, Rect.Y + 2), New Point(Rect.Width + 4, Rect.Y + 2))
  237.                 End Using
  238.  
  239.             End If
  240.  
  241.             If Not IsNothing(ImageList) Then
  242.                 If Not TabPages(I).ImageIndex < 0 Then
  243.                     G.DrawImage(ImageList.Images(TabPages(I).ImageIndex), New Rectangle(Rect.X + 18, Rect.Y + ((Rect.Height / 2) - 8), 16, 16))
  244.                 End If
  245.             End If
  246.  
  247.         Next
  248.  
  249.     End Sub
  250.  
  251. End Class
  252.  
  253. Public Class AetherCircular
  254.     Inherits Control
  255.  
  256.     Private G As Graphics
  257.     Private ProgressAngle As Single
  258.     Private RemainderAngle As Single
  259.     Private ExceedingLimits As Boolean
  260.     Private ExceedingSign As String
  261.  
  262.     Private _Progress As Single
  263.     Private _Max As Single = 100
  264.     Private _Min As Single = 0
  265.  
  266.     Public Property Percent As Boolean = True
  267.  
  268.  
  269.     Public Property Progress As Single
  270.         Get
  271.             Return _Progress
  272.         End Get
  273.         Set(value As Single)
  274.             Select Case value
  275.                 Case Is > Max
  276.                     value = Max
  277.                     ExceedingSign = "+"
  278.                     ExceedingLimits = True
  279.                     Invalidate()
  280.  
  281.                 Case Is < Min
  282.                     value = Min
  283.                     ExceedingSign = "-"
  284.                     ExceedingLimits = True
  285.                     Invalidate()
  286.             End Select
  287.             _Progress = value
  288.             Invalidate()
  289.         End Set
  290.     End Property
  291.  
  292.     Public Property Max As Single
  293.         Get
  294.             Return _Max
  295.         End Get
  296.         Set(value As Single)
  297.             Select Case value
  298.                 Case Is < _Progress
  299.                     _Progress = value
  300.             End Select
  301.             _Max = value
  302.             Invalidate()
  303.         End Set
  304.     End Property
  305.  
  306.     Public Property Min As Single
  307.         Get
  308.             Return _Min
  309.         End Get
  310.         Set(value As Single)
  311.             Select Case value
  312.                 Case Is > _Progress
  313.                     _Progress = value
  314.             End Select
  315.             _Min = value
  316.             Invalidate()
  317.         End Set
  318.     End Property
  319.  
  320.     Public Property Border As Color = Color.LightGray
  321.     Public Property HatchPrimary As Color = Color.Green
  322.     Public Property HatchSecondary As Color = Color.Red
  323.  
  324.     Sub New()
  325.         DoubleBuffered = True
  326.     End Sub
  327.  
  328.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  329.  
  330.         G = e.Graphics
  331.         G.SmoothingMode = Drawing2D.SmoothingMode.HighQuality
  332.         G.TextRenderingHint = Drawing.Text.TextRenderingHint.ClearTypeGridFit
  333.  
  334.         MyBase.OnPaint(e)
  335.  
  336.         ProgressAngle = 360 / Max * Progress
  337.         RemainderAngle = 360 - ProgressAngle
  338.  
  339.         Using P1 As New Pen(New Drawing2D.HatchBrush(Drawing2D.HatchStyle.LightUpwardDiagonal, HatchPrimary, HatchSecondary), 4), P2 As New Pen(Border, 4)
  340.             G.DrawArc(P1, New Rectangle(2, 2, Width - 5, Height - 5), -90, ProgressAngle)
  341.             G.DrawArc(P2, New Rectangle(2, 2, Width - 5, Height - 5), ProgressAngle - 90, RemainderAngle)
  342.         End Using
  343.  
  344.         If Percent Then
  345.  
  346.             Using F1 As New Font("Segoe UI", 9, FontStyle.Bold)
  347.  
  348.                 If ExceedingLimits Then
  349.                     CenterString(G, Progress & "%" & ExceedingSign, F1, Color.FromArgb(100, 100, 100), New Rectangle(1, 1, Width, Height + 1))
  350.                 Else
  351.                     CenterString(G, Progress & "%", F1, Color.FromArgb(100, 100, 100), New Rectangle(1, 1, Width, Height + 1))
  352.                 End If
  353.  
  354.             End Using
  355.  
  356.         Else
  357.  
  358.             If ExceedingLimits Then
  359.                 CenterString(G, Progress & ExceedingSign, New Font("Segoe UI", 9, FontStyle.Bold), Color.FromArgb(100, 100, 100), New Rectangle(1, 1, Width, Height + 1))
  360.             Else
  361.                 CenterString(G, Progress, New Font("Segoe UI", 9, FontStyle.Bold), Color.FromArgb(100, 100, 100), New Rectangle(1, 1, Width, Height + 1))
  362.             End If
  363.  
  364.         End If
  365.  
  366.         ExceedingLimits = False
  367.  
  368.         CenterString(G, Text.ToUpper, New Font("Segoe UI", 6, FontStyle.Bold), Color.FromArgb(170, 170, 170), New Rectangle(2, 2, Width, Height + 27))
  369.  
  370.     End Sub
  371.  
  372. End Class
  373.  
  374. <ComponentModel.DefaultEvent("CheckedChanged")>
  375. Public Class AetherCheckBox
  376.     Inherits Control
  377.  
  378.     Public Event CheckedChanged(sender As Object, e As EventArgs)
  379.  
  380.     Private _Checked As Boolean
  381.     Private _EnabledCalc As Boolean
  382.     Private G As Graphics
  383.  
  384.     Private State As MouseState
  385.  
  386.     Public Property Checked As Boolean
  387.         Get
  388.             Return _Checked
  389.         End Get
  390.         Set(value As Boolean)
  391.             _Checked = value
  392.             Invalidate()
  393.         End Set
  394.     End Property
  395.  
  396.     Public Shadows Property Enabled As Boolean
  397.         Get
  398.             Return EnabledCalc
  399.         End Get
  400.         Set(value As Boolean)
  401.             _EnabledCalc = value
  402.  
  403.             If Enabled Then
  404.                 Cursor = Cursors.Hand
  405.             Else
  406.                 Cursor = Cursors.Default
  407.             End If
  408.  
  409.             Invalidate()
  410.         End Set
  411.     End Property
  412.  
  413.     <ComponentModel.DisplayName("Enabled")>
  414.     Public Property EnabledCalc As Boolean
  415.         Get
  416.             Return _EnabledCalc
  417.         End Get
  418.         Set(value As Boolean)
  419.             Enabled = value
  420.             Invalidate()
  421.         End Set
  422.     End Property
  423.  
  424.     Sub New()
  425.         DoubleBuffered = True
  426.         Enabled = True
  427.         Cursor = Cursors.Hand
  428.     End Sub
  429.  
  430.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  431.         G = e.Graphics
  432.         G.SmoothingMode = Drawing2D.SmoothingMode.HighQuality
  433.         G.TextRenderingHint = Drawing.Text.TextRenderingHint.ClearTypeGridFit
  434.  
  435.         MyBase.OnPaint(e)
  436.  
  437.         If Enabled Then
  438.  
  439.             Using P1 As New Pen(ColorFromHex("#D2D2D2")), B1 As New SolidBrush(ColorFromHex("#343843")), F1 As New Font("Segoe UI", 9)
  440.                 DrawRoundRect(G, New Rectangle(0, 0, 18, 18), 6, P1)
  441.                 G.DrawString(Text, F1, B1, New Point(25, 1))
  442.             End Using
  443.  
  444.             If State = MouseState.Over Or State = MouseState.Down Then
  445.  
  446.                 Using P1 As New Pen(ColorFromHex("#8C92A1"))
  447.                     DrawRoundRect(G, New Rectangle(0, 0, 18, 18), 6, P1)
  448.                 End Using
  449.  
  450.             End If
  451.  
  452.         Else
  453.  
  454.             Using P1 As New Pen(ColorFromHex("#DCDCDC")), B1 As New SolidBrush(ColorFromHex("#989CA7")), F1 As New Font("Segoe UI", 9)
  455.                 DrawRoundRect(G, New Rectangle(0, 0, 18, 18), 6, P1)
  456.                 G.DrawString(Text, F1, B1, New Point(25, 1))
  457.             End Using
  458.  
  459.         End If
  460.  
  461.         If Checked Then
  462.  
  463.             If Enabled Then
  464.  
  465.                 Using B1 As New Drawing2D.HatchBrush(Drawing2D.HatchStyle.WideUpwardDiagonal, ColorFromHex("#5B606F"), ColorFromHex("#525766")), P1 As New Pen(ColorFromHex("#474C5A"))
  466.                     G.FillRectangle(B1, New Rectangle(4, 4, 10, 10))
  467.                     DrawRoundRect(G, New Rectangle(4, 4, 10, 10), 3, P1)
  468.                 End Using
  469.  
  470.             Else
  471.  
  472.                 Using B1 As New Drawing2D.HatchBrush(Drawing2D.HatchStyle.WideUpwardDiagonal, ColorFromHex("#8C92A1"), ColorFromHex("#7A7F8E")), P1 As New Pen(ColorFromHex("#797E8C"))
  473.                     G.FillRectangle(B1, New Rectangle(4, 4, 10, 10))
  474.                     DrawRoundRect(G, New Rectangle(4, 4, 10, 10), 3, P1)
  475.                 End Using
  476.  
  477.             End If
  478.  
  479.  
  480.         End If
  481.  
  482.     End Sub
  483.  
  484.     Protected Overrides Sub OnResize(e As EventArgs)
  485.         MyBase.OnResize(e)
  486.         Size = New Size(Width, 19)
  487.     End Sub
  488.  
  489.     Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
  490.         MyBase.OnMouseUp(e)
  491.  
  492.         If Enabled Then
  493.             State = MouseState.Over
  494.             Checked = Not Checked
  495.             RaiseEvent CheckedChanged(Me, e)
  496.             Invalidate()
  497.         End If
  498.  
  499.     End Sub
  500.  
  501.     Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
  502.         MyBase.OnMouseDown(e)
  503.         If Enabled Then
  504.             State = MouseState.Down : Invalidate()
  505.         End If
  506.     End Sub
  507.  
  508.     Protected Overrides Sub OnMouseEnter(e As EventArgs)
  509.         MyBase.OnMouseEnter(e)
  510.         If Enabled Then
  511.             State = MouseState.Over : Invalidate()
  512.         End If
  513.     End Sub
  514.  
  515.     Protected Overrides Sub OnMouseLeave(e As EventArgs)
  516.         MyBase.OnMouseLeave(e)
  517.         If Enabled Then
  518.             State = MouseState.None : Invalidate()
  519.         End If
  520.     End Sub
  521.  
  522. End Class
  523.  
  524. <ComponentModel.DefaultEvent("CheckedChanged")>
  525. Public Class AetherRadioButton
  526.     Inherits Control
  527.  
  528.     Public Event CheckedChanged(sender As Object, e As EventArgs)
  529.  
  530.     Private G As Graphics
  531.     Private State As MouseState
  532.  
  533.     Private _Checked As Boolean
  534.     Private _EnabledCalc As Boolean
  535.  
  536.     Sub New()
  537.         DoubleBuffered = True
  538.         Enabled = True
  539.         Cursor = Cursors.Hand
  540.     End Sub
  541.  
  542.     Public Property Checked As Boolean
  543.         Get
  544.             Return _Checked
  545.         End Get
  546.         Set(value As Boolean)
  547.             _Checked = value
  548.             Invalidate()
  549.         End Set
  550.     End Property
  551.  
  552.     Public Shadows Property Enabled As Boolean
  553.         Get
  554.             Return EnabledCalc
  555.         End Get
  556.         Set(value As Boolean)
  557.             _EnabledCalc = value
  558.  
  559.             If Enabled Then
  560.                 Cursor = Cursors.Hand
  561.             Else
  562.                 Cursor = Cursors.Default
  563.             End If
  564.  
  565.             Invalidate()
  566.         End Set
  567.     End Property
  568.  
  569.     <ComponentModel.DisplayName("Enabled")>
  570.     Public Property EnabledCalc As Boolean
  571.         Get
  572.             Return _EnabledCalc
  573.         End Get
  574.         Set(value As Boolean)
  575.             Enabled = value
  576.             Invalidate()
  577.         End Set
  578.     End Property
  579.  
  580.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  581.  
  582.         G = e.Graphics
  583.         G.SmoothingMode = Drawing2D.SmoothingMode.HighQuality
  584.         G.TextRenderingHint = Drawing.Text.TextRenderingHint.ClearTypeGridFit
  585.  
  586.         MyBase.OnPaint(e)
  587.  
  588.         If Enabled Then
  589.  
  590.             Using P As New Pen(ColorFromHex("#C8C8C8"))
  591.                 G.DrawEllipse(P, New Rectangle(0, 0, 18, 18))
  592.             End Using
  593.  
  594.             Using B As New SolidBrush(ColorFromHex("#343843"))
  595.                 G.DrawString(Text, New Font("Segoe UI", 9), B, New Point(25, 1))
  596.             End Using
  597.  
  598.             If State = MouseState.Over Or State = MouseState.Down Then
  599.  
  600.                 Using P1 As New Pen(ColorFromHex("#8C92A1"))
  601.                     G.DrawEllipse(P1, New Rectangle(0, 0, 18, 18))
  602.                 End Using
  603.  
  604.             End If
  605.  
  606.         Else
  607.  
  608.             Using P As New Pen(ColorFromHex("#DCDCDC"))
  609.                 G.DrawEllipse(P, New Rectangle(0, 0, 18, 18))
  610.             End Using
  611.  
  612.             Using B As New SolidBrush(ColorFromHex("#989CA7"))
  613.                 G.DrawString(Text, New Font("Segoe UI", 9), B, New Point(25, 1))
  614.             End Using
  615.  
  616.         End If
  617.  
  618.         If Checked Then
  619.  
  620.             If Enabled Then
  621.  
  622.                 Using B1 As New Drawing2D.HatchBrush(Drawing2D.HatchStyle.WideUpwardDiagonal, ColorFromHex("#5B606F"), ColorFromHex("#525766")), P1 As New Pen(ColorFromHex("#474C5A"))
  623.                     G.FillEllipse(B1, New Rectangle(4, 4, 10, 10))
  624.                     G.DrawEllipse(P1, New Rectangle(4, 4, 10, 10))
  625.                 End Using
  626.  
  627.             Else
  628.  
  629.                 Using B1 As New Drawing2D.HatchBrush(Drawing2D.HatchStyle.WideUpwardDiagonal, ColorFromHex("#8C92A1"), ColorFromHex("#7A7F8E")), P1 As New Pen(ColorFromHex("#797E8C"))
  630.                     G.FillEllipse(B1, New Rectangle(4, 4, 10, 10))
  631.                     G.DrawEllipse(P1, New Rectangle(4, 4, 10, 10))
  632.                 End Using
  633.  
  634.             End If
  635.  
  636.         End If
  637.  
  638.     End Sub
  639.  
  640.     Protected Overrides Sub OnResize(e As EventArgs)
  641.         MyBase.OnResize(e)
  642.         Size = New Size(Width, 19)
  643.     End Sub
  644.  
  645.     Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
  646.         MyBase.OnMouseUp(e)
  647.  
  648.         If Enabled Then
  649.  
  650.             For Each C As Control In Parent.Controls
  651.                 If TypeOf C Is AetherRadioButton Then
  652.                     DirectCast(C, AetherRadioButton).Checked = False
  653.                 End If
  654.             Next
  655.  
  656.             Checked = Not Checked
  657.             RaiseEvent CheckedChanged(Me, e)
  658.             State = MouseState.Over : Invalidate()
  659.  
  660.         End If
  661.  
  662.     End Sub
  663.  
  664.     Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
  665.         MyBase.OnMouseDown(e)
  666.         If Enabled Then
  667.             State = MouseState.Down : Invalidate()
  668.         End If
  669.     End Sub
  670.  
  671.     Protected Overrides Sub OnMouseEnter(e As EventArgs)
  672.         MyBase.OnMouseEnter(e)
  673.         If Enabled Then
  674.             State = MouseState.Over : Invalidate()
  675.         End If
  676.     End Sub
  677.  
  678.     Protected Overrides Sub OnMouseLeave(e As EventArgs)
  679.         MyBase.OnMouseLeave(e)
  680.         If Enabled Then
  681.             State = MouseState.None : Invalidate()
  682.         End If
  683.     End Sub
  684.  
  685. End Class
  686.  
  687. Public Class AetherGroupBox
  688.     Inherits ContainerControl
  689.  
  690.     Private G As Graphics
  691.  
  692.     Public Property Footer As Boolean
  693.     Public Property FooterText As String
  694.  
  695.     Sub New()
  696.         DoubleBuffered = True
  697.     End Sub
  698.  
  699.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  700.  
  701.         G = e.Graphics
  702.         G.SmoothingMode = Drawing2D.SmoothingMode.HighQuality
  703.         G.TextRenderingHint = Drawing.Text.TextRenderingHint.ClearTypeGridFit
  704.  
  705.         MyBase.OnPaint(e)
  706.  
  707.         G.Clear(Color.White)
  708.  
  709.         Using P1 As New Pen(ColorFromHex("#F1F5FC")), B1 As New SolidBrush(ColorFromHex("#343843")), F1 As New Font("Segoe UI", 9)
  710.             DrawRoundRect(G, FullRectangle(Size, True), 6, P1)
  711.             G.DrawString(Text, F1, B1, New Point(12, 10))
  712.             G.DrawLine(P1, New Point(0, 36), New Point(Width, 36))
  713.         End Using
  714.  
  715.         If Footer Then
  716.  
  717.             Using P1 As New Pen(ColorFromHex("#F5F5F5")), B1 As New SolidBrush(ColorFromHex("#7A7E89")), F1 As New Font("Segoe UI", 9)
  718.                 G.DrawLine(P1, New Point(0, Height - 35), New Point(Width, Height - 35))
  719.                 G.DrawString(FooterText, F1, B1, New Point(12, Height - 27))
  720.             End Using
  721.  
  722.         End If
  723.  
  724.     End Sub
  725.  
  726. End Class
  727.  
  728. Public Class AetherButton
  729.     Inherits Control
  730.  
  731.     Private G As Graphics
  732.     Private State As MouseState
  733.  
  734.     Private _EnabledCalc As Boolean
  735.  
  736.     Public Shadows Event Click(sender As Object, e As EventArgs)
  737.  
  738.     Sub New()
  739.         DoubleBuffered = True
  740.         Enabled = True
  741.     End Sub
  742.  
  743.     Public Shadows Property Enabled As Boolean
  744.         Get
  745.             Return EnabledCalc
  746.         End Get
  747.         Set(value As Boolean)
  748.             _EnabledCalc = value
  749.             Invalidate()
  750.         End Set
  751.     End Property
  752.  
  753.     <ComponentModel.DisplayName("Enabled")>
  754.     Public Property EnabledCalc As Boolean
  755.         Get
  756.             Return _EnabledCalc
  757.         End Get
  758.         Set(value As Boolean)
  759.             Enabled = value
  760.             Invalidate()
  761.         End Set
  762.     End Property
  763.  
  764.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  765.  
  766.         G = e.Graphics
  767.         G.SmoothingMode = Drawing2D.SmoothingMode.HighQuality
  768.         G.TextRenderingHint = Drawing.Text.TextRenderingHint.ClearTypeGridFit
  769.  
  770.         MyBase.OnPaint(e)
  771.  
  772.         If Enabled Then
  773.  
  774.             Select Case State
  775.  
  776.                 Case MouseState.Over
  777.  
  778.                     Using B1 As New SolidBrush(ColorFromHex("#FDFDFD"))
  779.                         FillRoundRect(G, New Rectangle(0, 0, Width - 1, Height - 1), 3, B1)
  780.                     End Using
  781.  
  782.                 Case MouseState.Down
  783.  
  784.                     Using B1 As New SolidBrush(ColorFromHex("#F0F0F0"))
  785.                         FillRoundRect(G, New Rectangle(0, 0, Width - 1, Height - 1), 3, B1)
  786.                     End Using
  787.  
  788.                 Case Else
  789.  
  790.                     Using B1 As New SolidBrush(ColorFromHex("#F6F6F6"))
  791.                         FillRoundRect(G, New Rectangle(0, 0, Width - 1, Height - 1), 3, B1)
  792.                     End Using
  793.  
  794.             End Select
  795.  
  796.             Using F1 As New Font("Segoe UI", 9), P1 As New Pen(ColorFromHex("#C3C3C3"))
  797.                 DrawRoundRect(G, New Rectangle(0, 0, Width - 1, Height - 1), 3, P1)
  798.                 CenterString(G, Text, F1, ColorFromHex("#343843"), FullRectangle(Size, False))
  799.             End Using
  800.  
  801.  
  802.         Else
  803.  
  804.             Using B1 As New SolidBrush(ColorFromHex("#F2F2F2")), P1 As New Pen(ColorFromHex("#DCDCDC")), F1 As New Font("Segoe UI", 9)
  805.                 FillRoundRect(G, New Rectangle(0, 0, Width - 1, Height - 1), 6, B1)
  806.                 DrawRoundRect(G, New Rectangle(0, 0, Width - 1, Height - 1), 6, P1)
  807.                 CenterString(G, Text, F1, ColorFromHex("#989CA7"), FullRectangle(Size, False))
  808.             End Using
  809.  
  810.         End If
  811.  
  812.     End Sub
  813.  
  814.     Protected Overrides Sub OnMouseEnter(e As EventArgs)
  815.         MyBase.OnMouseEnter(e)
  816.         State = MouseState.Over : Invalidate()
  817.     End Sub
  818.  
  819.     Protected Overrides Sub OnMouseLeave(e As EventArgs)
  820.         MyBase.OnMouseLeave(e)
  821.         State = MouseState.None : Invalidate()
  822.     End Sub
  823.  
  824.     Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
  825.         MyBase.OnMouseUp(e)
  826.  
  827.         If Enabled Then
  828.             RaiseEvent Click(Me, e)
  829.         End If
  830.  
  831.         State = MouseState.Over : Invalidate()
  832.     End Sub
  833.  
  834.     Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
  835.         MyBase.OnMouseDown(e)
  836.         State = MouseState.Down : Invalidate()
  837.     End Sub
  838.  
  839. End Class
  840.  
  841. Public Class AetherTag
  842.     Inherits Control
  843.  
  844.     Private G As Graphics
  845.  
  846.     Public Property Background As Color = ColorFromHex("#424452")
  847.     Public Property Border As Color = ColorFromHex("#323541")
  848.     Public Property TextColor As Color = ColorFromHex("#7C8290")
  849.  
  850.     Sub New()
  851.         DoubleBuffered = True
  852.         Text = "Tag"
  853.     End Sub
  854.  
  855.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  856.         G = e.Graphics
  857.         G.SmoothingMode = Drawing2D.SmoothingMode.HighQuality
  858.         G.TextRenderingHint = Drawing.Text.TextRenderingHint.ClearTypeGridFit
  859.  
  860.         MyBase.OnPaint(e)
  861.  
  862.         Using B1 As New SolidBrush(Background), P1 As New Pen(Border), B2 As New SolidBrush(TextColor)
  863.             G.FillRectangle(B1, FullRectangle(Size, True))
  864.             DrawRoundRect(G, FullRectangle(Size, True), 3, P1)
  865.  
  866.             If IsNumeric(Text) Then
  867.  
  868.                 Using F1 As New Font("Segoe UI", 8, FontStyle.Bold)
  869.                     G.DrawString(Text, F1, B2, New Point(2, 0))
  870.                 End Using
  871.  
  872.             Else
  873.  
  874.                 Using F1 As New Font("Segoe UI", 7, FontStyle.Bold)
  875.                     G.DrawString(Text.ToUpper, F1, B2, New Point(2, 1))
  876.                 End Using
  877.  
  878.             End If
  879.  
  880.         End Using
  881.  
  882.     End Sub
  883.  
  884.     Protected Overrides Sub OnResize(e As EventArgs)
  885.         MyBase.OnResize(e)
  886.         Size = New Size(Width, 15)
  887.     End Sub
  888.  
  889. End Class
  890.  
  891. <ComponentModel.DefaultEvent("TextChanged")>
  892. Public Class AetherTextbox
  893.     Inherits Control
  894.  
  895.     Private WithEvents TB As New TextBox
  896.     Private G As Graphics
  897.     Private State As MouseState
  898.     Private IsDown As Boolean
  899.  
  900.     Private _EnabledCalc As Boolean
  901.     Private _allowpassword As Boolean = False
  902.     Private _maxChars As Integer = 32767
  903.     Private _textAlignment As HorizontalAlignment
  904.     Private _multiLine As Boolean = False
  905.     Private _readOnly As Boolean = False
  906.  
  907.     Public Shadows Property Enabled As Boolean
  908.         Get
  909.             Return EnabledCalc
  910.         End Get
  911.         Set(value As Boolean)
  912.             TB.Enabled = value
  913.             _EnabledCalc = value
  914.             Invalidate()
  915.         End Set
  916.     End Property
  917.  
  918.     <ComponentModel.DisplayName("Enabled")>
  919.     Public Property EnabledCalc As Boolean
  920.         Get
  921.             Return _EnabledCalc
  922.         End Get
  923.         Set(value As Boolean)
  924.             Enabled = value
  925.             Invalidate()
  926.         End Set
  927.     End Property
  928.  
  929.     Public Shadows Property UseSystemPasswordChar() As Boolean
  930.         Get
  931.             Return _allowpassword
  932.         End Get
  933.         Set(ByVal value As Boolean)
  934.             TB.UseSystemPasswordChar = UseSystemPasswordChar
  935.             _allowpassword = value
  936.             Invalidate()
  937.         End Set
  938.     End Property
  939.  
  940.     Public Shadows Property MaxLength() As Integer
  941.         Get
  942.             Return _maxChars
  943.         End Get
  944.         Set(ByVal value As Integer)
  945.             _maxChars = value
  946.             TB.MaxLength = MaxLength
  947.             Invalidate()
  948.         End Set
  949.     End Property
  950.  
  951.     Public Shadows Property TextAlign() As HorizontalAlignment
  952.         Get
  953.             Return _textAlignment
  954.         End Get
  955.         Set(ByVal value As HorizontalAlignment)
  956.             _textAlignment = value
  957.             Invalidate()
  958.         End Set
  959.     End Property
  960.  
  961.     Public Shadows Property MultiLine() As Boolean
  962.         Get
  963.             Return _multiLine
  964.         End Get
  965.         Set(ByVal value As Boolean)
  966.             _multiLine = value
  967.             TB.Multiline = value
  968.             OnResize(EventArgs.Empty)
  969.             Invalidate()
  970.         End Set
  971.     End Property
  972.  
  973.     Public Shadows Property [ReadOnly]() As Boolean
  974.         Get
  975.             Return _readOnly
  976.         End Get
  977.         Set(ByVal value As Boolean)
  978.             _readOnly = value
  979.             If TB IsNot Nothing Then
  980.                 TB.ReadOnly = value
  981.             End If
  982.         End Set
  983.     End Property
  984.  
  985.     Protected Overrides Sub OnTextChanged(ByVal e As EventArgs)
  986.         MyBase.OnTextChanged(e)
  987.         Invalidate()
  988.     End Sub
  989.  
  990.     Protected Overrides Sub OnBackColorChanged(ByVal e As EventArgs)
  991.         MyBase.OnBackColorChanged(e)
  992.         Invalidate()
  993.     End Sub
  994.  
  995.     Protected Overrides Sub OnForeColorChanged(ByVal e As EventArgs)
  996.         MyBase.OnForeColorChanged(e)
  997.         TB.ForeColor = ForeColor
  998.         Invalidate()
  999.     End Sub
  1000.  
  1001.     Protected Overrides Sub OnFontChanged(ByVal e As EventArgs)
  1002.         MyBase.OnFontChanged(e)
  1003.         TB.Font = Font
  1004.     End Sub
  1005.  
  1006.     Protected Overrides Sub OnGotFocus(ByVal e As EventArgs)
  1007.         MyBase.OnGotFocus(e)
  1008.         TB.Focus()
  1009.     End Sub
  1010.  
  1011.     Private Sub TextChangeTb() Handles TB.TextChanged
  1012.         Text = TB.Text
  1013.     End Sub
  1014.  
  1015.     Private Sub TextChng() Handles MyBase.TextChanged
  1016.         TB.Text = Text
  1017.     End Sub
  1018.  
  1019.     Public Sub NewTextBox()
  1020.         With TB
  1021.             .Text = String.Empty
  1022.             .BackColor = Color.White
  1023.             .ForeColor = ColorFromHex("#343843")
  1024.             .TextAlign = HorizontalAlignment.Left
  1025.             .BorderStyle = BorderStyle.None
  1026.             .Location = New Point(3, 3)
  1027.             .Font = New Font("Segoe UI", 9)
  1028.             .Size = New Size(Width - 3, Height - 3)
  1029.             .UseSystemPasswordChar = UseSystemPasswordChar
  1030.         End With
  1031.     End Sub
  1032.  
  1033.     Sub New()
  1034.         MyBase.New()
  1035.         NewTextBox()
  1036.         Controls.Add(TB)
  1037.         SetStyle(ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  1038.         DoubleBuffered = True
  1039.         TextAlign = HorizontalAlignment.Left
  1040.         ForeColor = ColorFromHex("#343843")
  1041.         Font = New Font("Segoe UI", 9)
  1042.         Size = New Size(130, 29)
  1043.         Enabled = True
  1044.     End Sub
  1045.  
  1046.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  1047.  
  1048.         G = e.Graphics
  1049.         G.SmoothingMode = Drawing2D.SmoothingMode.HighQuality
  1050.         G.TextRenderingHint = Drawing.Text.TextRenderingHint.ClearTypeGridFit
  1051.  
  1052.         MyBase.OnPaint(e)
  1053.  
  1054.         G.Clear(Color.White)
  1055.  
  1056.         If Enabled Then
  1057.  
  1058.             TB.ForeColor = ColorFromHex("#343843")
  1059.  
  1060.             If State = MouseState.Down Then
  1061.  
  1062.                 Using P As New Pen(ColorFromHex("#5B606F"))
  1063.                     DrawRoundRect(G, FullRectangle(Size, True), 3, P)
  1064.                 End Using
  1065.  
  1066.             Else
  1067.  
  1068.                 Using P As New Pen(ColorFromHex("#C8C8C8"))
  1069.                     DrawRoundRect(G, FullRectangle(Size, True), 3, P)
  1070.                 End Using
  1071.  
  1072.             End If
  1073.  
  1074.         Else
  1075.  
  1076.             TB.ForeColor = ColorFromHex("#DCDCDC")
  1077.  
  1078.             Using P As New Pen(ColorFromHex("#E6E6E6"))
  1079.                 DrawRoundRect(G, FullRectangle(Size, True), 3, P)
  1080.             End Using
  1081.  
  1082.         End If
  1083.  
  1084.         TB.TextAlign = TextAlign
  1085.         TB.UseSystemPasswordChar = UseSystemPasswordChar
  1086.  
  1087.     End Sub
  1088.  
  1089.     Protected Overrides Sub OnResize(e As EventArgs)
  1090.         MyBase.OnResize(e)
  1091.         If Not MultiLine Then
  1092.             Dim tbheight As Integer = TB.Height
  1093.             TB.Location = New Point(10, CType(((Height / 2) - (tbheight / 2) - 0), Integer))
  1094.             TB.Size = New Size(Width - 20, tbheight)
  1095.         Else
  1096.             TB.Location = New Point(10, 10)
  1097.             TB.Size = New Size(Width - 20, Height - 20)
  1098.         End If
  1099.     End Sub
  1100.  
  1101.     Protected Overrides Sub OnEnter(e As EventArgs)
  1102.         MyBase.OnEnter(e)
  1103.         State = MouseState.Down : Invalidate()
  1104.     End Sub
  1105.  
  1106.     Protected Overrides Sub OnLeave(e As EventArgs)
  1107.         MyBase.OnLeave(e)
  1108.         State = MouseState.None : Invalidate()
  1109.     End Sub
  1110.  
  1111. End Class
Advertisement
Add Comment
Please, Sign In to add comment