LordPankake

[VB.Net] Deimos Theme - [13 Controls | Dark]

Jul 20th, 2014
598
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Imports System.Drawing.Drawing2D
  2. '|===========================================================|
  3. '|===|  Reactor (Theme used as reference)
  4. '| Creator: ᒪeumonic
  5. '| HF Account: http://www.hackforums.net/member.php?action=profile&uid=221681
  6. '| Created: 11/22/2011
  7. '|
  8. '|
  9. '|===|  Deimos Theme
  10. '| Creator: LordPankake
  11. '| HF Account: http://www.hackforums.net/member.php?action=profile&uid=1828119
  12. '| Created: 6/20/2014, Last edited: 7/5/2014
  13. '|===========================================================|
  14. Public Class DeimosTheme : Inherits ContainerControl
  15. #Region " Control Help - Movement & Flicker Control "
  16.     Private State As MouseState = MouseState.None
  17.     Private TopCap As Boolean = False
  18.     Private SizeCap As Boolean = False
  19.     Private ColLow, ColMed, ColHigh, ColDark As Color
  20.     Private MouseP As Point = New Point(0, 0)
  21.     Private TopGrip As Integer
  22.     Public Property DrawIcon As Boolean = True
  23.     Public Property DrawIconSlot As Boolean = True
  24.     Public Property InnerBox As Boolean = True
  25.     Public Property InnerGradient As Boolean = True
  26.     Public Property InnerRigid As Boolean = False
  27.     Public Property AllowResize As Boolean = True
  28.     Protected Overrides Sub OnPaintBackground(ByVal e As System.Windows.Forms.PaintEventArgs)
  29.     End Sub
  30.     Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
  31.         MyBase.OnMouseEnter(e)
  32.         State = MouseState.Over
  33.         Invalidate()
  34.     End Sub
  35.     Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  36.         MyBase.OnMouseDown(e)
  37.         State = MouseState.Down
  38.         If e.Button = Windows.Forms.MouseButtons.Left Then
  39.             If New Rectangle(0, 0, Width, TopGrip).Contains(e.Location) Then
  40.                 TopCap = True : MouseP = e.Location
  41.             ElseIf New Rectangle(Width - 15, Height - 15, 15, 15).Contains(e.Location) And AllowResize Then
  42.                 SizeCap = True : MouseP = e.Location
  43.             End If
  44.         End If
  45.     End Sub
  46.     Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
  47.         MyBase.OnMouseLeave(e)
  48.         State = MouseState.None
  49.         Invalidate()
  50.     End Sub
  51.     Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
  52.         MyBase.OnMouseUp(e)
  53.         State = MouseState.Over
  54.         TopCap = False
  55.         SizeCap = False
  56.     End Sub
  57.     Protected Overrides Sub OnMouseMove(ByVal e As System.Windows.Forms.MouseEventArgs)
  58.         MyBase.OnMouseMove(e)
  59.         If TopCap Then
  60.             Parent.Location = MousePosition - MouseP
  61.         End If
  62.         If SizeCap And AllowResize Then
  63.             MouseP = e.Location
  64.             Parent.Size = New Size(MouseP)
  65.             Invalidate()
  66.         End If
  67.     End Sub
  68.     Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
  69.         MyBase.OnTextChanged(e)
  70.         Invalidate()
  71.     End Sub
  72. #End Region
  73.     Sub New()
  74.         MyBase.New()
  75.         Dock = DockStyle.Fill
  76.         TopGrip = 45
  77.         ColHigh = Color.FromArgb(96, 98, 103)
  78.         ColMed = Color.FromArgb(57, 59, 64)
  79.         ColLow = Color.FromArgb(35, 37, 40)
  80.         ColDark = Color.FromArgb(22, 22, 22)
  81.         ForeColor = Color.FromArgb(146, 149, 152)
  82.         Font = New Font("Segoe UI", 10.0F)
  83.         DoubleBuffered = True
  84.         BackColor = Color.FromArgb(55, 55, 55)
  85.     End Sub
  86.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  87.         Dim G As Graphics = e.Graphics
  88.         Dim F As Form = FindForm()
  89.         Dim D As New DrawUtils
  90.         MyBase.OnPaint(e)
  91.  
  92.         G.Clear(F.TransparencyKey)
  93.  
  94.         '|========================================================================================|
  95.        '|                                                                                        |
  96.        '|      Drawing the form frame                                                            |
  97.        '|                                                                                        |
  98.        '| ---   ---   ---   ---   ---   ---   ---   ---   ---   ---   ---   ---   ---   ---   ---|
  99.        Dim FrameRectangle As New Rectangle(0, 40, F.Width - 1, F.Height - 41)
  100.         G.FillRectangle(New SolidBrush(ColLow), FrameRectangle)
  101.         G.DrawRectangle(New Pen(ColDark), FrameRectangle)
  102.         If InnerBox Then
  103.             Dim InternalRect As New Rectangle(15, 43, F.Width - 31, F.Height - 42 - 15)
  104.             Dim InternalPath As GraphicsPath = D.RoundRect(InternalRect, 6)
  105.             Dim InternalGradient As New LinearGradientBrush(New Point(0, 35), New Point(0, F.Height - 14), ColMed, Color.FromArgb(47, 49, 54))
  106.             Dim InternalPathHighlight As GraphicsPath = D.RoundRect(New Rectangle(16, 44, F.Width - 33, F.Height - 42 - 15), 4)
  107.             If Not InnerRigid Then
  108.                 G.SmoothingMode = SmoothingMode.HighQuality
  109.             End If
  110.             If InnerGradient Then
  111.                 G.FillPath(InternalGradient, InternalPath)
  112.             Else
  113.                 G.FillPath(New SolidBrush(ColMed), InternalPath)
  114.             End If
  115.  
  116.             G.DrawPath(New Pen(ColMed), InternalPathHighlight)
  117.             G.DrawPath(New Pen(ColDark), InternalPath)
  118.             G.SmoothingMode = SmoothingMode.None
  119.         End If
  120.  
  121.         '| =======================================================================================|
  122.        '|                                                                                        |
  123.        '|      Drawing the middle bar                                                            |
  124.        '|                                                                                        |
  125.        '| ---   ---   ---   ---   ---   ---   ---   ---   ---   ---   ---   ---   ---   ---   ---|
  126.        '| Top Stuffs (Non-Outline Bar)
  127.        Dim TopGripGradient As New LinearGradientBrush(New Point(0, 0), New Point(0, 25), ColMed, ColLow)
  128.         Dim TopTexturedRect As New Rectangle(40, 5, F.Width - 80, 35)
  129.         Dim TexturedTopBrush As New HatchBrush(HatchStyle.DarkDownwardDiagonal, ColLow, Color.Transparent)
  130.         '| Middle bar
  131.        Dim LinearGradientPen1 As New LinearGradientBrush(New Point(0, 5), New Point(F.Width / 2, 5), ColMed, ColHigh)
  132.         Dim LinearGradientPen2 As New LinearGradientBrush(New Point(F.Width / 2, 5), New Point(F.Width, 5), ColHigh, ColMed)
  133.         Dim LinearGradientPen3 As New LinearGradientBrush(New Point(0, 5), New Point(F.Width / 2, 5), ColDark, ColLow)
  134.         Dim LinearGradientPen4 As New LinearGradientBrush(New Point(F.Width / 2, 5), New Point(F.Width, 5), ColLow, ColDark)
  135.         '| Top Middle
  136.        G.FillRectangle(TopGripGradient, TopTexturedRect)
  137.         G.FillRectangle(TexturedTopBrush, TopTexturedRect)
  138.         '| Middle Bar
  139.        G.DrawLine(New Pen(LinearGradientPen3), New Point(51, 5), New Point((51 + F.Width - 52) / 2, 5))
  140.         G.DrawLine(New Pen(LinearGradientPen4), New Point((51 + F.Width - 52) / 2, 5), New Point(F.Width - 52, 5))
  141.         G.DrawLine(New Pen(LinearGradientPen1), New Point(51, 6), New Point((51 + F.Width - 52) / 2, 6))
  142.         G.DrawLine(New Pen(LinearGradientPen2), New Point((51 + F.Width - 52) / 2, 6), New Point(F.Width - 52, 6))
  143.         G.DrawLine(New Pen(ColHigh), New Point(F.Width / 2 - 1, 6), New Point(F.Width / 2 + 1, 6))
  144.         '| =======================================================================================|
  145.        '|                                                                                        |
  146.        '|      Drawing the top right/left boxes                                                  |
  147.        '|                                                                                        |
  148.        '| ---   ---   ---   ---   ---   ---   ---   ---   ---   ---   ---   ---   ---   ---   ---|
  149.  
  150.         '| Top Right
  151.        Dim TopRightRect As New Rectangle(New Point((F.Width - 1) - 50, 0), New Size(New Point(50, 40)))
  152.         Dim TopRightRectLight As New Rectangle(New Point((F.Width - 1) - 50, 1), New Size(New Point(50, 39)))
  153.         Dim TopRightPath As GraphicsPath = D.RoundedTopRect(TopRightRect, 6)
  154.         Dim TopRightPathLight As GraphicsPath = D.RoundedTopRect(TopRightRectLight, 6)
  155.         '| Top Left
  156.        Dim TopLeftRect As New Rectangle(New Point(0, 0), New Size(New Point(50, 40)))
  157.         Dim TopLeftRectLight As New Rectangle(New Point(0, 1), New Size(New Point(50, 39)))
  158.         Dim TopLeftPath As GraphicsPath = D.RoundedTopRect(TopLeftRect, 6)
  159.         Dim TopLeftPathLight As GraphicsPath = D.RoundedTopRect(TopLeftRectLight, 6)
  160.         Dim TopGradient As New LinearGradientBrush(New Point(0, 0), New Point(0, 40), ColMed, ColLow)
  161.         '| Top Left/Right
  162.        G.FillPath(TopGradient, TopLeftPath)
  163.         G.FillPath(TopGradient, TopRightPath)
  164.         G.SmoothingMode = SmoothingMode.HighQuality
  165.         G.DrawPath(New Pen(ColHigh), TopLeftPathLight)
  166.         G.DrawPath(New Pen(ColHigh), TopRightPathLight)
  167.         G.SmoothingMode = SmoothingMode.None
  168.         G.DrawPath(New Pen(ColDark), TopRightPath)
  169.         G.DrawPath(New Pen(ColDark), TopLeftPath)
  170.         G.DrawLine(New Pen(ColLow), New Point(1, 40), New Point(F.Width - 2, 40))
  171.  
  172.         '| =======================================================================================|
  173.        '|                                                                                        |
  174.        '|      Drawing the middle connecter bar (attatched visually to main frame                |
  175.        '|                                                                                        |
  176.        '| ---   ---   ---   ---   ---   ---   ---   ---   ---   ---   ---   ---   ---   ---   ---|
  177.        '| Top Middle (Bar)
  178.        Dim Lefts As Point() = {New Point(49, 15), New Point(61, 27), New Point(49, 27)}
  179.         Dim Rights As Point() = {New Point(F.Width - 49, 15), New Point(F.Width - 62, 29), New Point(F.Width - 49, 29)}
  180.         Dim ConnectionRect As New Rectangle(50, 25, F.Width - 100, 15)
  181.         '| Straight connection
  182.        G.FillRectangle(TopGradient, ConnectionRect)
  183.         G.DrawLine(New Pen(ColHigh), New Point(50, 26), New Point(F.Width - 62, 26))
  184.         G.DrawLine(New Pen(ColDark), New Point(50, 25), New Point(F.Width - 51, 25))
  185.         '| Diagonals
  186.        G.SmoothingMode = SmoothingMode.AntiAlias
  187.         G.FillPolygon(TopGradient, Lefts)
  188.         G.DrawLine(New Pen(ColHigh), New Point(50, 16), New Point(60, 26))
  189.         G.DrawLine(New Pen(ColDark), New Point(50, 15), New Point(60, 25))
  190.         G.FillPolygon(TopGradient, Rights)
  191.         G.DrawLine(New Pen(ColHigh), New Point(F.Width - 51, 16), New Point(F.Width - 61, 26))
  192.         G.DrawLine(New Pen(ColDark), New Point(F.Width - 51, 15), New Point(F.Width - 61, 25))
  193.         G.SmoothingMode = SmoothingMode.None
  194.         If DrawIcon Then
  195.             If DrawIconSlot Then
  196.                 Dim IconRect As GraphicsPath = D.RoundRect(New Rectangle(10, 4, 31, 31), 4)
  197.                 Dim InnerGradient As New LinearGradientBrush(New Point(5, 2), New Point(5, 40), ColLow, ColDark)
  198.                 G.SmoothingMode = SmoothingMode.HighQuality
  199.                 G.FillPath(InnerGradient, IconRect)
  200.                 G.DrawPath(New Pen(ColDark), IconRect)
  201.             End If
  202.             G.DrawIcon(F.Icon, New Rectangle(11, 5, 30, 30))
  203.         End If
  204.         G.SmoothingMode = SmoothingMode.None
  205.         D.DrawTextWithShadow(G, New Rectangle(60, 0, Width - 55, 32), F.Text, Font, HorizontalAlignment.Left, ForeColor)
  206.     End Sub
  207. End Class
  208. Public Class DeimosTopControl : Inherits Control
  209. #Region " Control Help - MouseState & Flicker Control"
  210.     Private ColLow, ColMed, ColHigh, ColDark As Color
  211.     Private State As MouseState = MouseState.None
  212.     Public Property xOffset As Integer
  213.     Public Property yOffset As Integer
  214.     Public Property Mode As String = "Close"
  215.     Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
  216.         MyBase.OnMouseEnter(e)
  217.         State = MouseState.Over
  218.         Invalidate()
  219.     End Sub
  220.     Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  221.         MyBase.OnMouseDown(e)
  222.         State = MouseState.Down
  223.         Invalidate()
  224.     End Sub
  225.     Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
  226.         MyBase.OnMouseLeave(e)
  227.         State = MouseState.None
  228.         Invalidate()
  229.     End Sub
  230.     Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  231.         MyBase.OnMouseUp(e)
  232.         If New Rectangle(0, 0, Width, Height).Contains(e.Location) And Not IsNothing(Mode) Then
  233.             If Mode = "Close" Then
  234.                 FindForm.Close()
  235.             ElseIf Mode = "Minimize" Then
  236.                 FindForm.WindowState = FormWindowState.Minimized
  237.             ElseIf Mode = "Maximized" Then
  238.                 If FindForm.WindowState = FormWindowState.Maximized Then
  239.                     FindForm.WindowState = FormWindowState.Normal
  240.                 Else
  241.                     FindForm.WindowState = FormWindowState.Maximized
  242.                 End If
  243.             End If
  244.         End If
  245.         State = MouseState.Over
  246.         SizeChangeExternal(Size)
  247.  
  248.         Dim B As New Bitmap(Width, Height)
  249.  
  250.         PaintExternal(Graphics.FromImage(B))
  251.         Invalidate()
  252.     End Sub
  253.     Protected Overrides Sub OnPaintBackground(ByVal pevent As PaintEventArgs)
  254.     End Sub
  255.     Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
  256.         MyBase.OnTextChanged(e)
  257.         Invalidate()
  258.     End Sub
  259.     Protected Overrides Sub OnSizeChanged(ByVal e As EventArgs)
  260.         MyBase.OnSizeChanged(e)
  261.         Invalidate()
  262.     End Sub
  263.     Public Sub PaintExternal(ByVal G As Graphics)
  264.         PaintControl(G)
  265.     End Sub
  266.     Public Sub SizeChangeExternal(e As Size)
  267.         Size = e
  268.         Invalidate()
  269.     End Sub
  270. #End Region
  271.     Sub New()
  272.         MyBase.New()
  273.         Text = ""
  274.         Size = New Size(New Point(21, 26))
  275.         BackColor = Color.FromArgb(35, 37, 40)
  276.         ColHigh = Color.FromArgb(96, 98, 103)
  277.         ColMed = Color.FromArgb(57, 59, 64)
  278.         ColLow = Color.FromArgb(35, 37, 40)
  279.         ColDark = Color.FromArgb(22, 22, 22)
  280.         Font = New Font("Segoe UI", 10.0F)
  281.         DoubleBuffered = True
  282.     End Sub
  283.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  284.         Dim G As Graphics = e.Graphics
  285.  
  286.         MyBase.OnPaint(e)
  287.         PaintControl(G)
  288.     End Sub
  289.     Private Sub PaintControl(ByVal G As Graphics)
  290.         Dim D As New DrawUtils
  291.         Top = 0
  292.         Size = New Size(New Point(21, Height))
  293.         G.Clear(Color.Fuchsia)
  294.         Dim ContRect As GraphicsPath = D.RoundedTopRect(New Rectangle(0, 0, Width - 1, Height - 1), 5)
  295.         Dim ContRectHighlight As GraphicsPath = D.RoundedTopRect(New Rectangle(0, 1, Width - 1, Height - 2), 5)
  296.  
  297.         Select Case State
  298.             Case MouseState.None
  299.                 Dim ContGrad As New LinearGradientBrush(New Point(0, 0), New Point(0, Height), ColMed, ColLow)
  300.                 G.FillPath(ContGrad, ContRect)
  301.                 G.SmoothingMode = SmoothingMode.HighQuality
  302.                 G.DrawPath(New Pen(ColHigh), ContRectHighlight)
  303.                 G.SmoothingMode = SmoothingMode.None
  304.                 G.DrawPath(New Pen(ColDark), ContRect)
  305.  
  306.                 G.DrawString(Text, Font, Brushes.Black, New Point(5 + xOffset, 1 + yOffset))
  307.                 G.DrawString(Text, Font, New SolidBrush(Color.FromArgb(146, 149, 152)), New Point(4 + xOffset, 0 + yOffset))
  308.             Case MouseState.Down
  309.                 Dim ContGrad As New LinearGradientBrush(New Point(0, 0), New Point(0, Height), ColLow, ColDark)
  310.                 G.FillPath(ContGrad, ContRect)
  311.                 G.SmoothingMode = SmoothingMode.HighQuality
  312.                 G.DrawPath(New Pen(ColHigh), ContRectHighlight)
  313.                 G.SmoothingMode = SmoothingMode.None
  314.                 G.DrawPath(New Pen(ColDark), ContRect)
  315.  
  316.                 G.DrawString(Text, Font, Brushes.Black, New Point(5 + xOffset, 1 + yOffset))
  317.                 G.DrawString(Text, Font, New SolidBrush(ColHigh), New Point(4 + xOffset, 0 + yOffset))
  318.             Case MouseState.Over
  319.                 Dim ContGrad As New LinearGradientBrush(New Point(0, 0), New Point(0, Height), ColHigh, ColMed)
  320.                 G.FillPath(ContGrad, ContRect)
  321.                 G.SmoothingMode = SmoothingMode.HighQuality
  322.                 G.DrawPath(New Pen(Color.FromArgb(144, 144, 144)), ContRectHighlight)
  323.                 G.SmoothingMode = SmoothingMode.None
  324.                 G.DrawPath(New Pen(ColDark), ContRect)
  325.  
  326.                 G.DrawString(Text, Font, Brushes.Black, New Point(5 + xOffset, 1 + yOffset))
  327.                 G.DrawString(Text, Font, New SolidBrush(Color.White), New Point(4 + xOffset, 0 + yOffset))
  328.         End Select
  329.     End Sub
  330. End Class
  331. Public Class DeimosTopControlBar : Inherits Control
  332. #Region " Control Help - MouseState & Flicker Control"
  333.     Protected Overrides Sub OnPaintBackground(ByVal pevent As PaintEventArgs)
  334.     End Sub
  335.     Protected Overrides Sub OnSizeChanged(ByVal e As EventArgs)
  336.         MyBase.OnSizeChanged(e)
  337.         For Each cont As DeimosTopControl In Controls
  338.             cont.SizeChangeExternal(Size)
  339.         Next
  340.         Invalidate()
  341.     End Sub
  342.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  343.         Top = 0
  344.         Size = New Size(New Point(61, Height))
  345.         For Each cont As DeimosTopControl In Controls
  346.             cont.PaintExternal(e.Graphics)
  347.         Next
  348.     End Sub
  349. #End Region
  350.     Sub New()
  351.         MyBase.New()
  352.         Size = New Size(New Point(61, 26))
  353.  
  354.         Dim DeimostTopMin As New DeimosTopControl
  355.         DeimostTopMin.Mode = "Minimize"
  356.         DeimostTopMin.yOffset = -4
  357.         DeimostTopMin.Text = "_"
  358.         DeimostTopMin.Font = New Font("Segoe UI", 12.5F)
  359.         DeimostTopMin.Location = New Point(0, 0)
  360.  
  361.         Dim DeimostTopMax As New DeimosTopControl
  362.         DeimostTopMax.Mode = "Maximized"
  363.         DeimostTopMax.Text = "□"
  364.         DeimostTopMax.Font = New Font("Segoe UI", 11.0F)
  365.         DeimostTopMax.Location = New Point(20, 0)
  366.  
  367.         Dim DeimostTopClose As New DeimosTopControl
  368.         DeimostTopClose.Mode = "Close"
  369.         DeimostTopClose.xOffset = 1
  370.         DeimostTopClose.yOffset = 3
  371.         DeimostTopClose.Font = New Font("Segoe UI", 9.0F)
  372.         DeimostTopClose.Location = New Point(40, 0)
  373.         DeimostTopClose.Text = "X"
  374.  
  375.         Controls.Add(DeimostTopMin)
  376.         Controls.Add(DeimostTopMax)
  377.         Controls.Add(DeimostTopClose)
  378.         Invalidate()
  379.     End Sub
  380. End Class
  381. Public Class DeimosButton : Inherits Control
  382. #Region " Control Help - MouseState & Flicker Control"
  383.     Private ColLow, ColMed, ColHigh, ColDark As Color
  384.     Private State As MouseState = MouseState.None
  385.     Public Property DrawRigid As Boolean = False
  386.     Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
  387.         MyBase.OnMouseEnter(e)
  388.         State = MouseState.Over
  389.         Invalidate()
  390.     End Sub
  391.     Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  392.         MyBase.OnMouseDown(e)
  393.         State = MouseState.Down
  394.         Invalidate()
  395.     End Sub
  396.     Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
  397.         MyBase.OnMouseLeave(e)
  398.         State = MouseState.None
  399.         Invalidate()
  400.     End Sub
  401.     Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  402.         MyBase.OnMouseUp(e)
  403.         State = MouseState.Over
  404.         Invalidate()
  405.     End Sub
  406.     Protected Overrides Sub OnPaintBackground(ByVal pevent As PaintEventArgs)
  407.     End Sub
  408.     Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
  409.         MyBase.OnTextChanged(e)
  410.         Invalidate()
  411.     End Sub
  412.     Protected Overrides Sub OnSizeChanged(ByVal e As EventArgs)
  413.         MyBase.OnSizeChanged(e)
  414.         Invalidate()
  415.     End Sub
  416.     Public Sub PaintExternal(e As PaintEventArgs)
  417.         OnPaint(e)
  418.     End Sub
  419.     Public Sub SizeChangeExternal(e As Size)
  420.         Size = e
  421.         Invalidate()
  422.     End Sub
  423. #End Region
  424.     Sub New()
  425.         MyBase.New()
  426.         Text = ""
  427.         Size = New Size(New Point(80, 35))
  428.         BackColor = Color.FromArgb(55, 58, 61)
  429.         ColHigh = Color.FromArgb(96, 98, 103)
  430.         ColMed = Color.FromArgb(57, 59, 64)
  431.         ColLow = Color.FromArgb(35, 37, 40)
  432.         ColDark = Color.FromArgb(22, 22, 22)
  433.         Font = New Font("Segoe UI", 10.0F)
  434.         DoubleBuffered = True
  435.     End Sub
  436.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  437.         Dim G As Graphics = e.Graphics
  438.         Dim D As New DrawUtils
  439.         MyBase.OnPaint(e)
  440.         G.Clear(BackColor)
  441.         If Not DrawRigid Then
  442.             G.SmoothingMode = SmoothingMode.HighQuality
  443.         End If
  444.         Dim ContRect As GraphicsPath = D.RoundRect(New Rectangle(0, 0, Width - 1, Height - 2), 5)
  445.         Dim ContRectHighlight As GraphicsPath = D.RoundRect(New Rectangle(0, 1, Width - 1, Height - 2), 5)
  446.         Select Case State
  447.             Case MouseState.None
  448.                 Dim ContGrad As New LinearGradientBrush(New Point(0, 0), New Point(0, Height), ColMed, ColLow)
  449.  
  450.                 G.FillPath(ContGrad, ContRect)
  451.                 G.DrawPath(New Pen(ColHigh), ContRectHighlight)
  452.                 G.DrawPath(New Pen(ColDark), ContRect)
  453.  
  454.                 D.DrawTextWithShadow(G, New Rectangle(0, 0, Width, Height), Text, Font, HorizontalAlignment.Center, Color.FromArgb(146, 149, 152))
  455.             Case MouseState.Down
  456.                 Dim ContGrad As New LinearGradientBrush(New Point(0, 0), New Point(0, Height), ColLow, ColDark)
  457.                 Dim ContRectHighlight2 As GraphicsPath = D.RoundRect(New Rectangle(0, 0, Width - 1, Height - 1), 5)
  458.                 G.FillPath(ContGrad, ContRect)
  459.                 G.DrawPath(New Pen(ColMed), ContRectHighlight)
  460.                 G.DrawPath(New Pen(ColHigh), ContRectHighlight2)
  461.                 G.DrawPath(New Pen(ColDark), ContRect)
  462.  
  463.                 D.DrawTextWithShadow(G, New Rectangle(0, 0, Width, Height), Text, Font, HorizontalAlignment.Center, Color.FromArgb(67, 69, 74))
  464.             Case MouseState.Over
  465.                 Dim ContGrad As New LinearGradientBrush(New Point(0, 0), New Point(0, Height), ColHigh, ColMed)
  466.  
  467.                 G.FillPath(ContGrad, ContRect)
  468.                 G.DrawPath(New Pen(Color.FromArgb(133, 133, 133)), ContRectHighlight)
  469.                 G.DrawPath(New Pen(ColDark), ContRect)
  470.  
  471.                 D.DrawTextWithShadow(G, New Rectangle(0, 0, Width, Height), Text, Font, HorizontalAlignment.Center, Color.FromArgb(162, 165, 168))
  472.         End Select
  473.     End Sub
  474. End Class
  475. Public Class DeimosGroupbox : Inherits ContainerControl
  476. #Region " Control Help - MouseState & Flicker Control"
  477.  
  478.     Private ColLow, ColMed, ColHigh, ColDark As Color
  479.     Public Property BoxColor As Color = Color.FromArgb(57, 59, 64)
  480.     Public Property DrawRigid As Boolean = False
  481.     Public Property DrawBoxTitle As Boolean = False
  482.     Protected Overrides Sub OnPaintBackground(ByVal pevent As PaintEventArgs)
  483.     End Sub
  484.     Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
  485.         MyBase.OnTextChanged(e)
  486.         Invalidate()
  487.     End Sub
  488.     Protected Overrides Sub OnSizeChanged(ByVal e As EventArgs)
  489.         MyBase.OnSizeChanged(e)
  490.         Invalidate()
  491.     End Sub
  492. #End Region
  493.     Sub New()
  494.         MyBase.New()
  495.         Text = ""
  496.         Size = New Size(New Point(80, 35))
  497.         BackColor = Color.FromArgb(55, 58, 61)
  498.         ColHigh = Color.FromArgb(96, 98, 103)
  499.         ColMed = Color.FromArgb(57, 59, 64)
  500.         ColLow = Color.FromArgb(35, 37, 40)
  501.         ColDark = Color.FromArgb(22, 22, 22)
  502.         Font = New Font("Segoe UI", 10.0F)
  503.         DoubleBuffered = True
  504.     End Sub
  505.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  506.         Dim G As Graphics = e.Graphics
  507.         Dim D As New DrawUtils
  508.         MyBase.OnPaint(e)
  509.         G.Clear(BackColor)
  510.         If Not DrawRigid Then
  511.             G.SmoothingMode = SmoothingMode.HighQuality
  512.         End If
  513.         Dim ContRect As GraphicsPath = D.RoundRect(New Rectangle(0, 0, Width - 1, Height - 2), 5)
  514.         Dim ContRectHighlight As GraphicsPath = D.RoundRect(New Rectangle(0, 1, Width - 1, Height - 2), 5)
  515.         Dim ContGrad As New LinearGradientBrush(New Point(0, 0), New Point(0, Height), ColMed, ColLow)
  516.  
  517.         G.FillPath(New SolidBrush(BoxColor), ContRect)
  518.         G.DrawPath(New Pen(ColHigh), ContRectHighlight)
  519.         G.DrawPath(New Pen(ColDark), ContRect)
  520.         If DrawBoxTitle Then
  521.             G.SmoothingMode = SmoothingMode.None
  522.             G.DrawLine(New Pen(ColMed), New Point(1, 17), New Point(Width - 2, 17))
  523.             G.DrawLine(New Pen(ColDark), New Point(0, 18), New Point(Width - 1, 18))
  524.             D.DrawTextWithShadow(G, New Rectangle(3, 1, 15, 20), Text, Font, HorizontalAlignment.Left, Color.FromArgb(146, 149, 152))
  525.             Dim Shade As New LinearGradientBrush(New Point(0, 18), New Point(0, 30), ColLow, Color.Transparent)
  526.             G.FillRectangle(Shade, New Rectangle(0, 19, Width, 10))
  527.             ' G.DrawString(Text, Font, Brushes.Black, New Point(5, 1)))
  528.            ' G.DrawString(Text, Font, New SolidBrush(Color.FromArgb(146, 149, 152)), New Point(4, 0))
  529.        End If
  530.     End Sub
  531. End Class
  532. Public Class DeimosLabel : Inherits Control
  533. #Region " Control Help - MouseState & Flicker Control"
  534.     Private ColLow, ColMed, ColHigh, ColDark As Color
  535.     Protected Overrides Sub OnPaintBackground(ByVal pevent As PaintEventArgs)
  536.     End Sub
  537.     Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
  538.         MyBase.OnTextChanged(e)
  539.         Invalidate()
  540.     End Sub
  541.     Protected Overrides Sub OnSizeChanged(ByVal e As EventArgs)
  542.         MyBase.OnSizeChanged(e)
  543.         Invalidate()
  544.     End Sub
  545.     Public Sub PaintExternal(e As PaintEventArgs)
  546.         OnPaint(e)
  547.     End Sub
  548.     Public Sub SizeChangeExternal(e As Size)
  549.         Size = e
  550.         Invalidate()
  551.     End Sub
  552. #End Region
  553.     Sub New()
  554.         MyBase.New()
  555.         Text = ""
  556.         Size = New Size(New Point(80, 35))
  557.         BackColor = Color.FromArgb(55, 58, 61)
  558.         ColHigh = Color.FromArgb(96, 98, 103)
  559.         ColMed = Color.FromArgb(57, 59, 64)
  560.         ColLow = Color.FromArgb(35, 37, 40)
  561.         ColDark = Color.FromArgb(22, 22, 22)
  562.         Font = New Font("Segoe UI", 10.0F)
  563.         DoubleBuffered = True
  564.     End Sub
  565.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  566.         Dim G As Graphics = e.Graphics
  567.         Dim D As New DrawUtils
  568.         MyBase.OnPaint(e)
  569.         G.Clear(BackColor)
  570.  
  571.         G.DrawString(Text, Font, Brushes.Black, New Point(5, -5))
  572.         G.DrawString(Text, Font, New SolidBrush(Color.FromArgb(146, 149, 152)), New Point(4, -4))
  573.  
  574.         '  D.DrawTextWithShadow(G, New Rectangle(3, 0, 15, 10), Text, Font, HorizontalAlignment.Left, Color.FromArgb(146, 149, 152))
  575.    End Sub
  576. End Class
  577. Public Class DeimosTextbox : Inherits Control
  578.     Private WithEvents txtbox As New TextBox
  579. #Region " Control Help - Properties & Flicker Control "
  580.     Public Property TxtReadOnly As Boolean
  581.     Private ColLow, ColMed, ColHigh, ColDark As Color
  582.     Private _maxchars As Integer = 30000
  583.     Private _SingleLineHeight As Integer = 21
  584.     Public Property DrawRigid As Boolean = False
  585.     Public Property MaxCharacters() As Integer
  586.         Get
  587.             Return _maxchars
  588.         End Get
  589.         Set(ByVal v As Integer)
  590.             _maxchars = v
  591.             Invalidate()
  592.         End Set
  593.     End Property
  594.     Public Property IsMultiline() As Boolean
  595.         Get
  596.             Return txtbox.Multiline
  597.         End Get
  598.         Set(ByVal v As Boolean)
  599.             txtbox.Multiline = v
  600.             Invalidate()
  601.         End Set
  602.     End Property
  603.     Public Property TextboxColor() As Color
  604.         Get
  605.             Return txtbox.BackColor
  606.         End Get
  607.         Set(ByVal v As Color)
  608.             txtbox.BackColor = v
  609.             Invalidate()
  610.         End Set
  611.     End Property
  612.     Private _align As HorizontalAlignment
  613.     Public Property TextAlign() As HorizontalAlignment
  614.         Get
  615.             Return _align
  616.         End Get
  617.         Set(ByVal v As HorizontalAlignment)
  618.             _align = v
  619.             Invalidate()
  620.         End Set
  621.     End Property
  622.     Protected Overrides Sub OnPaintBackground(ByVal pevent As System.Windows.Forms.PaintEventArgs)
  623.     End Sub
  624.     Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
  625.         MyBase.OnTextChanged(e)
  626.         Invalidate()
  627.     End Sub
  628.     Protected Overrides Sub OnBackColorChanged(ByVal e As System.EventArgs)
  629.         MyBase.OnBackColorChanged(e)
  630.         Invalidate()
  631.     End Sub
  632.     Protected Overrides Sub OnForeColorChanged(ByVal e As System.EventArgs)
  633.         MyBase.OnForeColorChanged(e)
  634.         txtbox.ForeColor = ForeColor
  635.         Invalidate()
  636.     End Sub
  637.     Protected Overrides Sub OnSizeChanged(ByVal e As System.EventArgs)
  638.         MyBase.OnSizeChanged(e)
  639.         If Not Size.Height = _SingleLineHeight Then
  640.             tempSize = Size
  641.         End If
  642.         txtbox.Size = New Size(Width - 6, Height - 6)
  643.         Invalidate()
  644.     End Sub
  645.     Protected Overrides Sub OnFontChanged(ByVal e As System.EventArgs)
  646.         MyBase.OnFontChanged(e)
  647.         txtbox.Font = Font
  648.     End Sub
  649.     Protected Overrides Sub OnGotFocus(ByVal e As System.EventArgs)
  650.         MyBase.OnGotFocus(e)
  651.         txtbox.Focus()
  652.     End Sub
  653.     Sub TextChngTxtBox() Handles txtbox.TextChanged
  654.         Text = txtbox.Text
  655.     End Sub
  656.     Sub TextChng() Handles MyBase.TextChanged
  657.         txtbox.Text = Text
  658.     End Sub
  659.     Sub SetupTextbox()
  660.         txtbox.Multiline = True
  661.         txtbox.BackColor = Color.FromArgb(47, 49, 54)
  662.         txtbox.ForeColor = ForeColor
  663.         txtbox.Text = String.Empty
  664.         txtbox.TextAlign = HorizontalAlignment.Center
  665.         txtbox.BorderStyle = BorderStyle.None
  666.         txtbox.Location = New Point(3, 3)
  667.         Font = New Font("Segoe UI", 8.5F)
  668.         txtbox.Size = New Size(Width - 6, Height - 6)
  669.     End Sub
  670. #End Region
  671.     Sub New()
  672.         MyBase.New()
  673.         SetupTextbox()
  674.         ColHigh = Color.FromArgb(96, 98, 103)
  675.         ColMed = Color.FromArgb(57, 59, 64)
  676.         ColLow = Color.FromArgb(35, 37, 40)
  677.         ColDark = Color.FromArgb(22, 22, 22)
  678.         BackColor = ColMed
  679.         Controls.Add(txtbox)
  680.         Text = ""
  681.         ForeColor = Color.FromArgb(146, 149, 152)
  682.         Size = New Size(135, 35)
  683.         DoubleBuffered = True
  684.     End Sub
  685.     Private tempSize As Size
  686.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  687.         txtbox.ReadOnly = TxtReadOnly
  688.         Dim G As Graphics = e.Graphics
  689.         Dim D As New DrawUtils
  690.         MyBase.OnPaint(e)
  691.         txtbox.TextAlign = TextAlign
  692.         If Not txtbox.Multiline Then
  693.             txtbox.Location = New Point(6, txtbox.Top)
  694.             If (txtbox.Width + txtbox.Left) > Width - 3 And txtbox.Width > 5 Then
  695.                 txtbox.Width -= 1
  696.             End If
  697.             Size = New Size(New Point(Width, _SingleLineHeight))
  698.         Else
  699.             txtbox.Location = New Point(3, txtbox.Top)
  700.             Size = tempSize
  701.         End If
  702.         G.Clear(BackColor)
  703.         Dim ContRect As GraphicsPath = D.RoundRect(New Rectangle(0, 0, Width - 1, Height - 2), 5)
  704.         Dim ContRectHighlight As GraphicsPath = D.RoundRect(New Rectangle(0, 1, Width - 1, Height - 2), 5)
  705.         If Not DrawRigid Then
  706.             G.SmoothingMode = SmoothingMode.HighQuality
  707.         End If
  708.         G.FillPath(New SolidBrush(Color.FromArgb(47, 49, 54)), ContRect)
  709.         G.DrawPath(New Pen(ColHigh), ContRectHighlight)
  710.         G.DrawPath(New Pen(ColDark), ContRect)
  711.     End Sub
  712. End Class
  713. Public Class DeimosTabControl : Inherits TabControl
  714. #Region " Control Help - Movement & Flicker Control "
  715.     Public Property TabRectOffset As Integer = 2
  716.     Public Property TabRectRoundness As Integer = 6
  717.     Public Property BGColor As Color = Color.FromArgb(35, 37, 40)
  718.     Protected Overrides Sub CreateHandle()
  719.         MyBase.CreateHandle()
  720.         Alignment = TabAlignment.Top
  721.     End Sub
  722.     Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  723.         MyBase.OnMouseDown(e)
  724.         Invalidate()
  725.     End Sub
  726. #End Region
  727.     Private ColLow, ColMed, ColHigh, ColDark As Color
  728.     Sub New()
  729.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or ControlStyles.DoubleBuffer, True)
  730.         ItemSize = New Size(0, 25) '34
  731.        Padding = New Size(13, 0) '24
  732.  
  733.         ColHigh = Color.FromArgb(96, 98, 103)
  734.         ColMed = Color.FromArgb(57, 59, 64)
  735.         ColLow = Color.FromArgb(35, 37, 40)
  736.         ColDark = Color.FromArgb(22, 22, 22)
  737.         ForeColor = Color.FromArgb(146, 149, 152)
  738.         Font = New Font("Segoe UI", 10.0F)
  739.         DoubleBuffered = True
  740.         BackColor = Color.FromArgb(57, 59, 64)
  741.     End Sub
  742.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  743.         Dim G As Graphics = e.Graphics
  744.         Dim D As New DrawUtils
  745.         Dim FontColor As New Color
  746.  
  747.         MyBase.OnPaint(e)
  748.         G.Clear(BGColor)
  749.         G.SmoothingMode = SmoothingMode.HighQuality
  750.  
  751.         For i = 0 To TabCount - 1
  752.             Dim TabRect As Rectangle = GetTabRect(i)
  753.             Dim HighlightRect As Rectangle = GetTabRect(i)
  754.  
  755.             TabRect = New Rectangle(TabRect.X + TabRectOffset, 0, TabRect.Width - (TabRectOffset * 2), TabRect.Height)
  756.             HighlightRect = New Rectangle(HighlightRect.X + TabRectOffset, 1, HighlightRect.Width - (TabRectOffset * 2), HighlightRect.Height)
  757.  
  758.             Dim RectPath As GraphicsPath = D.RoundedTopRect(TabRect, TabRectRoundness)
  759.             Dim HighlightPath As GraphicsPath = D.RoundedTopRect(HighlightRect, TabRectRoundness)
  760.             Dim TopGradient As New LinearGradientBrush(New Point(0, 0), New Point(0, TabRect.Height), ColMed, ColLow)
  761.             G.FillPath(TopGradient, RectPath)
  762.             G.DrawPath(New Pen(ColHigh), HighlightPath)
  763.             G.DrawPath(New Pen(ColDark), RectPath)
  764.             If i = SelectedIndex Then
  765.                 FontColor = Color.White
  766.             Else
  767.                 FontColor = Color.FromArgb(146, 149, 152)
  768.             End If
  769.             Dim titleX As Integer = (TabRect.Location.X + TabRect.Width / 2) - (G.MeasureString(TabPages(i).Text, Font).Width / 2)
  770.             Dim titleY As Integer = (TabRect.Location.Y + TabRect.Height / 2) - (G.MeasureString(TabPages(i).Text, Font).Height / 2)
  771.             D.DrawTextWithShadow(G, New Rectangle(titleX, titleY, 666, 25), TabPages(i).Text, Font, HorizontalAlignment.Left, FontColor)
  772.             ' G.DrawString(TabPages(i).Text, Font, New SolidBrush(FontColor), New Point(titleX, titleY))
  773.  
  774.             Try : TabPages(i).BackColor = Color.FromArgb(57, 59, 64) : Catch : End Try
  775.         Next
  776.         G.SmoothingMode = SmoothingMode.None
  777.         Dim WorkRectangle As GraphicsPath = D.RoundRect(New Rectangle(0, 24, Width - 1, Height - 26), 2)
  778.         G.FillPath(New SolidBrush(Color.FromArgb(45, 47, 50)), WorkRectangle)
  779.         G.DrawPath(New Pen(ColDark), WorkRectangle)
  780.         G.DrawRectangle(New Pen(ColDark), New Rectangle(3, 28, Width - 7, Height - 32))
  781.     End Sub
  782. End Class
  783. Public Class DeimosTabControlAlt : Inherits TabControl
  784. #Region " Control Help - Movement & Flicker Control "
  785.     Public Property TabRectRoundness As Integer = 5
  786.     Public Property BGColor As Color = Color.FromArgb(35, 37, 40)
  787.     Protected Overrides Sub CreateHandle()
  788.         MyBase.CreateHandle()
  789.         Alignment = TabAlignment.Left
  790.     End Sub
  791.     Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  792.         MyBase.OnMouseDown(e)
  793.         Invalidate()
  794.     End Sub
  795. #End Region
  796.     Private ColLow, ColMed, ColHigh, ColDark As Color
  797.     Sub New()
  798.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or ControlStyles.DoubleBuffer, True)
  799.         SizeMode = TabSizeMode.Fixed
  800.         ItemSize = New Size(30, 115)
  801.  
  802.         ColHigh = Color.FromArgb(96, 98, 103)
  803.         ColMed = Color.FromArgb(57, 59, 64)
  804.         ColLow = Color.FromArgb(35, 37, 40)
  805.         ColDark = Color.FromArgb(22, 22, 22)
  806.         ForeColor = Color.FromArgb(146, 149, 152)
  807.         Font = New Font("Segoe UI", 10.0F)
  808.         DoubleBuffered = True
  809.         BackColor = Color.FromArgb(57, 59, 64)
  810.     End Sub
  811.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  812.         Dim G As Graphics = e.Graphics
  813.         Dim D As New DrawUtils
  814.         Dim FontColor As New Color
  815.  
  816.         MyBase.OnPaint(e)
  817.         G.Clear(BGColor)
  818.         G.SmoothingMode = SmoothingMode.HighQuality
  819.  
  820.         'Dim ContGrad As New LinearGradientBrush(New Point(0, (30 * i)), New Point(0, (30 * i) + 30), ColMed, ColLow)
  821.        'G.FillRectangle(ContGrad, D.RoundRect(New Rectangle(5, (30 * i), 100, 30), TabRectRoundness))
  822.        'G.DrawPath(New Pen(ColHigh), D.RoundRect(New Rectangle(5, (30 * i) + 1, 100, 30), TabRectRoundness))
  823.        'G.DrawPath(New Pen(ColDark), D.RoundRect(New Rectangle(5, (30 * i), 100, 30), TabRectRoundness))
  824.  
  825.         For i = 0 To TabCount - 1
  826.             'Dim x2 As Rectangle = New Rectangle(New Point(GetTabRect(i).+ (30 * i)+ (30 * i).X - 2, 10 + (i * 30)), New Size(GetTabRect(i).Width + 3, GetTabRect(i).Height - 1))
  827.            Dim textrectangle As New Rectangle(5, 30, 100, 30 + (60 * i))
  828.  
  829.  
  830.             If SelectedIndex = i Then
  831.                 Dim ContGrad As New LinearGradientBrush(New Point(0, (30 * i)), New Point(0, (30 * i) + 30), ColMed, ColLow)
  832.                 G.FillPath(ContGrad, D.RoundRect(New Rectangle(5, (30 * i), 150, 30), TabRectRoundness))
  833.                 G.DrawPath(New Pen(ColHigh), D.RoundRect(New Rectangle(5, (30 * i) + 1, 150, 30), TabRectRoundness))
  834.                 G.DrawPath(Pens.Black, D.RoundRect(New Rectangle(5, (30 * i), 150, 30), TabRectRoundness))
  835.             End If
  836.            
  837.  
  838.             If ImageList IsNot Nothing Then
  839.                 Try
  840.                     If ImageList.Images(TabPages(i).ImageIndex) IsNot Nothing Then
  841.                         G.DrawImage(ImageList.Images(TabPages(i).ImageIndex), New Point(textrectangle.Location.X + 8, textrectangle.Location.Y + 6))
  842.                         D.DrawTextWithShadow(G, textrectangle, "      " & TabPages(i).Text, Font, HorizontalAlignment.Left, ColHigh)
  843.                     Else
  844.                         D.DrawTextWithShadow(G, textrectangle, TabPages(i).Text, Font, HorizontalAlignment.Left, ColHigh)
  845.                         D.DrawTextWithShadow(G, textrectangle, TabPages(i).Text, Font, HorizontalAlignment.Left, ColHigh)
  846.                     End If
  847.                 Catch ex As Exception
  848.                     D.DrawTextWithShadow(G, textrectangle, TabPages(i).Text, Font, HorizontalAlignment.Left, ColHigh)
  849.                 End Try
  850.             Else
  851.                 D.DrawTextWithShadow(G, textrectangle, TabPages(i).Text, Font, HorizontalAlignment.Center, ColHigh)
  852.             End If
  853.  
  854.             Try : TabPages(i).BackColor = Color.FromArgb(57, 59, 64) : Catch : End Try
  855.         Next
  856.  
  857.         G.SmoothingMode = SmoothingMode.None
  858.         Dim WorkRectangle As GraphicsPath = D.RoundRect(New Rectangle(115, 0, Width - 116, Height - 1), 2)
  859.         G.FillPath(New SolidBrush(Color.FromArgb(45, 47, 50)), WorkRectangle)
  860.         G.DrawPath(New Pen(ColDark), WorkRectangle)
  861.         G.DrawRectangle(New Pen(ColDark), New Rectangle(118, 3, Width - 122, Height - 7))
  862.     End Sub
  863. End Class
  864. Public Class DeimosProgressBar : Inherits Control
  865. #Region " Control Help - MouseState & Flicker Control"
  866.     Public Property DrawRigid As Boolean = False
  867.     Public Property BarMin As Integer = 0
  868.     Public Property BarMax As Integer = 100
  869.     Public Property BarValue As Integer = 50
  870.     Public Property BarBGColor As Color = Color.FromArgb(35, 37, 40)
  871.  
  872.     Public Sub AddValue(ByVal amount As Integer)
  873.         If BarValue + amount <= BarMax Then
  874.             BarValue += amount
  875.         End If
  876.         Invalidate()
  877.     End Sub
  878.  
  879.     Private ColLow, ColMed, ColHigh, ColDark As Color
  880.     Protected Overrides Sub OnPaintBackground(ByVal pevent As PaintEventArgs)
  881.     End Sub
  882.     Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
  883.         MyBase.OnTextChanged(e)
  884.         Invalidate()
  885.     End Sub
  886.     Protected Overrides Sub OnSizeChanged(ByVal e As EventArgs)
  887.         MyBase.OnSizeChanged(e)
  888.         Invalidate()
  889.     End Sub
  890.     Public Sub PaintExternal(e As PaintEventArgs)
  891.         OnPaint(e)
  892.     End Sub
  893.     Public Sub SizeChangeExternal(e As Size)
  894.         Size = e
  895.         Invalidate()
  896.     End Sub
  897. #End Region
  898.     Sub New()
  899.         MyBase.New()
  900.         Text = ""
  901.         Size = New Size(New Point(100, 10))
  902.         BackColor = Color.FromArgb(55, 58, 61)
  903.         ColHigh = Color.FromArgb(96, 98, 103)
  904.         ColMed = Color.FromArgb(57, 59, 64)
  905.         ColLow = Color.FromArgb(35, 37, 40)
  906.         ColDark = Color.FromArgb(22, 22, 22)
  907.         Font = New Font("Segoe UI", 10.0F)
  908.         DoubleBuffered = True
  909.     End Sub
  910.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  911.         Dim G As Graphics = e.Graphics
  912.         Dim D As New DrawUtils
  913.         MyBase.OnPaint(e)
  914.         G.Clear(BackColor)
  915.  
  916.         Dim ContRect As GraphicsPath = D.RoundRect(New Rectangle(0, 0, Width - 1, Height - 2), 5)
  917.         Dim ContGrad As New LinearGradientBrush(New Point(0, 0), New Point(0, Height), ColMed, ColLow)
  918.         Dim ContRectHighlight As GraphicsPath = D.RoundRect(New Rectangle(0, 1, Width - 1, Height - 2), 5)
  919.  
  920.         Dim ContRectInner As GraphicsPath = D.RoundRect(New Rectangle(0, 0, (Width - 1) * (BarValue / BarMax), (Height - 2)), 5)
  921.         Dim ContGradInner As New LinearGradientBrush(New Point(0, 0), New Point(0, Height), ColMed, ColLow)
  922.         Dim ContRectInnerHighlight As GraphicsPath = D.RoundRect(New Rectangle(1, 0, (Width - 1) * (BarValue / BarMax), Height - 2), 5)
  923.         If Not DrawRigid Then G.SmoothingMode = SmoothingMode.HighQuality
  924.         G.FillPath(New SolidBrush(BarBGColor), ContRect)
  925.         G.FillPath(ContGrad, ContRectInner)
  926.         G.DrawPath(New Pen(ColMed), ContRectInnerHighlight)
  927.         G.DrawPath(New Pen(ColDark), ContRectInner)
  928.         G.DrawPath(New Pen(ColHigh), ContRectHighlight)
  929.         G.DrawPath(New Pen(ColDark), ContRect)
  930.         D.DrawTextWithShadow(G, New Rectangle(3, 0, Width, Height), Text, Font, HorizontalAlignment.Center, Color.FromArgb(146, 149, 152))
  931.     End Sub
  932. End Class
  933. Public Class DeimosSwitch : Inherits Control
  934. #Region " Control Help - MouseState & Flicker Control"
  935.     Public Property ToggleState As Boolean = False
  936.     Private ColLow, ColMed, ColHigh, ColDark As Color
  937.     Public Property DrawRigid As Boolean = False
  938.     Public Property DrawOnOffText As Boolean = True
  939.     Protected Overrides Sub OnPaintBackground(ByVal pevent As PaintEventArgs)
  940.     End Sub
  941.     Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
  942.         MyBase.OnTextChanged(e)
  943.         Invalidate()
  944.     End Sub
  945.     Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  946.         MyBase.OnMouseDown(e)
  947.         ToggleState = Not ToggleState
  948.         Invalidate()
  949.     End Sub
  950.     Protected Overrides Sub OnSizeChanged(ByVal e As EventArgs)
  951.         MyBase.OnSizeChanged(e)
  952.         Invalidate()
  953.     End Sub
  954.     Public Function IsChecked() As Boolean
  955.         Return ToggleState
  956.     End Function
  957.     Public Sub SizeChangeExternal(e As Size)
  958.         Size = e
  959.         Invalidate()
  960.     End Sub
  961. #End Region
  962.     Sub New()
  963.         MyBase.New()
  964.         Text = ""
  965.         Size = New Size(New Point(66, 26))
  966.         BackColor = Color.FromArgb(57, 59, 64)
  967.         ColHigh = Color.FromArgb(96, 98, 103)
  968.         ColMed = Color.FromArgb(57, 59, 64)
  969.         ColLow = Color.FromArgb(35, 37, 40)
  970.         ColDark = Color.FromArgb(22, 22, 22)
  971.         Font = New Font("Segoe UI", 10.0F)
  972.         DoubleBuffered = True
  973.     End Sub
  974.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  975.         'Size = New Size(66, 26)
  976.  
  977.         Dim G As Graphics = e.Graphics
  978.         Dim D As New DrawUtils
  979.         MyBase.OnPaint(e)
  980.         G.Clear(BackColor)
  981.         If Not DrawRigid Then
  982.             G.SmoothingMode = SmoothingMode.HighQuality
  983.         End If
  984.         Dim ContRect As GraphicsPath = D.RoundRect(New Rectangle(0, 0, Width - 1, Height - 2), 5)
  985.         Dim ContRectHighlight As GraphicsPath = D.RoundRect(New Rectangle(0, 1, Width - 1, Height - 2), 5)
  986.  
  987.         If ToggleState Then
  988.             G.FillPath(New SolidBrush(Color.FromArgb(45, 47, 55)), ContRect)
  989.         Else
  990.             G.FillPath(New SolidBrush(ColLow), ContRect)
  991.         End If
  992.         G.DrawPath(New Pen(ColHigh), ContRectHighlight)
  993.         G.DrawPath(New Pen(ColDark), ContRect)
  994.  
  995.         Dim StateRect As New GraphicsPath
  996.         Dim StateRectHighlight As New GraphicsPath
  997.         Dim StateGrad As New LinearGradientBrush(New Point(0, 0), New Point(0, Height), ColMed, ColLow)
  998.         If Not ToggleState Then
  999.             StateRect = D.RoundRect(New Rectangle(0, 0, (Width / 2) - 1, Height - 2), 6)
  1000.             StateRectHighlight = D.RoundRect(New Rectangle(0, 1, (Width / 2) - 1, Height - 4), 6)
  1001.         Else
  1002.             StateRect = D.RoundRect(New Rectangle(Width / 2, 0, (Width / 2) - 1, Height - 2), 6)
  1003.             StateRectHighlight = D.RoundRect(New Rectangle(Width / 2, 1, (Width / 2) - 1, Height - 4), 6)
  1004.         End If
  1005.  
  1006.         G.FillPath(StateGrad, StateRect)
  1007.         G.DrawPath(New Pen(New LinearGradientBrush(New Point(0, 0), New Point(0, Height), ColHigh, ColDark)), StateRectHighlight)
  1008.         G.DrawPath(New Pen(ColDark), StateRect)
  1009.  
  1010.         If DrawOnOffText Then
  1011.             If ToggleState Then
  1012.                 D.DrawTextWithShadow(G, New Rectangle(6, 0, Width - 1, Height - 2), "On", Font, HorizontalAlignment.Left, ColHigh)
  1013.             Else
  1014.                 D.DrawTextWithShadow(G, New Rectangle(0, 0, Width - 1, Height - 2), "Off", Font, HorizontalAlignment.Right, ColHigh)
  1015.             End If
  1016.         End If
  1017.     End Sub
  1018. End Class
  1019. Public Class DeimosRadioButton : Inherits Control
  1020. #Region " Control Help - MouseState & Flicker Control"
  1021.     Public Property Checked As Boolean = False
  1022.     Private ColLow, ColMed, ColHigh, ColDark As Color
  1023.     Protected Overrides Sub OnPaintBackground(ByVal pevent As PaintEventArgs)
  1024.     End Sub
  1025.     Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
  1026.         MyBase.OnTextChanged(e)
  1027.         Invalidate()
  1028.     End Sub
  1029.     Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  1030.         MyBase.OnMouseDown(e)
  1031.         Checked = Not Checked
  1032.         For Each C As Control In Parent.Controls
  1033.             If C IsNot Me AndAlso TypeOf C Is DeimosRadioButton Then
  1034.                 DirectCast(C, DeimosRadioButton).Checked = False
  1035.                 DirectCast(C, DeimosRadioButton).Invalidate()
  1036.             End If
  1037.         Next
  1038.         Invalidate()
  1039.     End Sub
  1040.     Protected Overrides Sub OnSizeChanged(ByVal e As EventArgs)
  1041.         MyBase.OnSizeChanged(e)
  1042.         Invalidate()
  1043.     End Sub
  1044.     Public Function IsChecked() As Boolean
  1045.         Return Checked
  1046.     End Function
  1047.     Public Sub SizeChangeExternal(e As Size)
  1048.         Size = e
  1049.         Invalidate()
  1050.     End Sub
  1051. #End Region
  1052.     Sub New()
  1053.         MyBase.New()
  1054.         Size = New Size(New Point(150, 26))
  1055.         BackColor = Color.FromArgb(57, 59, 64)
  1056.         ColHigh = Color.FromArgb(96, 98, 103)
  1057.         ColMed = Color.FromArgb(57, 59, 64)
  1058.         ColLow = Color.FromArgb(35, 37, 40)
  1059.         ColDark = Color.FromArgb(22, 22, 22)
  1060.         Font = New Font("Segoe UI", 10.0F)
  1061.         ForeColor = ColHigh
  1062.         DoubleBuffered = True
  1063.     End Sub
  1064.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  1065.         Height = 16
  1066.  
  1067.         Dim G As Graphics = e.Graphics
  1068.         Dim D As New DrawUtils
  1069.         MyBase.OnPaint(e)
  1070.         G.Clear(BackColor)
  1071.         G.SmoothingMode = SmoothingMode.HighQuality
  1072.  
  1073.         Dim ContGrad As New LinearGradientBrush(New Point(0, 0), New Point(0, Height), ColMed, ColLow)
  1074.         Dim ContInnerGrad As New LinearGradientBrush(New Point(0, 1), New Point(0, Height - 1), ColHigh, ColMed)
  1075.  
  1076.         G.FillEllipse(ContGrad, New Rectangle(0, 0, 13, 13))
  1077.         ' G.DrawEllipse(New Pen(New LinearGradientBrush(New Point(0, 0), New Point(0, Height), ColHigh, ColMed)), New Rectangle(0, 1, 13, 13))
  1078.        G.DrawEllipse(New Pen(ColHigh), New Rectangle(0, 1, 13, 13))
  1079.         G.DrawEllipse(New Pen(Color.FromArgb(8, 11, 15)), New Rectangle(0, 0, 13, 13))
  1080.  
  1081.         If Checked Then
  1082.             G.FillEllipse(ContInnerGrad, New Rectangle(1, 1, 11, 11))
  1083.             'G.DrawEllipse(Pens.Black, New Rectangle(2, 2, 9, 9))
  1084.        End If
  1085.         D.DrawTextWithShadow(G, New Rectangle(20, 0, Width - 1, Height - 2), Text, Font, HorizontalAlignment.Left, ForeColor)
  1086.     End Sub
  1087. End Class
  1088. Public Class DeimosCheckbox : Inherits Control
  1089. #Region " Control Help - MouseState & Flicker Control"
  1090.     Public Property Checked As Boolean = False
  1091.     Private ColLow, ColMed, ColHigh, ColDark As Color
  1092.     Public Property DrawRigid As Boolean = False
  1093.     Protected Overrides Sub OnPaintBackground(ByVal pevent As PaintEventArgs)
  1094.     End Sub
  1095.     Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
  1096.         MyBase.OnTextChanged(e)
  1097.         Invalidate()
  1098.     End Sub
  1099.     Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  1100.         MyBase.OnMouseDown(e)
  1101.         Checked = Not Checked
  1102.         Invalidate()
  1103.     End Sub
  1104.     Protected Overrides Sub OnSizeChanged(ByVal e As EventArgs)
  1105.         MyBase.OnSizeChanged(e)
  1106.         Invalidate()
  1107.     End Sub
  1108.     Public Function IsChecked() As Boolean
  1109.         Return Checked
  1110.     End Function
  1111.     Public Sub SizeChangeExternal(e As Size)
  1112.         Size = e
  1113.         Invalidate()
  1114.     End Sub
  1115. #End Region
  1116.     Sub New()
  1117.         MyBase.New()
  1118.         Size = New Size(New Point(131, 26))
  1119.         BackColor = Color.FromArgb(57, 59, 64)
  1120.         ColHigh = Color.FromArgb(96, 98, 103)
  1121.         ColMed = Color.FromArgb(57, 59, 64)
  1122.         ColLow = Color.FromArgb(35, 37, 40)
  1123.         ColDark = Color.FromArgb(22, 22, 22)
  1124.         Font = New Font("Segoe UI", 10.0F)
  1125.         ForeColor = ColHigh
  1126.         DoubleBuffered = True
  1127.     End Sub
  1128.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  1129.         Height = 16
  1130.  
  1131.         Dim G As Graphics = e.Graphics
  1132.         Dim D As New DrawUtils
  1133.         MyBase.OnPaint(e)
  1134.         G.Clear(BackColor)
  1135.         If Not DrawRigid Then
  1136.             G.SmoothingMode = SmoothingMode.HighQuality
  1137.         End If
  1138.         Dim ContRect As GraphicsPath = D.RoundRect(New Rectangle(0, 0, 13, 13), 2)
  1139.         Dim ContRectHighlight As GraphicsPath = D.RoundRect(New Rectangle(0, 1, 13, 13), 2)
  1140.         Dim StateGrad As New LinearGradientBrush(New Point(0, 0), New Point(0, Height), ColMed, ColLow)
  1141.         If Checked Then
  1142.             G.FillPath(New LinearGradientBrush(New Point(0, 0), New Point(0, Height), ColHigh, ColMed), ContRect)
  1143.         Else
  1144.             G.FillPath(StateGrad, ContRect)
  1145.         End If
  1146.         G.DrawPath(New Pen(ColHigh), ContRectHighlight)
  1147.         G.DrawPath(New Pen(ColDark), ContRect)
  1148.         D.DrawTextWithShadow(G, New Rectangle(20, 0, Width - 1, Height - 2), Text, Font, HorizontalAlignment.Left, ForeColor)
  1149.     End Sub
  1150. End Class
  1151. '|===|  Theme Utility stuff
  1152. '|===========================================================|
  1153. Enum MouseState As Byte
  1154.     None = 0
  1155.     Over = 1
  1156.     Down = 2
  1157.     Block = 3
  1158. End Enum
  1159. Class DrawUtils
  1160.     Public Sub DrawTextWithShadow(ByVal G As Graphics, ByVal ContRect As Rectangle, ByVal Text As String, ByVal TFont As Font, ByVal TAlign As HorizontalAlignment, ByVal TColor As Color)
  1161.         DrawText(G, New Rectangle(ContRect.X, ContRect.Y + 2, ContRect.Width + 1, ContRect.Height + 2), Text, TFont, TAlign, Color.Black)
  1162.         DrawText(G, ContRect, Text, TFont, TAlign, TColor)
  1163.     End Sub
  1164.     Public Sub DrawText(ByVal G As Graphics, ByVal ContRect As Rectangle, ByVal Text As String, ByVal TFont As Font, ByVal TAlign As HorizontalAlignment, ByVal TColor As Color)
  1165.         If String.IsNullOrEmpty(Text) Then Return
  1166.         Dim TextSize As Size = G.MeasureString(Text, TFont).ToSize
  1167.         Dim _Brush As SolidBrush = New SolidBrush(TColor)
  1168.  
  1169.         Select Case TAlign
  1170.             Case HorizontalAlignment.Left
  1171.                 G.DrawString(Text, TFont, _Brush, ContRect.X, ContRect.Height \ 2 - TextSize.Height \ 2)
  1172.             Case HorizontalAlignment.Right
  1173.                 G.DrawString(Text, TFont, _Brush, ContRect.Width - TextSize.Width - 5, ContRect.Height \ 2 - TextSize.Height \ 2)
  1174.             Case HorizontalAlignment.Center
  1175.                 G.DrawString(Text, TFont, _Brush, ContRect.Width \ 2 - TextSize.Width \ 2 + 3, ContRect.Height \ 2 - TextSize.Height \ 2)
  1176.         End Select
  1177.     End Sub
  1178.     Public Function RoundRect(ByVal Rectangle As Rectangle, ByVal Curve As Integer) As GraphicsPath
  1179.         Dim P As GraphicsPath = New GraphicsPath()
  1180.         Dim ArcRectangleWidth As Integer = Curve * 2
  1181.         P.AddArc(New Rectangle(Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -180, 90)
  1182.         P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -90, 90)
  1183.         P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 0, 90)
  1184.         P.AddArc(New Rectangle(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 90, 90)
  1185.         P.AddLine(New Point(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y), New Point(Rectangle.X, Curve + Rectangle.Y))
  1186.         Return P
  1187.     End Function
  1188.     Public Function RoundedTopRect(ByVal Rectangle As Rectangle, ByVal Curve As Integer) As GraphicsPath
  1189.         Dim P As GraphicsPath = New GraphicsPath()
  1190.         Dim ArcRectangleWidth As Integer = Curve * 2
  1191.         P.AddArc(New Rectangle(Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -180, 90)
  1192.         P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -90, 90)
  1193.         P.AddLine(New Point(Rectangle.X + Rectangle.Width, Rectangle.Y + ArcRectangleWidth), New Point(Rectangle.X + Rectangle.Width, Rectangle.Y + Rectangle.Height))
  1194.         P.AddLine(New Point(Rectangle.X, Rectangle.Height + Rectangle.Y), New Point(Rectangle.X, Rectangle.Y + Curve))
  1195.         Return P
  1196.     End Function
  1197. End Class
Advertisement
Add Comment
Please, Sign In to add comment