Advertisement
benito

Untitled

Sep 7th, 2011
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 5.29 KB | None | 0 0
  1. Class StormTheme
  2.     Inherits ThemeContainer
  3.  
  4.     Private _TopHeight As Integer = 40
  5.     Property TopHeight() As Integer
  6.         Get
  7.             Return _TopHeight
  8.         End Get
  9.         Set(ByVal value As Integer)
  10.             _TopHeight = value
  11.             Invalidate()
  12.         End Set
  13.     End Property
  14.  
  15.     Private _BottomHeight As Integer = 40
  16.     Property BottomHeight() As Integer
  17.         Get
  18.             Return _BottomHeight
  19.         End Get
  20.         Set(ByVal value As Integer)
  21.             _BottomHeight = value
  22.             Invalidate()
  23.         End Set
  24.     End Property
  25.  
  26.     Sub New()
  27.         Sizable = False
  28.         Movable = False
  29.  
  30.         BorderStyle = FormBorderStyle.Sizable
  31.         BackColor = Color.FromArgb(90, 90, 110)
  32.  
  33.         SetColor("BackColor", 90, 90, 110)
  34.         SetColor("Gradient1", 175, 175, 190)
  35.         SetColor("Gradient2", 140, 140, 155)
  36.         SetColor("TopBorder", 70, 70, 90)
  37.         SetColor("TopLight", 105, 105, 120)
  38.         SetColor("Hatch1", 35, 35, 45)
  39.         SetColor("Hatch2", 40, 40, 50)
  40.         SetColor("BottomBorder", 25, 25, 30)
  41.     End Sub
  42.  
  43.     Protected Overrides Sub ColorHook()
  44.         C1 = GetColor("BackColor")
  45.         C2 = GetColor("Gradient1")
  46.         C3 = GetColor("Gradient2")
  47.  
  48.         P1 = New Pen(GetColor("TopBorder"))
  49.         P2 = New Pen(GetColor("TopLight"))
  50.         P3 = New Pen(GetColor("BottomBorder"))
  51.  
  52.         B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch2"))
  53.  
  54.         BackColor = C1
  55.     End Sub
  56.  
  57.     Private C1, C2, C3 As Color
  58.     Private P1, P2, P3 As Pen
  59.     Private B1 As HatchBrush
  60.  
  61.     Protected Overrides Sub PaintHook()
  62.         G.Clear(C1)
  63.  
  64.         If Not _TopHeight = 0 Then
  65.             DrawGradient(C2, C3, 0, 0, Width, _TopHeight)
  66.             G.DrawLine(P1, 0, _TopHeight - 1, Width, _TopHeight - 1)
  67.             G.DrawLine(P2, 0, _TopHeight, Width, _TopHeight)
  68.         End If
  69.  
  70.         If Not _BottomHeight = 0 Then
  71.             G.FillRectangle(B1, 0, Height - _BottomHeight, Width, _BottomHeight)
  72.             G.DrawLine(P3, 0, Height - _BottomHeight, Width, Height - _BottomHeight)
  73.         End If
  74.  
  75.     End Sub
  76.  
  77. End Class
  78.  
  79.  
  80. Class StormButtonA
  81.     Inherits ThemeControl
  82.  
  83.     Private Blend As ColorBlend
  84.  
  85.     Sub New()
  86.  
  87.         Blend = New ColorBlend
  88.         Blend.Positions = {0, 0.5, 1}
  89.  
  90.         SetColor("Blend1", 150, 150, 165)
  91.         SetColor("Blend2", 120, 120, 140)
  92.         SetColor("Blend3", 150, 150, 165)
  93.         SetColor("Shine", 20, Color.White)
  94.         SetColor("Glow", 30, Color.White)
  95.         SetColor("Text", Color.White)
  96.         SetColor("Light", 150, 150, 165)
  97.         SetColor("Border", 70, 70, 90)
  98.  
  99.     End Sub
  100.  
  101.     Protected Overrides Sub ColorHook()
  102.         B1 = New SolidBrush(GetColor("Shine"))
  103.         B2 = New SolidBrush(GetColor("Glow"))
  104.         B3 = New SolidBrush(GetColor("Text"))
  105.  
  106.         P1 = New Pen(GetColor("Light"))
  107.         P2 = New Pen(GetColor("Border"))
  108.  
  109.         Blend.Colors = {GetColor("Blend1"), GetColor("Blend2"), GetColor("Blend3")}
  110.     End Sub
  111.  
  112.     Private B1, B2, B3 As SolidBrush
  113.     Private P1, P2 As Pen
  114.  
  115.     Protected Overrides Sub PaintHook()
  116.         G.Clear(BackColor)
  117.  
  118.         DrawGradient(Blend, ClientRectangle, 90)
  119.  
  120.         G.FillRectangle(B1, 0, 0, Width, Height \ 2)
  121.  
  122.         If State = MouseState.Over Then
  123.             G.FillRectangle(B2, ClientRectangle)
  124.         End If
  125.  
  126.         DrawText(B3, HorizontalAlignment.Center, 0, 0)
  127.  
  128.         DrawBorders(P1, 1)
  129.         DrawBorders(P2)
  130.     End Sub
  131. End Class
  132.  
  133.  
  134. Class StormButtonB
  135.     Inherits ThemeControl
  136.  
  137.     Sub New()
  138.         SetColor("DownGradient1", 170, 180, 0)
  139.         SetColor("DownGradient2", 220, 230, 0)
  140.         SetColor("UpGradient1", 220, 230, 0)
  141.         SetColor("UpGradient2", 170, 180, 0)
  142.         SetColor("Text", Color.Black)
  143.         SetColor("Light", 65, Color.White)
  144.         SetColor("Border", 70, 70, 90)
  145.         SetColor("OuterLight", 105, 105, 120)
  146.         SetColor("Corners", 125, 130, 70)
  147.     End Sub
  148.  
  149.     Protected Overrides Sub ColorHook()
  150.         C1 = GetColor("DownGradient1")
  151.         C2 = GetColor("DownGradient2")
  152.         C3 = GetColor("UpGradient1")
  153.         C4 = GetColor("UpGradient2")
  154.         C5 = GetColor("Corners")
  155.  
  156.         P1 = New Pen(GetColor("Light"))
  157.         P2 = New Pen(GetColor("Border"))
  158.         P3 = New Pen(GetColor("OuterLight"))
  159.  
  160.         B1 = New SolidBrush(GetColor("Text"))
  161.     End Sub
  162.  
  163.     Private C1, C2, C3, C4, C5 As Color
  164.     Private P1, P2, P3 As Pen
  165.     Private B1 As SolidBrush
  166.  
  167.     Protected Overrides Sub PaintHook()
  168.         G.Clear(BackColor)
  169.  
  170.         If State = MouseState.Down Then
  171.             DrawGradient(C1, C2, 0, 0, Width, Height - 1, 90)
  172.         Else
  173.             DrawGradient(C3, C4, 0, 0, Width, Height - 1, 90)
  174.         End If
  175.  
  176.         DrawText(B1, HorizontalAlignment.Center, 0, 0)
  177.  
  178.         DrawBorders(P1, 1, 1, Width - 2, Height - 3)
  179.         DrawBorders(P2, 0, 0, Width, Height - 1)
  180.  
  181.         If NoRounding Then
  182.             G.DrawLine(P3, 0, Height - 1, Width, Height - 1)
  183.         Else
  184.             G.DrawLine(P3, 2, Height - 1, Width - 3, Height - 1)
  185.         End If
  186.  
  187.         DrawCorners(C5, 1, 1, Width - 2, Height - 3)
  188.         DrawCorners(BackColor, 0, 0, Width, Height - 1)
  189.     End Sub
  190. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement