SoulZeh

StyleThemev2

Jun 17th, 2012
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.60 KB | None | 0 0
  1. Imports System.Drawing.Drawing2D
  2. Imports System.ComponentModel
  3. Imports System.Runtime.InteropServices
  4.  
  5.  
  6. '------------------
  7. 'Creator: SoulZeh
  8. 'Created: 23/11/2011
  9. 'Credits xZ3ROxPROJ3CTx, oVERT3Xo
  10. 'I Love him <3
  11. '------------------
  12. Class StyleTheme
  13.  
  14. Inherits ThemeContainer153
  15.  
  16. Sub New()
  17. TransparencyKey = Color.Fuchsia
  18. SetColor("Border 1", Color.FromArgb(253, 148, 62))
  19. SetColor("Border 2", Color.FromArgb(161, 86, 20))
  20. Font = New Font("Calibri", 9)
  21. BackColor = Color.FromArgb(77, 201, 255)
  22. SetColor("TopGloss", Color.FromArgb(62, Color.White))
  23. SetColor("BottomGloss", Color.FromArgb(30, Color.Blue))
  24. End Sub
  25. Protected Overrides Sub ColorHook()
  26. C1 = GetColor("Border 1")
  27. C2 = GetColor("Border 2")
  28. C3 = GetColor("TopGloss")
  29. C4 = GetColor("BottomGloss")
  30. End Sub
  31. Private C1, C2, C3, C4 As Color
  32. Private RT1 As Rectangle
  33. Protected Overrides Sub PaintHook()
  34.  
  35. DrawGradient(C1, C2, 0, 0, Width, Height)
  36. RT1 = New Rectangle(11, 25, Width - 22, Height - 35)
  37. G.FillRectangle(Brushes.White, RT1)
  38.  
  39. DrawGradient(C3, C4, New Rectangle(1, 1, Width - 2, 13), 90S)
  40. DrawBorders(Pens.Brown)
  41. DrawCorners(Color.Fuchsia)
  42. DrawText(Brushes.White, HorizontalAlignment.Left, 7, 0)
  43.  
  44.  
  45. G.FillRectangle(New SolidBrush(Color.FromArgb(77, 201, 255)), New Rectangle(11, 25, Width - 22, Height - 35))
  46. Dim shadowLGB As New LinearGradientBrush(New Rectangle(11, 25, Width - 22, 20), Color.FromArgb(77, 201, 255), Color.FromArgb(77, 201, 255), 90S)
  47. G.FillRectangle(shadowLGB, New Rectangle(11, 25, Width - 22, 20))
  48. G.DrawLine(New Pen(New SolidBrush(Color.FromArgb(24, 24, 24))), 11, 26, Width - 11, 26)
  49. G.DrawRectangle(Pens.Black, New Rectangle(11, 25, Width - 22, Height - 35))
  50. G.DrawLine(New Pen(New SolidBrush(Color.FromArgb(151, 150, 146))), 1, 1, Width - 2, 1)
  51. G.DrawRectangle(New Pen(New SolidBrush(Color.FromArgb(42, 41, 37))), 10, 24, Width - 20, Height - 33)
  52. DrawCorners(Color.FromArgb(38, 38, 38), New Rectangle(11, 25, Width - 21, Height - 34))
  53. DrawCorners(Color.FromArgb(55, 55, 55), New Rectangle(9, 23, Width - 21, Height - 34))
  54. End Sub
  55. End Class
  56. Class StyleButton
  57. Inherits ThemeControl153
  58.  
  59. Sub New()
  60. BackColor = Color.FromArgb(33, 33, 33)
  61.  
  62. SetColor("ButtonFillColor", Color.FromArgb(253, 129, 32))
  63. SetColor("ButtonClickColor", Color.FromArgb(40, 40, 40))
  64. SetColor("InsetBorderColor", Color.Brown)
  65. SetColor("TopGloss", Color.FromArgb(62, Color.White))
  66. SetColor("BottomGloss", Color.FromArgb(30, Color.White))
  67. SetColor("TopInset", Color.FromArgb(253, 129, 32))
  68. SetColor("BottomInset", Color.FromArgb(95, 70, 70, 70))
  69. SetColor("BorderColor", Color.Brown)
  70. SetColor("TextColor", Color.Black)
  71. End Sub
  72. Dim C1, C2, C3, C4, C5, C6, C7, C8, C9 As Color
  73. Protected Overrides Sub ColorHook()
  74. C1 = GetColor("ButtonFillColor")
  75. C2 = GetColor("InsetBorderColor")
  76. C3 = GetColor("TopGloss")
  77. C4 = GetColor("BottomGloss")
  78. C5 = GetColor("TopInset")
  79. C6 = GetColor("BottomInset")
  80. C7 = GetColor("BorderColor")
  81. C8 = GetColor("TextColor")
  82. C9 = GetColor("ButtonClickColor")
  83. End Sub
  84.  
  85. Protected Overrides Sub PaintHook()
  86. G.Clear(BackColor)
  87. Select Case State
  88. Case 0
  89. G.FillRectangle(New SolidBrush(C1), New Rectangle(1, 1, Width - 2, Height - 2))
  90. DrawBorders(New Pen(New SolidBrush(C2)), 2)
  91. DrawGradient(C3, C4, New Rectangle(1, 1, Width - 2, Height / 2 - 2), 90S)
  92. Case 1
  93. G.FillRectangle(New SolidBrush(C1), New Rectangle(1, 1, Width - 2, Height - 2))
  94. DrawBorders(New Pen(New SolidBrush(C2)), 2)
  95. DrawGradient(C3, C4, New Rectangle(1, 1, Width - 2, Height / 2 - 2), 90S)
  96. Case 2
  97. G.FillRectangle(New SolidBrush(C9), New Rectangle(1, 1, Width - 2, Height - 2))
  98. DrawBorders(New Pen(New SolidBrush(C2)), 2)
  99. DrawGradient(C4, C4, New Rectangle(1, 1, Width - 2, Height / 2 - 2), 90S)
  100. End Select
  101.  
  102.  
  103. DrawBorders(New Pen(New SolidBrush(C7)), 1)
  104. G.DrawLine(New Pen(New SolidBrush(C5)), 0, 0, Width, 0)
  105. G.DrawLine(New Pen(New SolidBrush(C5)), 0, 0, 0, Height)
  106. G.DrawLine(New Pen(New SolidBrush(C5)), Width - 1, 0, Width - 1, Height)
  107. G.DrawLine(New Pen(New SolidBrush(C6)), 0, Height - 1, Width, Height - 1)
  108. DrawCorners(BackColor)
  109. DrawCorners(BackColor, New Rectangle(1, 1, Width - 2, Height - 2))
  110. DrawText(New SolidBrush(C8), HorizontalAlignment.Center, 0, 0)
  111. End Sub
  112. End Class
  113.  
  114. Class StyleProgressBar
  115. Inherits ThemeControl153
  116. Private _Maximum As Integer = 100
  117. Private OFS As Integer = 0
  118. Protected Overrides Sub CreateHandle()
  119. MyBase.CreateHandle()
  120. Dim Derp As New Timer
  121. Derp.Interval = 50
  122. 'Add the animate() sub to the Timer via AddHandler <----- that one
  123. AddHandler Derp.Tick, AddressOf animate
  124. Derp.Start()
  125.  
  126. End Sub
  127. Sub animate()
  128. 'Modify the OFS offset so that it goes up to the control width.
  129. 'When it reaches control width, set it back to 0
  130. If OFS <= Width Then : OFS += 1
  131. Else : OFS = 0
  132. End If
  133. Invalidate()
  134.  
  135. End Sub
  136.  
  137.  
  138. Public Property Maximum() As Integer
  139. Get
  140. Return _Maximum
  141. End Get
  142. Set(ByVal value As Integer)
  143. If value < 1 Then value = 1
  144. If value < _Value Then _Value = value
  145. _Maximum = value
  146. Invalidate()
  147. End Set
  148. End Property
  149.  
  150. Private _Value As Integer = 50
  151. Public Property Value() As Integer
  152. Get
  153. Return _Value
  154. End Get
  155. Set(ByVal value As Integer)
  156. If value > _Maximum Then value = _Maximum
  157. _Value = value
  158. Invalidate()
  159. End Set
  160. End Property
  161.  
  162. Private C1 As Color 'G.Clear
  163. Private C2, C3 As Color 'Lime Gradient
  164. Private P1 As Pen 'DrawRectangle
  165. Private B1 As Brush 'Gloss
  166. Sub New()
  167. Size = New Size(75, 18)
  168. End Sub
  169. Protected Overrides Sub ColorHook()
  170. C1 = Color.FromArgb(12, 95, 197)
  171. C2 = Color.FromArgb(55, 236, 62)
  172. C3 = Color.FromArgb(137, 244, 109)
  173. P1 = Pens.Black
  174. B1 = New SolidBrush(Color.FromArgb(30, Color.White))
  175. End Sub
  176.  
  177. Protected Overrides Sub PaintHook()
  178. G.Clear(C1)
  179. If (_Value > 0) Then
  180. G.RenderingOrigin = New Point(OFS, 0)
  181. DrawGradient(C2, C3, 0, 0, CInt((_Value / _Maximum) * Width), Height, 90S)
  182. Dim T As New HatchBrush(HatchStyle.DarkDownwardDiagonal, Color.FromArgb(65, 3, 35, 58), Color.Empty)
  183. G.FillRectangle(T, New Rectangle(0, 0, CInt((_Value / _Maximum) * Width), Height))
  184.  
  185. End If
  186. G.FillRectangle(B1, 0, 0, Width, CInt(Height / 2))
  187. DrawBorders(P1, 0, 0, Width, Height)
  188. End Sub
  189. End Class
  190. Class StyleComboBox
  191. Inherits ComboBox
  192. Sub New()
  193. MyBase.New()
  194. SetStyle(ControlStyles.AllPaintingInWmPaint Or _
  195. ControlStyles.ResizeRedraw Or _
  196. ControlStyles.UserPaint Or _
  197. ControlStyles.DoubleBuffer, True)
  198. DrawMode = Windows.Forms.DrawMode.OwnerDrawFixed
  199. BackColor = Color.FromArgb(45, 45, 45)
  200. ForeColor = Color.White
  201. DropDownStyle = ComboBoxStyle.DropDownList
  202. End Sub
  203. Private _StartIndex As Integer = 0
  204. Public Property StartIndex As Integer
  205. Get
  206. Return _StartIndex
  207. End Get
  208. Set(ByVal value As Integer)
  209. _StartIndex = value
  210. Try
  211. MyBase.SelectedIndex = value
  212. Catch
  213. End Try
  214. Invalidate()
  215. End Set
  216. End Property
  217. Private LightBlack As Color = Color.FromArgb(37, 37, 37)
  218. Private LighterBlack As Color = Color.FromArgb(60, 60, 60)
  219. Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  220. MyBase.OnPaint(e)
  221. Dim G As Graphics = e.Graphics
  222. Dim T As LinearGradientBrush = New LinearGradientBrush(New Rectangle(0, 0, Width, 10), Color.FromArgb(62, Color.White), Color.FromArgb(30, Color.White), 90S)
  223. Dim DrawCornersBrush As SolidBrush
  224. DrawCornersBrush = New SolidBrush(Color.FromArgb(37, 37, 37))
  225. Try
  226. With G
  227. G.SmoothingMode = SmoothingMode.HighQuality
  228. .Clear(Color.FromArgb(37, 37, 37))
  229. .FillRectangle(T, New Rectangle(0, 0, Width, 9))
  230. .DrawString(Items(SelectedIndex).ToString, Font, Brushes.White, New Point(3, 3))
  231. .DrawLine(New Pen(New SolidBrush(Color.FromArgb(37, 37, 37))), 0, 0, 0, 0)
  232. .DrawRectangle(New Pen(New SolidBrush(Color.FromArgb(0, 0, 0))), New Rectangle(1, 1, Width - 3, Height - 3))
  233.  
  234. .DrawLine(New Pen(New SolidBrush(Color.FromArgb(45, 45, 45))), 0, 0, Width, 0)
  235. .DrawLine(New Pen(New SolidBrush(Color.FromArgb(45, 45, 45))), 0, 0, 0, Height)
  236. .DrawLine(New Pen(New SolidBrush(Color.FromArgb(45, 45, 45))), Width - 1, 0, Width - 1, Height)
  237. .DrawLine(New Pen(New SolidBrush(Color.FromArgb(70, 70, 70))), 0, Height - 1, Width, Height - 1)
  238.  
  239. DrawTriangle(Color.White, New Point(Width - 15, 8), New Point(Width - 7, 8), New Point(Width - 11, 13), G)
  240. End With
  241. Catch
  242. End Try
  243. End Sub
  244. Sub ReplaceItem(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles Me.DrawItem
  245. e.DrawBackground()
  246. Try
  247. If (e.State And DrawItemState.Selected) = DrawItemState.Selected Then
  248. e.Graphics.FillRectangle(New SolidBrush(Color.FromArgb(37, 37, 37)), e.Bounds)
  249. End If
  250. Using b As New SolidBrush(e.ForeColor)
  251. e.Graphics.DrawString(MyBase.GetItemText(MyBase.Items(e.Index)), e.Font, b, e.Bounds)
  252. End Using
  253. Catch
  254. End Try
  255. e.DrawFocusRectangle()
  256. End Sub
  257. Protected Sub DrawTriangle(ByVal Clr As Color, ByVal FirstPoint As Point, ByVal SecondPoint As Point, ByVal ThirdPoint As Point, ByVal G As Graphics)
  258. Dim points As New List(Of Point)()
  259. points.Add(FirstPoint)
  260. points.Add(SecondPoint)
  261. points.Add(ThirdPoint)
  262. G.FillPolygon(New SolidBrush(Clr), points.ToArray)
  263. End Sub
  264. End Class
Advertisement
Add Comment
Please, Sign In to add comment