Want more features on Pastebin? Sign Up, it's FREE!
Guest

VB.Net Bullion Theme

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