Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

VB .Net Future Theme

By: a guest on Jul 14th, 2010  |  syntax: VB.NET  |  size: 11.21 KB  |  views: 7,048  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Imports System.Drawing.Drawing2D
  2.  
  3. 'Creator: Aeonhack
  4. 'Date: 7/14/2010
  5. 'Site: www.elitevs.net
  6. 'Version: 1.0
  7.  
  8. Class FutureTheme
  9.     Inherits Control
  10.  
  11.     Protected Overrides Sub OnHandleCreated(ByVal e As EventArgs)
  12.         Dock = DockStyle.Fill
  13.         If TypeOf Parent Is Form Then
  14.             With DirectCast(Parent, Form)
  15.                 .FormBorderStyle = 0
  16.                 .BackColor = C1
  17.                 .ForeColor = Color.FromArgb(12, 12, 12)
  18.             End With
  19.         End If
  20.         MyBase.OnHandleCreated(e)
  21.     End Sub
  22.     Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  23.         If New Rectangle(Parent.Location.X, Parent.Location.Y, Width, 22).IntersectsWith(New Rectangle(MousePosition.X, MousePosition.Y, 1, 1)) Then
  24.             Capture = False
  25.             Dim M As Message = Message.Create(Parent.Handle, 161, New IntPtr(2), IntPtr.Zero)
  26.             DefWndProc(M)
  27.         End If
  28.         MyBase.OnMouseDown(e)
  29.     End Sub
  30.  
  31.     Dim G As Graphics, B As Bitmap, R1, R2 As Rectangle
  32.     Dim C1, C2, C3 As Color, P1, P2, P3 As Pen, B1 As SolidBrush, B2, B3 As LinearGradientBrush
  33.  
  34.     Sub New()
  35.  
  36.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint, True)
  37.         C1 = Color.FromArgb(34, 34, 34) 'Background
  38.         C2 = Color.FromArgb(49, 49, 49) 'Highlight
  39.         C3 = Color.FromArgb(22, 22, 22) 'Shadow
  40.         P1 = New Pen(Color.Black) 'Border
  41.         P2 = New Pen(C1)
  42.         P3 = New Pen(C2)
  43.         B1 = New SolidBrush(C2)
  44.         Font = New Font("Verdana", 7.0F, FontStyle.Bold)
  45.  
  46.     End Sub
  47.  
  48.     Protected Overrides Sub OnSizeChanged(ByVal e As EventArgs)
  49.         If Height > 0 Then
  50.             R1 = New Rectangle(0, 2, Width, 18)
  51.             R2 = New Rectangle(0, 21, Width, 10)
  52.             B2 = New LinearGradientBrush(R1, C1, C3, 90.0F)
  53.             B3 = New LinearGradientBrush(R2, Color.FromArgb(70, 0, 0, 0), Color.Transparent, 90.0F)
  54.             Invalidate()
  55.         End If
  56.         MyBase.OnSizeChanged(e)
  57.     End Sub
  58.  
  59.     Protected Overrides Sub OnPaintBackground(ByVal pevent As PaintEventArgs)
  60.     End Sub
  61.  
  62.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  63.         B = New Bitmap(Width, Height)
  64.         G = Graphics.FromImage(B)
  65.  
  66.         G.Clear(C1)
  67.  
  68.         For I As Integer = 0 To Width + 17 Step 4
  69.             G.DrawLine(P1, I, 21, I - 17, 37)
  70.             G.DrawLine(P1, I - 1, 21, I - 16, 37)
  71.         Next
  72.         G.FillRectangle(B3, R2)
  73.  
  74.         G.FillRectangle(B2, R1)
  75.         G.DrawString(Text, Font, B1, 5, 5)
  76.  
  77.         G.DrawRectangle(P2, 1, 1, Width - 3, 19)
  78.         G.DrawRectangle(P3, 1, 39, Width - 3, Height - 41)
  79.  
  80.         G.DrawRectangle(P1, 0, 0, Width - 1, Height - 1)
  81.         G.DrawLine(P1, 0, 21, Width, 21)
  82.         G.DrawLine(P1, 0, 38, Width, 38)
  83.  
  84.         e.Graphics.DrawImage(B, 0, 0)
  85.         G.Dispose()
  86.         B.Dispose()
  87.     End Sub
  88.  
  89. End Class
  90. Class FutureButton
  91.     Inherits Control
  92.  
  93.     Dim B As Bitmap, G As Graphics, R1 As Rectangle
  94.     Dim C1, C2, C3, C4 As Color, P1, P2, P3, P4 As Pen, B1, B2, B5 As Brush, B3, B4 As LinearGradientBrush
  95.  
  96.     Sub New()
  97.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint, True)
  98.  
  99.         C1 = Color.FromArgb(34, 34, 34) 'Background
  100.         C2 = Color.FromArgb(49, 49, 49) 'Highlight
  101.         C3 = Color.FromArgb(39, 39, 39) 'Lesser Highlight
  102.         C4 = Color.FromArgb(60, Color.Black)
  103.         P1 = New Pen(Color.FromArgb(22, 22, 22)) 'Shadow
  104.         P2 = New Pen(Color.FromArgb(20, Color.White))
  105.         P3 = New Pen(Color.FromArgb(10, Color.White))
  106.         P4 = New Pen(Color.FromArgb(30, Color.Black))
  107.         B1 = New SolidBrush(C1)
  108.         B2 = New SolidBrush(C3)
  109.         B5 = New SolidBrush(Color.FromArgb(12, 12, 12)) 'Text Color
  110.         Font = New Font("Verdana", 8.0F)
  111.     End Sub
  112.  
  113.     Private State As Integer
  114.     Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
  115.         State = 0
  116.         Invalidate()
  117.     End Sub
  118.     Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  119.         State = 1
  120.         Invalidate()
  121.     End Sub
  122.     Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
  123.         State = 1
  124.         Invalidate()
  125.     End Sub
  126.     Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  127.         State = 2
  128.         Invalidate()
  129.     End Sub
  130.  
  131.     Protected Overrides Sub OnResize(ByVal e As EventArgs)
  132.         R1 = New Rectangle(2, 2, Width - 4, 4)
  133.         B3 = New LinearGradientBrush(ClientRectangle, C3, C2, 90.0F)
  134.         B4 = New LinearGradientBrush(R1, C4, Color.Transparent, 90.0F)
  135.         Invalidate()
  136.     End Sub
  137.  
  138.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  139.         B = New Bitmap(Width, Height)
  140.         G = Graphics.FromImage(B)
  141.  
  142.         G.FillRectangle(B3, ClientRectangle)
  143.  
  144.         Select Case State
  145.             Case 0 'Up
  146.                 G.FillRectangle(B1, 1, 1, Width - 2, Height - 2)
  147.                 G.DrawLine(P2, 2, 2, Width - 3, 2)
  148.                 G.DrawLine(P3, 2, Height - 3, Width - 3, Height - 3)
  149.             Case 1 'Over
  150.                 G.FillRectangle(B2, 1, 1, Width - 2, Height - 2)
  151.                 G.DrawLine(P2, 2, 2, Width - 3, 2)
  152.                 G.DrawLine(P3, 2, Height - 3, Width - 3, Height - 3)
  153.             Case 2 'Down
  154.                 G.FillRectangle(B2, 1, 1, Width - 2, Height - 2)
  155.                 G.FillRectangle(B4, R1)
  156.                 G.DrawLine(P4, 2, 2, 2, Height - 3)
  157.         End Select
  158.  
  159.         Dim S As SizeF = G.MeasureString(Text, Font)
  160.         G.DrawString(Text, Font, B5, Convert.ToInt32(Width / 2 - S.Width / 2), Convert.ToInt32(Height / 2 - S.Height / 2))
  161.  
  162.         G.DrawRectangle(P1, 1, 1, Width - 3, Height - 3)
  163.  
  164.         e.Graphics.DrawImage(B, 0, 0)
  165.         G.Dispose()
  166.         B.Dispose()
  167.     End Sub
  168.  
  169.     Protected Overrides Sub OnPaintBackground(ByVal e As PaintEventArgs)
  170.     End Sub
  171.  
  172. End Class
  173. Class FutureProgressBar
  174.     Inherits Control
  175.  
  176. #Region " Properties "
  177.     Private _Maximum As Double = 100
  178.     Public Property Maximum() As Double
  179.         Get
  180.             Return _Maximum
  181.         End Get
  182.         Set(ByVal v As Double)
  183.             _Maximum = v
  184.             Progress = _Current / v * 100
  185.             Invalidate()
  186.         End Set
  187.     End Property
  188.     Private _Current As Double
  189.     Public Property Current() As Double
  190.         Get
  191.             Return _Current
  192.         End Get
  193.         Set(ByVal v As Double)
  194.             _Current = v
  195.             Progress = v / _Maximum * 100
  196.             Invalidate()
  197.         End Set
  198.     End Property
  199.     Private _Progress As Integer
  200.     Public Property Progress() As Double
  201.         Get
  202.             Return _Progress
  203.         End Get
  204.         Set(ByVal v As Double)
  205.             If v < 0 Then v = 0 Else If v > 100 Then v = 100
  206.             _Progress = Convert.ToInt32(v)
  207.             _Current = v * 0.01 * _Maximum
  208.             If Width > 0 Then UpdateProgress()
  209.             Invalidate()
  210.         End Set
  211.     End Property
  212.  
  213.     Dim C2 As Color = Color.FromArgb(6, 96, 149) 'Dark Color
  214.     Public Property Color1() As Color
  215.         Get
  216.             Return C2
  217.         End Get
  218.         Set(ByVal v As Color)
  219.             C2 = v
  220.             UpdateColors()
  221.             Invalidate()
  222.         End Set
  223.     End Property
  224.     Dim C3 As Color = Color.FromArgb(70, 167, 220) 'Light color
  225.     Public Property Color2() As Color
  226.         Get
  227.             Return C3
  228.         End Get
  229.         Set(ByVal v As Color)
  230.             C3 = v
  231.             UpdateColors()
  232.             Invalidate()
  233.         End Set
  234.     End Property
  235.  
  236. #End Region
  237.  
  238.     Protected Overrides Sub OnPaintBackground(ByVal pevent As PaintEventArgs)
  239.     End Sub
  240.  
  241.     Dim G As Graphics, B As Bitmap, R1, R2 As Rectangle, X As ColorBlend
  242.     Dim C1 As Color, P1, P2, P3 As Pen, B1, B2 As LinearGradientBrush, B3 As SolidBrush
  243.     Sub New()
  244.  
  245.         C1 = Color.FromArgb(22, 22, 22) 'Background
  246.         P1 = New Pen(Color.FromArgb(70, Color.White), 2)
  247.         P2 = New Pen(C2)
  248.         P3 = New Pen(Color.FromArgb(49, 49, 49)) 'Highlight
  249.         B3 = New SolidBrush(Color.FromArgb(100, Color.White))
  250.         X = New ColorBlend(4)
  251.         X.Colors = {C2, C3, C3, C2}
  252.         X.Positions = {0.0F, 0.1F, 0.9F, 1.0F}
  253.         R2 = New Rectangle(2, 2, 2, 2)
  254.         B2 = New LinearGradientBrush(R2, Nothing, Nothing, 180.0F)
  255.         B2.InterpolationColors = X
  256.  
  257.     End Sub
  258.  
  259.     Sub UpdateColors()
  260.         P2.Color = C2
  261.         X.Colors = {C2, C3, C3, C2}
  262.         B2.InterpolationColors = X
  263.     End Sub
  264.  
  265.     Protected Overrides Sub OnSizeChanged(ByVal e As System.EventArgs)
  266.         R1 = New Rectangle(0, 1, Width, 4)
  267.         B1 = New LinearGradientBrush(R1, Color.FromArgb(60, Color.Black), Color.Transparent, 90.0F)
  268.         UpdateProgress()
  269.         Invalidate()
  270.         MyBase.OnSizeChanged(e)
  271.     End Sub
  272.  
  273.     Sub UpdateProgress()
  274.         If _Progress = 0 Then Return
  275.         R2 = New Rectangle(2, 2, Convert.ToInt32((Width - 4) * (_Progress * 0.01)), Height - 4)
  276.         B2 = New LinearGradientBrush(R2, Nothing, Nothing, 180.0F)
  277.         B2.InterpolationColors = X
  278.     End Sub
  279.  
  280.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  281.         B = New Bitmap(Width, Height)
  282.         G = Graphics.FromImage(B)
  283.  
  284.         G.Clear(C1)
  285.  
  286.         G.FillRectangle(B1, R1)
  287.  
  288.         If _Progress > 0 Then
  289.             G.FillRectangle(B2, R2)
  290.  
  291.             G.FillRectangle(B3, 2, 3, R2.Width, 4)
  292.             G.DrawRectangle(P1, 4, 4, R2.Width - 4, Height - 8)
  293.  
  294.             G.DrawRectangle(P2, 2, 2, R2.Width - 1, Height - 5)
  295.         End If
  296.  
  297.         G.DrawRectangle(P3, 0, 0, Width - 1, Height - 1)
  298.  
  299.         e.Graphics.DrawImage(B, 0, 0)
  300.         G.Dispose()
  301.         B.Dispose()
  302.     End Sub
  303.  
  304. End Class
  305. Class FutureSeperator
  306.     Inherits Control
  307.  
  308.     Private _Orientation As Orientation
  309.     Public Property Orientation() As Orientation
  310.         Get
  311.             Return _Orientation
  312.         End Get
  313.         Set(ByVal v As Orientation)
  314.             _Orientation = v
  315.             UpdateOffset()
  316.             Invalidate()
  317.         End Set
  318.     End Property
  319.  
  320.     Dim G As Graphics, B As Bitmap, I As Integer
  321.     Dim C1 As Color, P1, P2 As Pen
  322.     Sub New()
  323.         SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint, True)
  324.         C1 = Color.FromArgb(34, 34, 34) 'Background
  325.         P1 = New Pen(Color.FromArgb(22, 22, 22)) 'Shadow
  326.         P2 = New Pen(Color.FromArgb(49, 49, 49)) 'Highlight
  327.     End Sub
  328.  
  329.     Protected Overrides Sub OnSizeChanged(ByVal e As EventArgs)
  330.         UpdateOffset()
  331.         MyBase.OnSizeChanged(e)
  332.     End Sub
  333.  
  334.     Sub UpdateOffset()
  335.         I = Convert.ToInt32(If(_Orientation = 0, Height / 2 - 1, Width / 2 - 1))
  336.     End Sub
  337.  
  338.     Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  339.         B = New Bitmap(Width, Height)
  340.         G = Graphics.FromImage(B)
  341.  
  342.         G.Clear(C1)
  343.  
  344.         If _Orientation = 0 Then
  345.             G.DrawLine(P1, 0, I, Width, I)
  346.             G.DrawLine(P2, 0, I + 1, Width, I + 1)
  347.         Else
  348.             G.DrawLine(P2, I, 0, I, Height)
  349.             G.DrawLine(P1, I + 1, 0, I + 1, Height)
  350.         End If
  351.  
  352.         e.Graphics.DrawImage(B, 0, 0)
  353.         G.Dispose()
  354.         B.Dispose()
  355.     End Sub
  356.  
  357.     Protected Overrides Sub OnPaintBackground(ByVal pevent As PaintEventArgs)
  358.     End Sub
  359.  
  360. End Class
clone this paste RAW Paste Data