daily pastebin goal
44%
SHARE
TWEET

✔ Simpla Theme [Pure GDI+] [Source] [Vb.Net] [Colorful] ✔

MephobiaHF Apr 15th, 2013 5,853 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Imports System.Drawing.Drawing2D
  2. Imports System.ComponentModel
  3.  
  4. 'PLEASE LEAVE CREDITS IN SOURCE, DO NOT REDISTRIBUTE!
  5.  
  6. '--------------------- [ Theme ] --------------------
  7. 'Creator: Mephobia
  8. 'Contact: Mephobia.HF (Skype)
  9. 'Created: 4.15.2013
  10. 'Changed: 4.15.2013
  11. '-------------------- [ /Theme ] ---------------------
  12.  
  13. 'PLEASE LEAVE CREDITS IN SOURCE, DO NOT REDISTRIBUTE!
  14.  
  15. Enum MouseState As Byte
  16.     None = 0
  17.     Over = 1
  18.     Down = 2
  19.     Block = 3
  20. End Enum
  21. Module Draw
  22.     Public Function RoundRect(ByVal Rectangle As Rectangle, ByVal Curve As Integer) As GraphicsPath
  23.         Dim P As GraphicsPath = New GraphicsPath()
  24.         Dim ArcRectangleWidth As Integer = Curve * 2
  25.         P.AddArc(New Rectangle(Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -180, 90)
  26.         P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -90, 90)
  27.         P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 0, 90)
  28.         P.AddArc(New Rectangle(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 90, 90)
  29.         P.AddLine(New Point(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y), New Point(Rectangle.X, Curve + Rectangle.Y))
  30.         Return P
  31.     End Function
  32.     Public Function RoundRect(ByVal X As Integer, ByVal Y As Integer, ByVal Width As Integer, ByVal Height As Integer, ByVal Curve As Integer) As GraphicsPath
  33.         Dim Rectangle As Rectangle = New Rectangle(X, Y, Width, Height)
  34.         Dim P As GraphicsPath = New GraphicsPath()
  35.         Dim ArcRectangleWidth As Integer = Curve * 2
  36.         P.AddArc(New Rectangle(Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -180, 90)
  37.         P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -90, 90)
  38.         P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 0, 90)
  39.         P.AddArc(New Rectangle(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 90, 90)
  40.         P.AddLine(New Point(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y), New Point(Rectangle.X, Curve + Rectangle.Y))
  41.         Return P
  42.     End Function
  43.  
  44. End Module
  45. Public Class SimplaTheme : Inherits ContainerControl
  46.  
  47.     Sub New()
  48.         SetStyle(ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  49.         BackColor = Color.FromArgb(25, 25, 25)
  50.         DoubleBuffered = True
  51.     End Sub
  52.  
  53.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  54.         Dim B As New Bitmap(Width, Height)
  55.         Dim G As Graphics = Graphics.FromImage(B)
  56.  
  57.         Dim mainTop As New Rectangle(0, 0, Width - 1, 40)
  58.         Dim mainBottom As New Rectangle(0, 40, Width, Height)
  59.  
  60.         MyBase.OnPaint(e)
  61.  
  62.  
  63.         G.Clear(Color.Fuchsia)
  64.         G.SetClip(Draw.RoundRect(New Rectangle(0, 0, Width, Height), 9))
  65.  
  66.         Dim gradientBackground As New SolidBrush(Color.FromArgb(34, 34, 34))
  67.         G.FillRectangle(gradientBackground, mainBottom)
  68.  
  69.         Dim gradientBackground2 As New LinearGradientBrush(mainTop, Color.FromArgb(23, 23, 23), Color.FromArgb(17, 17, 17), 90S)
  70.         G.FillRectangle(gradientBackground2, mainTop)
  71.  
  72.         G.DrawLine(New Pen(New SolidBrush(Color.FromArgb(56, 56, 56))), 0, 40, Width - 1, 40)
  73.         G.DrawLine(New Pen(New SolidBrush(Color.FromArgb(42, 42, 42))), 0, 41, Width - 1, 41)
  74.  
  75.         G.DrawRectangle(New Pen(New SolidBrush(Color.FromArgb(12, 12, 12))), New Rectangle(0, 0, Width - 1, Height - 1))
  76.  
  77.         Dim drawFont As New Font("Calibri (Body)", 15, FontStyle.Bold)
  78.         G.DrawString(FindForm.Text, drawFont, New SolidBrush(Color.FromArgb(225, 225, 225)), 3, 18)
  79.  
  80.             e.Graphics.DrawImage(B.Clone(), 0, 0)
  81.             G.Dispose() : B.Dispose()
  82.     End Sub
  83.     Private MouseP As Point = New Point(0, 0)
  84.     Private Cap As Boolean = False
  85.     Private MoveHeight% = 40 : Private pos% = 0
  86.     Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  87.         MyBase.OnMouseDown(e)
  88.         If e.Button = Windows.Forms.MouseButtons.Left And New Rectangle(0, 0, Width, MoveHeight).Contains(e.Location) Then
  89.             Cap = True : MouseP = e.Location
  90.         End If
  91.     End Sub
  92.     Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
  93.         MyBase.OnMouseUp(e) : Cap = False
  94.     End Sub
  95.     Protected Overrides Sub OnMouseMove(ByVal e As System.Windows.Forms.MouseEventArgs)
  96.         MyBase.OnMouseMove(e)
  97.         If Cap Then
  98.             Parent.Location = MousePosition - MouseP
  99.         End If
  100.     End Sub
  101.     Protected Overrides Sub OnCreateControl()
  102.         MyBase.OnCreateControl()
  103.         Me.ParentForm.FormBorderStyle = FormBorderStyle.None
  104.         Me.ParentForm.TransparencyKey = Color.Fuchsia
  105.         Dock = DockStyle.Fill
  106.     End Sub
  107. End Class
  108. Public Class SimplaButton : Inherits Control
  109. #Region " MouseStates "
  110.     Dim State As MouseState = MouseState.None
  111.     Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  112.         MyBase.OnMouseDown(e)
  113.         State = MouseState.Down : Invalidate()
  114.     End Sub
  115.     Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
  116.         MyBase.OnMouseUp(e)
  117.         State = MouseState.Over : Invalidate()
  118.     End Sub
  119.     Protected Overrides Sub OnMouseEnter(ByVal e As System.EventArgs)
  120.         MyBase.OnMouseEnter(e)
  121.         State = MouseState.Over : Invalidate()
  122.     End Sub
  123.     Protected Overrides Sub OnMouseLeave(ByVal e As System.EventArgs)
  124.         MyBase.OnMouseLeave(e)
  125.         State = MouseState.None : Invalidate()
  126.     End Sub
  127. #End Region
  128.  
  129.     Enum ColorSchemes
  130.         DarkGray
  131.         Green
  132.         Blue
  133.         White
  134.         Red
  135.     End Enum
  136.     Private _ColorScheme As ColorSchemes
  137.     Public Property ColorScheme() As ColorSchemes
  138.         Get
  139.             Return _ColorScheme
  140.         End Get
  141.         Set(ByVal value As ColorSchemes)
  142.             _ColorScheme = value
  143.             Invalidate()
  144.         End Set
  145.     End Property
  146.  
  147.     Sub New()
  148.         SetStyle(ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  149.         BackColor = Color.Transparent
  150.         ForeColor = Color.FromArgb(205, 205, 205)
  151.         DoubleBuffered = True
  152.     End Sub
  153.  
  154.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  155.         Dim B As New Bitmap(Width, Height)
  156.         Dim G As Graphics = Graphics.FromImage(B)
  157.         Dim ClientRectangle As New Rectangle(0, 0, Width - 1, Height - 1)
  158.         Dim InnerRectangle As New Rectangle(1, 1, Width - 3, Height - 3)
  159.  
  160.         MyBase.OnPaint(e)
  161.  
  162.         G.Clear(BackColor)
  163.         Dim drawFont As New Font("Calibri (Body)", 10, FontStyle.Bold)
  164.  
  165.         G.SmoothingMode = SmoothingMode.HighQuality
  166.  
  167.         Select Case ColorScheme
  168.             Case ColorSchemes.DarkGray
  169.                 Dim gradientBackground As New LinearGradientBrush(ClientRectangle, Color.FromArgb(23, 23, 23), Color.FromArgb(17, 17, 17), 90S)
  170.                 G.FillPath(gradientBackground, Draw.RoundRect(ClientRectangle, 4))
  171.  
  172.                 Dim p As New Pen(New SolidBrush(Color.FromArgb(56, 56, 56)))
  173.                 G.DrawPath(p, Draw.RoundRect(ClientRectangle, 4))
  174.  
  175.                 Dim p2 As New Pen(New SolidBrush(Color.FromArgb(5, 240, 240, 240)))
  176.                 G.DrawPath(p2, Draw.RoundRect(InnerRectangle, 4))
  177.             Case ColorSchemes.Green
  178.                 Dim gradientBackground As New LinearGradientBrush(ClientRectangle, Color.FromArgb(121, 185, 0), Color.FromArgb(94, 165, 1), 90S)
  179.                 G.FillPath(gradientBackground, Draw.RoundRect(ClientRectangle, 4))
  180.  
  181.                 Dim p As New Pen(New SolidBrush(Color.FromArgb(159, 207, 1)))
  182.                 G.DrawPath(p, Draw.RoundRect(ClientRectangle, 4))
  183.  
  184.                 Dim p2 As New Pen(New SolidBrush(Color.FromArgb(30, 240, 240, 240)))
  185.                 G.DrawPath(p2, Draw.RoundRect(InnerRectangle, 4))
  186.             Case ColorSchemes.Blue
  187.                 Dim gradientBackground As New LinearGradientBrush(ClientRectangle, Color.FromArgb(0, 124, 186), Color.FromArgb(0, 97, 166), 90S)
  188.                 G.FillPath(gradientBackground, Draw.RoundRect(ClientRectangle, 4))
  189.  
  190.                 Dim p As New Pen(New SolidBrush(Color.FromArgb(0, 161, 207)))
  191.                 G.DrawPath(p, Draw.RoundRect(ClientRectangle, 4))
  192.  
  193.                 Dim p2 As New Pen(New SolidBrush(Color.FromArgb(10, 240, 240, 240)))
  194.                 G.DrawPath(p2, Draw.RoundRect(InnerRectangle, 4))
  195.             Case ColorSchemes.White
  196.                 Dim gradientBackground As New LinearGradientBrush(ClientRectangle, Color.FromArgb(245, 245, 245), Color.FromArgb(246, 246, 246), 90S)
  197.                 G.FillPath(gradientBackground, Draw.RoundRect(ClientRectangle, 4))
  198.  
  199.                 Dim p As New Pen(New SolidBrush(Color.FromArgb(254, 254, 254)))
  200.                 G.DrawPath(p, Draw.RoundRect(ClientRectangle, 4))
  201.  
  202.                 Dim p2 As New Pen(New SolidBrush(Color.FromArgb(10, 240, 240, 240)))
  203.                 G.DrawPath(p2, Draw.RoundRect(InnerRectangle, 4))
  204.             Case ColorSchemes.Red
  205.                 Dim gradientBackground As New LinearGradientBrush(ClientRectangle, Color.FromArgb(185, 0, 0), Color.FromArgb(170, 0, 0), 90S)
  206.                 G.FillPath(gradientBackground, Draw.RoundRect(ClientRectangle, 4))
  207.  
  208.                 Dim p As New Pen(New SolidBrush(Color.FromArgb(209, 1, 1)))
  209.                 G.DrawPath(p, Draw.RoundRect(ClientRectangle, 4))
  210.  
  211.                 Dim p2 As New Pen(New SolidBrush(Color.FromArgb(2, 240, 240, 240)))
  212.                 G.DrawPath(p2, Draw.RoundRect(InnerRectangle, 4))
  213.             Case Else
  214.  
  215.         End Select
  216.  
  217.         Select Case State
  218.             Case MouseState.None
  219.                 If ColorScheme = ColorSchemes.White Then
  220.                     G.DrawString(Text, drawFont, New SolidBrush(Color.FromArgb(51, 51, 51)), New Rectangle(0, 1, Width - 1, Height - 1), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  221.                 Else
  222.                     Dim textGradient As New LinearGradientBrush(ClientRectangle, Color.FromArgb(235, 235, 235), Color.FromArgb(212, 212, 212), 90S)
  223.                     G.DrawString(Text, drawFont, textGradient, New Rectangle(0, 1, Width - 1, Height - 1), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  224.                 End If
  225.             Case MouseState.Over
  226.                 G.DrawString(Text, drawFont, New SolidBrush(Color.Silver), New Rectangle(0, 1, Width - 1, Height - 1), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  227.             Case MouseState.Down
  228.                 G.DrawString(Text, drawFont, New SolidBrush(Color.DimGray), New Rectangle(0, 1, Width - 1, Height - 1), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  229.         End Select
  230.  
  231.  
  232.         e.Graphics.DrawImage(B.Clone(), 0, 0)
  233.         G.Dispose() : B.Dispose()
  234.     End Sub
  235. End Class
  236. <DefaultEvent("CheckedChanged")> Public Class SimplaCheckBox : Inherits Control
  237.  
  238. #Region " Control Help - MouseState & Flicker Control"
  239.     Private State As MouseState = MouseState.None
  240.     Protected Overrides Sub OnMouseEnter(ByVal e As System.EventArgs)
  241.         MyBase.OnMouseEnter(e)
  242.         State = MouseState.Over
  243.         Invalidate()
  244.     End Sub
  245.     Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  246.         MyBase.OnMouseDown(e)
  247.         State = MouseState.Down
  248.         Invalidate()
  249.     End Sub
  250.     Protected Overrides Sub OnMouseLeave(ByVal e As System.EventArgs)
  251.         MyBase.OnMouseLeave(e)
  252.         State = MouseState.None
  253.         Invalidate()
  254.     End Sub
  255.     Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
  256.         MyBase.OnMouseUp(e)
  257.         State = MouseState.Over
  258.         Invalidate()
  259.     End Sub
  260.     Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
  261.         MyBase.OnTextChanged(e)
  262.         Invalidate()
  263.     End Sub
  264.     Private _Checked As Boolean
  265.     Property Checked() As Boolean
  266.         Get
  267.             Return _Checked
  268.         End Get
  269.         Set(ByVal value As Boolean)
  270.             _Checked = value
  271.             Invalidate()
  272.         End Set
  273.     End Property
  274.     Protected Overrides Sub OnResize(ByVal e As System.EventArgs)
  275.         MyBase.OnResize(e)
  276.         Height = 16
  277.     End Sub
  278.     Protected Overrides Sub OnClick(ByVal e As System.EventArgs)
  279.         _Checked = Not _Checked
  280.         RaiseEvent CheckedChanged(Me)
  281.         MyBase.OnClick(e)
  282.     End Sub
  283.     Event CheckedChanged(ByVal sender As Object)
  284. #End Region
  285.  
  286.     Enum ColorSchemes
  287.         Green
  288.         Blue
  289.         White
  290.         Red
  291.     End Enum
  292.     Private _ColorScheme As ColorSchemes
  293.     Public Property ColorScheme() As ColorSchemes
  294.         Get
  295.             Return _ColorScheme
  296.         End Get
  297.         Set(ByVal value As ColorSchemes)
  298.             _ColorScheme = value
  299.             Invalidate()
  300.         End Set
  301.     End Property
  302.  
  303.     Sub New()
  304.         MyBase.New()
  305.         SetStyle(ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor Or ControlStyles.OptimizedDoubleBuffer, True)
  306.         BackColor = Color.Transparent
  307.         ForeColor = Color.Black
  308.         Size = New Size(145, 16)
  309.         DoubleBuffered = True
  310.     End Sub
  311.  
  312.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  313.         Dim B As New Bitmap(Width, Height)
  314.         Dim G As Graphics = Graphics.FromImage(B)
  315.         Dim checkBoxRectangle As New Rectangle(0, 0, Height - 1, Height - 1)
  316.  
  317.         G.SmoothingMode = SmoothingMode.HighQuality
  318.         G.CompositingQuality = CompositingQuality.HighQuality
  319.         G.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAliasGridFit
  320.  
  321.         G.Clear(Color.Transparent)
  322.  
  323.         Dim bodyGrad As New LinearGradientBrush(checkBoxRectangle, Color.FromArgb(40, 40, 40), Color.FromArgb(30, 30, 30), 90S)
  324.         G.FillRectangle(bodyGrad, bodyGrad.Rectangle)
  325.         G.DrawRectangle(New Pen(Color.FromArgb(56, 56, 56)), checkBoxRectangle)
  326.  
  327.         If Checked Then
  328.             Dim t As New Font("Marlett", 20, FontStyle.Regular)
  329.             Select Case ColorScheme
  330.                 Case ColorSchemes.Green
  331.                     G.DrawString("a", t, New SolidBrush(Color.FromArgb(159, 207, 1)), -9, -7)
  332.                 Case ColorSchemes.Blue
  333.                     G.DrawString("a", t, New SolidBrush(Color.FromArgb(0, 161, 207)), -9, -7)
  334.                 Case ColorSchemes.White
  335.                     G.DrawString("a", t, New SolidBrush(Color.FromArgb(254, 254, 254)), -9, -7)
  336.                 Case ColorSchemes.Red
  337.                     G.DrawString("a", t, New SolidBrush(Color.FromArgb(209, 1, 1)), -9, -7)
  338.             End Select
  339.         End If
  340.  
  341.         Dim drawFont As New Font("Tahoma", 10, FontStyle.Bold)
  342.         Dim nb As Brush = New SolidBrush(Color.FromArgb(200, 200, 200))
  343.         G.DrawString(Text, drawFont, nb, New Point(19, 9), New StringFormat With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Center})
  344.  
  345.         e.Graphics.DrawImage(B.Clone(), 0, 0)
  346.         G.Dispose() : B.Dispose()
  347.  
  348.     End Sub
  349.  
  350. End Class
  351. <DefaultEvent("CheckedChanged")> Public Class SimplaRadioButton : Inherits Control
  352.  
  353. #Region " Control Help - MouseState & Flicker Control"
  354.     Private R1 As Rectangle
  355.     Private G1 As LinearGradientBrush
  356.  
  357.     Private State As MouseState = MouseState.None
  358.     Protected Overrides Sub OnMouseEnter(ByVal e As System.EventArgs)
  359.         MyBase.OnMouseEnter(e)
  360.         State = MouseState.Over
  361.         Invalidate()
  362.     End Sub
  363.     Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  364.         MyBase.OnMouseDown(e)
  365.         State = MouseState.Down
  366.         Invalidate()
  367.     End Sub
  368.     Protected Overrides Sub OnMouseLeave(ByVal e As System.EventArgs)
  369.         MyBase.OnMouseLeave(e)
  370.         State = MouseState.None
  371.         Invalidate()
  372.     End Sub
  373.     Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
  374.         MyBase.OnMouseUp(e)
  375.         State = MouseState.Over
  376.         Invalidate()
  377.     End Sub
  378.     Protected Overrides Sub OnResize(ByVal e As System.EventArgs)
  379.         MyBase.OnResize(e)
  380.         Height = 16
  381.     End Sub
  382.     Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
  383.         MyBase.OnTextChanged(e)
  384.         Invalidate()
  385.     End Sub
  386.     Private _Checked As Boolean
  387.     Property Checked() As Boolean
  388.         Get
  389.             Return _Checked
  390.         End Get
  391.         Set(ByVal value As Boolean)
  392.             _Checked = value
  393.             InvalidateControls()
  394.             RaiseEvent CheckedChanged(Me)
  395.             Invalidate()
  396.         End Set
  397.     End Property
  398.     Protected Overrides Sub OnClick(ByVal e As EventArgs)
  399.         If Not _Checked Then Checked = True
  400.         MyBase.OnClick(e)
  401.     End Sub
  402.     Event CheckedChanged(ByVal sender As Object)
  403.     Protected Overrides Sub OnCreateControl()
  404.         MyBase.OnCreateControl()
  405.         InvalidateControls()
  406.     End Sub
  407.     Private Sub InvalidateControls()
  408.         If Not IsHandleCreated OrElse Not _Checked Then Return
  409.  
  410.         For Each C As Control In Parent.Controls
  411.             If C IsNot Me AndAlso TypeOf C Is SimplaRadioButton Then
  412.                 DirectCast(C, SimplaRadioButton).Checked = False
  413.             End If
  414.         Next
  415.     End Sub
  416. #End Region
  417.  
  418.     Enum ColorSchemes
  419.         Green
  420.         Blue
  421.         White
  422.         Red
  423.     End Enum
  424.     Private _ColorScheme As ColorSchemes
  425.     Public Property ColorScheme() As ColorSchemes
  426.         Get
  427.             Return _ColorScheme
  428.         End Get
  429.         Set(ByVal value As ColorSchemes)
  430.             _ColorScheme = value
  431.             Invalidate()
  432.         End Set
  433.     End Property
  434.  
  435.     Sub New()
  436.         MyBase.New()
  437.         SetStyle(ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  438.         BackColor = Color.Transparent
  439.         ForeColor = Color.Black
  440.         Size = New Size(150, 16)
  441.         DoubleBuffered = True
  442.     End Sub
  443.  
  444.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  445.         Dim B As New Bitmap(Width, Height)
  446.         Dim G As Graphics = Graphics.FromImage(B)
  447.         Dim radioBtnRectangle As New Rectangle(0, 0, Height - 1, Height - 1)
  448.         Dim InnerRect As New Rectangle(3, 3, Height - 7, Height - 7)
  449.  
  450.         G.SmoothingMode = SmoothingMode.HighQuality
  451.         G.CompositingQuality = CompositingQuality.HighQuality
  452.         G.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAliasGridFit
  453.  
  454.         G.Clear(BackColor)
  455.  
  456.         Dim bgGrad As New LinearGradientBrush(radioBtnRectangle, Color.FromArgb(40, 40, 40), Color.FromArgb(30, 30, 30), 90S)
  457.         G.FillRectangle(bgGrad, radioBtnRectangle)
  458.         G.DrawRectangle(New Pen(Color.FromArgb(56, 56, 56)), radioBtnRectangle)
  459.  
  460.         If Checked Then
  461.             Select Case ColorScheme
  462.                 Case ColorSchemes.Green
  463.                     Dim fillGradient As New LinearGradientBrush(InnerRect, Color.FromArgb(121, 185, 0), Color.FromArgb(94, 165, 1), 90S)
  464.                     G.FillRectangle(fillGradient, InnerRect)
  465.                     G.DrawRectangle(New Pen(Color.FromArgb(159, 207, 1)), InnerRect)
  466.                 Case ColorSchemes.Blue
  467.                     Dim fillGradient As New LinearGradientBrush(InnerRect, Color.FromArgb(0, 124, 186), Color.FromArgb(0, 97, 166), 90S)
  468.                     G.FillRectangle(fillGradient, InnerRect)
  469.                     G.DrawRectangle(New Pen(Color.FromArgb(0, 161, 207)), InnerRect)
  470.                 Case ColorSchemes.White
  471.                     Dim fillGradient As New LinearGradientBrush(InnerRect, Color.FromArgb(245, 245, 245), Color.FromArgb(246, 246, 246), 90S)
  472.                     G.FillRectangle(fillGradient, InnerRect)
  473.                     G.DrawRectangle(New Pen(Color.FromArgb(254, 254, 254)), InnerRect)
  474.                 Case ColorSchemes.Red
  475.                     Dim fillGradient As New LinearGradientBrush(InnerRect, Color.FromArgb(185, 0, 0), Color.FromArgb(170, 0, 0), 90S)
  476.                     G.FillRectangle(fillGradient, InnerRect)
  477.                     G.DrawRectangle(New Pen(Color.FromArgb(209, 1, 1)), InnerRect)
  478.             End Select
  479.         End If
  480.  
  481.         Dim drawFont As New Font("Tahoma", 10, FontStyle.Bold)
  482.         Dim nb As Brush = New SolidBrush(Color.FromArgb(200, 200, 200))
  483.         G.DrawString(Text, drawFont, nb, New Point(19, 8), New StringFormat With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Center})
  484.  
  485.         e.Graphics.DrawImage(B.Clone(), 0, 0)
  486.         G.Dispose() : B.Dispose()
  487.     End Sub
  488.  
  489. End Class
  490. Public Class SimplaControlBox : Inherits Control
  491.     Sub New()
  492.         SetStyle(ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  493.         BackColor = Color.Transparent
  494.         ForeColor = Color.FromArgb(205, 205, 205)
  495.         Size = New Size(52, 26)
  496.         DoubleBuffered = True
  497.     End Sub
  498. #Region " MouseStates "
  499.     Dim State As MouseState = MouseState.None
  500.     Dim X As Integer
  501.     Dim MinBtn As New Rectangle(0, 0, 32, 25)
  502.     Dim CloseBtn As New Rectangle(33, 0, 65, 25)
  503.     Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  504.         MyBase.OnMouseDown(e)
  505.         If X > MinBtn.X And X < MinBtn.X + 32 Then
  506.             FindForm.WindowState = FormWindowState.Minimized
  507.         Else
  508.             FindForm.Close()
  509.         End If
  510.         State = MouseState.Down : Invalidate()
  511.     End Sub
  512.     Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
  513.         MyBase.OnMouseUp(e)
  514.         State = MouseState.Over : Invalidate()
  515.     End Sub
  516.     Protected Overrides Sub OnMouseEnter(ByVal e As System.EventArgs)
  517.         MyBase.OnMouseEnter(e)
  518.         State = MouseState.Over : Invalidate()
  519.     End Sub
  520.     Protected Overrides Sub OnMouseLeave(ByVal e As System.EventArgs)
  521.         MyBase.OnMouseLeave(e)
  522.         State = MouseState.None : Invalidate()
  523.     End Sub
  524.     Protected Overrides Sub OnMouseMove(ByVal e As System.Windows.Forms.MouseEventArgs)
  525.         MyBase.OnMouseMove(e)
  526.         X = e.Location.X
  527.         Invalidate()
  528.     End Sub
  529. #End Region
  530.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  531.         Dim B As New Bitmap(Width, Height)
  532.         Dim G As Graphics = Graphics.FromImage(B)
  533.         Dim ClientRectangle As New Rectangle(0, 0, 64, 25)
  534.         Dim InnerRect As New Rectangle(1, 1, 62, 23)
  535.  
  536.  
  537.         MyBase.OnPaint(e)
  538.  
  539.         G.Clear(BackColor)
  540.         Dim drawFont As New Font("Marlett", 10, FontStyle.Bold)
  541.  
  542.         'G.CompositingQuality = CompositingQuality.HighQuality
  543.        G.SmoothingMode = SmoothingMode.HighQuality
  544.  
  545.         Select Case State
  546.             Case MouseState.None
  547.                 G.DrawString("r", drawFont, New SolidBrush(Color.FromArgb(178, 178, 178)), New Rectangle(17, 1, Width - 1, Height - 1), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  548.                 G.DrawString("0", drawFont, New SolidBrush(Color.FromArgb(178, 178, 178)), New Rectangle(8, 1, Width - 1, Height - 1), New StringFormat() With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Center})
  549.             Case MouseState.Over
  550.                 If X > MinBtn.X And X < MinBtn.X + 32 Then
  551.                     G.DrawString("0", drawFont, New SolidBrush(Color.FromArgb(178, 178, 178)), New Rectangle(8, 1, Width - 1, Height - 1), New StringFormat() With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Center})
  552.                     G.DrawString("0", drawFont, New SolidBrush(Color.FromArgb(95, Color.Green)), New Rectangle(8, 1, Width - 1, Height - 1), New StringFormat() With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Center})
  553.                     G.DrawString("r", drawFont, New SolidBrush(Color.FromArgb(178, 178, 178)), New Rectangle(17, 1, Width - 1, Height - 1), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  554.                 Else
  555.                     G.DrawString("r", drawFont, New SolidBrush(Color.FromArgb(178, 178, 178)), New Rectangle(17, 1, Width - 1, Height - 1), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  556.                     G.DrawString("r", drawFont, New SolidBrush(Color.FromArgb(95, Color.Red)), New Rectangle(17, 1, Width - 1, Height - 1), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  557.                     G.DrawString("0", drawFont, New SolidBrush(Color.FromArgb(178, 178, 178)), New Rectangle(8, 1, Width - 1, Height - 1), New StringFormat() With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Center})
  558.                 End If
  559.             Case MouseState.Down
  560.                 G.DrawString("r", drawFont, New SolidBrush(Color.FromArgb(178, 178, 178)), New Rectangle(17, 1, Width - 1, Height - 1), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  561.                 G.DrawString("0", drawFont, New SolidBrush(Color.FromArgb(178, 178, 178)), New Rectangle(8, 1, Width - 1, Height - 1), New StringFormat() With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Center})
  562.         End Select
  563.  
  564.  
  565.         e.Graphics.DrawImage(B.Clone(), 0, 0)
  566.         G.Dispose() : B.Dispose()
  567.     End Sub
  568. End Class
  569. Public Class SimplaProgressBar : Inherits Control
  570.  
  571. #Region " Control Help - Properties & Flicker Control "
  572.     Private OFS As Integer = 0
  573.     Private Speed As Integer = 50
  574.     Private _Maximum As Integer = 100
  575.  
  576.     Public Property Maximum() As Integer
  577.         Get
  578.             Return _Maximum
  579.         End Get
  580.         Set(ByVal v As Integer)
  581.             Select Case v
  582.                 Case Is < _Value
  583.                     _Value = v
  584.             End Select
  585.             _Maximum = v
  586.             Invalidate()
  587.         End Set
  588.     End Property
  589.     Private _Value As Integer = 0
  590.     Public Property Value() As Integer
  591.         Get
  592.             Select Case _Value
  593.                 Case 0
  594.                     Return 0
  595.                 Case Else
  596.                     Return _Value
  597.             End Select
  598.         End Get
  599.         Set(ByVal v As Integer)
  600.             Select Case v
  601.                 Case Is > _Maximum
  602.                     v = _Maximum
  603.             End Select
  604.             _Value = v
  605.             Invalidate()
  606.         End Set
  607.     End Property
  608.     Private _ShowPercentage As Boolean = False
  609.     Public Property ShowPercentage() As Boolean
  610.         Get
  611.             Return _ShowPercentage
  612.         End Get
  613.         Set(ByVal v As Boolean)
  614.             _ShowPercentage = v
  615.             Invalidate()
  616.         End Set
  617.     End Property
  618.  
  619.     Protected Overrides Sub CreateHandle()
  620.         MyBase.CreateHandle()
  621.         ' Dim tmr As New Timer With {.Interval = Speed}
  622.        ' AddHandler tmr.Tick, AddressOf Animate
  623.        ' tmr.Start()
  624.        Dim T As New Threading.Thread(AddressOf Animate)
  625.         T.IsBackground = True
  626.         'T.Start()
  627.    End Sub
  628.     Sub Animate()
  629.         While True
  630.             If OFS <= Width Then : OFS += 1
  631.             Else : OFS = 0
  632.             End If
  633.             Invalidate()
  634.             Threading.Thread.Sleep(Speed)
  635.         End While
  636.     End Sub
  637. #End Region
  638.  
  639.     Enum ColorSchemes
  640.         DarkGray
  641.         Green
  642.         Blue
  643.         White
  644.         Red
  645.     End Enum
  646.     Private _ColorScheme As ColorSchemes
  647.     Public Property ColorScheme() As ColorSchemes
  648.         Get
  649.             Return _ColorScheme
  650.         End Get
  651.         Set(ByVal value As ColorSchemes)
  652.             _ColorScheme = value
  653.             Invalidate()
  654.         End Set
  655.     End Property
  656.  
  657.     Sub New()
  658.         MyBase.New()
  659.         DoubleBuffered = True
  660.         SetStyle(ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  661.         BackColor = Color.Transparent
  662.     End Sub
  663.  
  664.     Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  665.         Dim B As New Bitmap(Width, Height)
  666.         Dim G As Graphics = Graphics.FromImage(B)
  667.  
  668.         G.SmoothingMode = SmoothingMode.HighQuality
  669.  
  670.         Dim intValue As Integer = CInt(_Value / _Maximum * Width)
  671.         G.Clear(BackColor)
  672.  
  673.  
  674.         G.DrawPath(New Pen(New SolidBrush(Color.FromArgb(26, 26, 26))), Draw.RoundRect(New Rectangle(1, 1, Width - 3, Height - 3), 2))
  675.  
  676.         Dim percentColor As SolidBrush = New SolidBrush(Color.White)
  677.         '//// Bar Fill
  678.        If Not intValue = 0 Then
  679.             Select Case ColorScheme
  680.                 Case ColorSchemes.DarkGray
  681.                     Dim g1 As New LinearGradientBrush(New Rectangle(2, 2, intValue - 5, Height - 5), Color.FromArgb(23, 23, 23), Color.FromArgb(17, 17, 17), 90S)
  682.                     G.FillPath(g1, Draw.RoundRect(New Rectangle(2, 2, intValue - 5, Height - 5), 2))
  683.                     percentColor = New SolidBrush(Color.White)
  684.                 Case ColorSchemes.Green
  685.                     Dim g1 As New LinearGradientBrush(New Rectangle(2, 2, intValue - 5, Height - 5), Color.FromArgb(121, 185, 0), Color.FromArgb(94, 165, 1), 90S)
  686.                     G.FillPath(g1, Draw.RoundRect(New Rectangle(2, 2, intValue - 5, Height - 5), 2))
  687.                     percentColor = New SolidBrush(Color.White)
  688.                 Case ColorSchemes.Blue
  689.                     Dim g1 As New LinearGradientBrush(New Rectangle(2, 2, intValue - 5, Height - 5), Color.FromArgb(0, 124, 186), Color.FromArgb(0, 97, 166), 90S)
  690.                     G.FillPath(g1, Draw.RoundRect(New Rectangle(2, 2, intValue - 5, Height - 5), 2))
  691.                     percentColor = New SolidBrush(Color.White)
  692.                 Case ColorSchemes.White
  693.                     Dim g1 As New LinearGradientBrush(New Rectangle(2, 2, intValue - 5, Height - 5), Color.FromArgb(245, 245, 245), Color.FromArgb(246, 246, 246), 90S)
  694.                     G.FillPath(g1, Draw.RoundRect(New Rectangle(2, 2, intValue - 5, Height - 5), 2))
  695.                     percentColor = New SolidBrush(Color.FromArgb(20, 20, 20))
  696.                 Case ColorSchemes.Red
  697.                     Dim g1 As New LinearGradientBrush(New Rectangle(2, 2, intValue - 5, Height - 5), Color.FromArgb(185, 0, 0), Color.FromArgb(170, 0, 0), 90S)
  698.                     G.FillPath(g1, Draw.RoundRect(New Rectangle(2, 2, intValue - 5, Height - 5), 2))
  699.                     percentColor = New SolidBrush(Color.White)
  700.             End Select
  701.         End If
  702.  
  703.         '//// Outer Rectangle
  704.        G.DrawPath(New Pen(Color.FromArgb(190, 56, 56, 56)), Draw.RoundRect(New Rectangle(0, 0, Width - 1, Height - 1), 2))
  705.  
  706.         '//// Bar Size
  707.        G.DrawPath(New Pen(Color.FromArgb(150, 97, 94, 90)), Draw.RoundRect(New Rectangle(2, 2, intValue - 5, Height - 5), 2))
  708.  
  709.         If _ShowPercentage Then
  710.             G.DrawString(Convert.ToString(String.Concat(Value, "%")), New Font("Tahoma", 9, FontStyle.Bold), percentColor, New Rectangle(0, 1, Width - 1, Height - 1), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  711.         End If
  712.  
  713.         e.Graphics.DrawImage(B.Clone(), 0, 0)
  714.         G.Dispose() : B.Dispose()
  715.     End Sub
  716. End Class
  717. Public Class SimplaTextBox : Inherits TextBox
  718.  
  719.     Sub New()
  720.         BorderStyle = Windows.Forms.BorderStyle.FixedSingle
  721.         Font = New Font("Tahoma", 9, FontStyle.Bold)
  722.         BackColor = Color.FromArgb(35, 35, 35)
  723.         ForeColor = Color.WhiteSmoke
  724.     End Sub
  725. End Class
  726. Public Class SimplaTabControl : Inherits TabControl
  727.  
  728.     Private mainBackground As Color
  729.     Private topBackground As Color
  730.     Private activeTabColor As Color
  731.  
  732.     Enum ColorSchemes
  733.         DarkGray
  734.         Green
  735.         Blue
  736.         White
  737.         Red
  738.     End Enum
  739.     Private _ColorScheme As ColorSchemes
  740.     Public Property ColorScheme() As ColorSchemes
  741.         Get
  742.             Return _ColorScheme
  743.         End Get
  744.         Set(ByVal value As ColorSchemes)
  745.             _ColorScheme = value
  746.             Invalidate()
  747.         End Set
  748.     End Property
  749.     Private _textColor As Color
  750.     Sub New()
  751.         MyBase.New()
  752.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.SupportsTransparentBackColor, True)
  753.         DoubleBuffered = True
  754.  
  755.         BackColor = Color.FromArgb(34, 34, 34)
  756.         topBackground = Color.FromArgb(34, 34, 34)
  757.         mainBackground = Color.FromArgb(34, 34, 34)
  758.         ForeColor = Color.White
  759.         _textColor = ForeColor
  760.         activeTabColor = Color.FromArgb(20, 20, 20)
  761.     End Sub
  762.  
  763.     Protected Overrides Sub OnPaint(e As PaintEventArgs)
  764.         Dim B As New Bitmap(Width, Height)
  765.         Dim G As Graphics = Graphics.FromImage(B)
  766.         MyBase.OnPaint(e)
  767.  
  768.         Try : SelectedTab.BackColor = mainBackground : Catch : End Try
  769.  
  770.         G.Clear(topBackground)
  771.         G.SmoothingMode = SmoothingMode.HighQuality
  772.  
  773.         Select Case ColorScheme
  774.             Case ColorSchemes.DarkGray
  775.                 activeTabColor = Color.FromArgb(10, 10, 10)
  776.                 _textColor = Color.White
  777.             Case ColorSchemes.Green
  778.                 activeTabColor = Color.FromArgb(94, 165, 1)
  779.                 _textColor = Color.White
  780.             Case ColorSchemes.Blue
  781.                 activeTabColor = Color.FromArgb(0, 97, 166)
  782.                 _textColor = Color.White
  783.             Case ColorSchemes.White
  784.                 activeTabColor = Color.FromArgb(245, 245, 245)
  785.                 _textColor = Color.FromArgb(36, 36, 36)
  786.             Case ColorSchemes.Red
  787.                 activeTabColor = Color.FromArgb(170, 0, 0)
  788.                 _textColor = Color.White
  789.         End Select
  790.  
  791.         For i As Integer = 0 To TabPages.Count - 1
  792.             Dim TabRect As New Rectangle(GetTabRect(i).X + 3, GetTabRect(i).Y, GetTabRect(i).Width - 5, GetTabRect(i).Height)
  793.             G.FillRectangle(New SolidBrush(mainBackground), TabRect)
  794.             G.DrawString(TabPages(i).Text, New Font("Tahoma", 9, FontStyle.Bold), New SolidBrush(ForeColor), TabRect, New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
  795.         Next
  796.  
  797.         G.FillRectangle(New SolidBrush(mainBackground), 0, ItemSize.Height, Width, Height)
  798.  
  799.         If Not SelectedIndex = -1 Then
  800.             Dim TabRect As New Rectangle(GetTabRect(SelectedIndex).X + 3, GetTabRect(SelectedIndex).Y, GetTabRect(SelectedIndex).Width - 5, GetTabRect(SelectedIndex).Height)
  801.             G.FillPath(New SolidBrush(activeTabColor), Draw.RoundRect(TabRect, 4))
  802.             G.DrawPath(New Pen(New SolidBrush(Color.FromArgb(20, 20, 20))), Draw.RoundRect(TabRect, 4))
  803.             G.DrawString(TabPages(SelectedIndex).Text, New Font("Tahoma", 9, FontStyle.Bold), New SolidBrush(_textColor), TabRect, New StringFormat With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  804.         End If
  805.  
  806.         e.Graphics.DrawImage(B, New Point(0, 0))
  807.         G.Dispose() : B.Dispose()
  808.     End Sub
  809. End Class
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top