Advertisement
Guest User

Untitled

a guest
Jan 3rd, 2011
5,397
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.55 KB | None | 0 0
  1. 'Creator: Aeonhack
  2. 'Date: January, 2nd, 2011
  3. 'Site: EliteVS.net
  4.  
  5. 'Name: Fusion Theme
  6. 'Version: 1.0
  7.  
  8. Imports System.Drawing.Drawing2D
  9.  
  10. Class Pigment
  11.  
  12. Private _Name As String = "Pigment"
  13. Property Name() As String
  14. Get
  15. Return _name
  16. End Get
  17. Set(ByVal v As String)
  18. _name = v
  19. End Set
  20. End Property
  21.  
  22.  
  23. Private _Value As Color = Color.Black
  24. Public Property Value() As Color
  25. Get
  26. Return _Value
  27. End Get
  28. Set(ByVal value As Color)
  29. _Value = value
  30. End Set
  31. End Property
  32.  
  33.  
  34. Sub New()
  35. End Sub
  36.  
  37. Sub New(ByVal n As String, ByVal v As Color)
  38. Name = n
  39. Value = v
  40. End Sub
  41.  
  42. Sub New(ByVal n As String, ByVal a As Byte, ByVal r As Byte, ByVal g As Byte, ByVal b As Byte)
  43. Name = n
  44. Value = Color.FromArgb(a, r, g, b)
  45. End Sub
  46.  
  47. Sub New(ByVal n As String, ByVal r As Byte, ByVal g As Byte, ByVal b As Byte)
  48. Name = n
  49. Value = Color.FromArgb(r, g, b)
  50. End Sub
  51. End Class
  52.  
  53. Class FTheme
  54. Inherits ContainerControl
  55.  
  56.  
  57. Private _Resizeable As Boolean = True
  58. Public Property Resizeable() As Boolean
  59. Get
  60. Return _Resizeable
  61. End Get
  62. Set(ByVal value As Boolean)
  63. _Resizeable = value
  64. End Set
  65. End Property
  66.  
  67.  
  68.  
  69. Sub New()
  70. SetStyle(DirectCast(8198, ControlStyles), True)
  71. C = New Pigment() { _
  72. New Pigment("Border", Color.Black), _
  73. New Pigment("Frame", 47, 47, 50), _
  74. New Pigment("Border Highlight", 15, 255, 255, 255), _
  75. New Pigment("Side Highlight", 6, 255, 255, 255), _
  76. New Pigment("Shine", 20, 255, 255, 255), _
  77. New Pigment("Shadow", 38, 38, 40), _
  78. New Pigment("Backcolor", 247, 247, 251), _
  79. New Pigment("Transparency", Color.Fuchsia) _
  80. }
  81. End Sub
  82.  
  83. Protected Overrides Sub OnHandleCreated(ByVal e As EventArgs)
  84. Dock = DockStyle.Fill
  85. If TypeOf Parent Is Form Then DirectCast(Parent, Form).FormBorderStyle = FormBorderStyle.None
  86. Colors = C
  87. MyBase.OnHandleCreated(e)
  88. End Sub
  89.  
  90. Const Count As Byte = 8
  91. Private C As Pigment()
  92. Public Property Colors() As Pigment()
  93. Get
  94. Return C
  95. End Get
  96. Set(ByVal v As Pigment())
  97. If v.Length <> Count Then Throw New IndexOutOfRangeException
  98.  
  99. P1 = New Pen(v(0).Value)
  100. P2 = New Pen(v(2).Value)
  101.  
  102. B1 = New SolidBrush(v(6).Value)
  103. B2 = New SolidBrush(v(7).Value)
  104.  
  105. If Parent IsNot Nothing Then
  106. Parent.BackColor = v(6).Value
  107. If TypeOf Parent Is Form Then DirectCast(Parent, Form).TransparencyKey = v(7).Value
  108. End If
  109.  
  110. CB = New ColorBlend
  111. CB.Colors = New Color() {Color.Transparent, v(4).Value, Color.Transparent}
  112. CB.Positions = New Single() {0, 0.5, 1}
  113.  
  114. C = v
  115.  
  116. Invalidate()
  117. End Set
  118. End Property
  119.  
  120. Private P1, P2, P3 As Pen
  121. Private B1, B2 As SolidBrush, B3, B4 As LinearGradientBrush
  122. Private R1, R2 As Rectangle
  123. Private CB As ColorBlend
  124.  
  125. Private G As Graphics, B As Bitmap
  126. Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  127. B = New Bitmap(Width, Height)
  128. G = Graphics.FromImage(B)
  129.  
  130. G.Clear(C(1).Value)
  131.  
  132.  
  133. G.DrawRectangle(P2, New Rectangle(1, 1, Width - 3, Height - 3))
  134. G.DrawRectangle(P2, New Rectangle(12, 40, Width - 24, Height - 52))
  135.  
  136.  
  137. R1 = New Rectangle(1, 0, 15, Height)
  138. B3 = New LinearGradientBrush(R1, C(3).Value, Color.Transparent, 90.0F)
  139. G.FillRectangle(B3, R1)
  140. G.FillRectangle(B3, New Rectangle(Width - 16, 0, 15, Height))
  141.  
  142.  
  143. G.FillRectangle(B1, New Rectangle(13, 41, Width - 26, Height - 54))
  144.  
  145.  
  146. R2 = New Rectangle(0, 2, Width, 2)
  147. B4 = New LinearGradientBrush(R2, Color.Empty, Color.Empty, 0)
  148. B4.InterpolationColors = CB
  149. G.FillRectangle(B4, R2)
  150.  
  151.  
  152. G.DrawRectangle(P1, New Rectangle(13, 41, Width - 26, Height - 54))
  153. G.DrawRectangle(P1, New Rectangle(0, 0, Width - 1, Height - 1))
  154.  
  155.  
  156. G.FillRectangle(B2, New Rectangle(0, 0, 2, 2))
  157. G.FillRectangle(B2, New Rectangle(Width - 2, 0, 2, 2))
  158. G.FillRectangle(B2, New Rectangle(Width - 2, Height - 2, 2, 2))
  159. G.FillRectangle(B2, New Rectangle(0, Height - 2, 2, 2))
  160.  
  161. B.SetPixel(1, 1, Color.Black)
  162. B.SetPixel(Width - 2, 1, Color.Black)
  163. B.SetPixel(Width - 2, Height - 2, Color.Black)
  164. B.SetPixel(1, Height - 2, Color.Black)
  165.  
  166.  
  167. e.Graphics.DrawImage(B, 0, 0)
  168. B3.Dispose()
  169. B4.Dispose()
  170. G.Dispose()
  171. B.Dispose()
  172. End Sub
  173.  
  174.  
  175. Enum Direction As Integer
  176. NONE = 0
  177. LEFT = 10
  178. RIGHT = 11
  179. TOP = 12
  180. TOPLEFT = 13
  181. TOPRIGHT = 14
  182. BOTTOM = 15
  183. BOTTOMLEFT = 16
  184. BOTTOMRIGHT = 17
  185. End Enum
  186. Private Current As Direction
  187. Sub SetCurrent()
  188. Dim T As Point = PointToClient(MousePosition)
  189. If T.X < 7 And T.Y < 7 Then
  190. Current = Direction.TOPLEFT
  191. Cursor = Cursors.SizeNWSE
  192. ElseIf T.X < 7 And T.Y > Height - 7 Then
  193. Current = Direction.BOTTOMLEFT
  194. Cursor = Cursors.SizeNESW
  195. ElseIf T.X > Width - 7 And T.Y > Height - 7 Then
  196. Current = Direction.BOTTOMRIGHT
  197. Cursor = Cursors.SizeNWSE
  198. ElseIf T.X > Width - 7 And T.Y < 7 Then
  199. Current = Direction.TOPRIGHT
  200. Cursor = Cursors.SizeNESW
  201. ElseIf T.X < 7 Then
  202. Current = Direction.LEFT
  203. Cursor = Cursors.SizeWE
  204. ElseIf T.X > Width - 7 Then
  205. Current = Direction.RIGHT
  206. Cursor = Cursors.SizeWE
  207. ElseIf T.Y < 7 Then
  208. Current = Direction.TOP
  209. Cursor = Cursors.SizeNS
  210. ElseIf T.Y > Height - 7 Then
  211. Current = Direction.BOTTOM
  212. Cursor = Cursors.SizeNS
  213. Else
  214. Current = Direction.NONE
  215. Cursor = Cursors.Default
  216. End If
  217. End Sub
  218. Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  219. If e.Button = MouseButtons.Left Then
  220. If TypeOf Parent Is Form Then
  221. If DirectCast(Parent, Form).WindowState = FormWindowState.Maximized Then Return
  222. End If
  223. If Drag.Contains(e.Location) Then
  224. Capture = False
  225. DefWndProc(Message.Create(Parent.Handle, 161, New IntPtr(2), Nothing))
  226. Else
  227. If Current <> Direction.NONE And _Resizeable Then
  228. Capture = False
  229. DefWndProc(Message.Create(Parent.Handle, 161, New IntPtr(Current), Nothing))
  230. End If
  231. End If
  232. End If
  233. MyBase.OnMouseDown(e)
  234. End Sub
  235. Protected Overrides Sub OnMouseMove(ByVal e As MouseEventArgs)
  236. If _Resizeable Then SetCurrent()
  237. MyBase.OnMouseMove(e)
  238. End Sub
  239. Protected Overrides Sub OnSizeChanged(ByVal e As System.EventArgs)
  240. Invalidate()
  241. MyBase.OnSizeChanged(e)
  242. End Sub
  243. Private ReadOnly Property Drag() As Rectangle
  244. Get
  245. Return New Rectangle(7, 7, Width - 14, 35)
  246. End Get
  247. End Property
  248.  
  249. End Class
  250. Class FButton
  251. Inherits Control
  252.  
  253.  
  254. Private Shadow_ As Boolean = True
  255. Public Property Shadow() As Boolean
  256. Get
  257. Return Shadow_
  258. End Get
  259. Set(ByVal value As Boolean)
  260. Shadow_ = value
  261. Invalidate()
  262. End Set
  263. End Property
  264.  
  265.  
  266. Sub New()
  267. SetStyle(DirectCast(8198, ControlStyles), True)
  268. Colors = New Pigment() {New Pigment("Border", 254, 133, 0), New Pigment("Backcolor", 247, 247, 251), _
  269. New Pigment("Highlight", 255, 197, 19), New Pigment("Gradient1", 255, 175, 12), _
  270. New Pigment("Gradient2", 255, 127, 1), New Pigment("Text Color", Color.White), _
  271. New Pigment("Text Shadow", 30, 0, 0, 0)}
  272. Font = New Font("Verdana", 8)
  273. End Sub
  274.  
  275. Const Count As Byte = 7
  276. Private C As Pigment()
  277. Public Property Colors() As Pigment()
  278. Get
  279. Return C
  280. End Get
  281. Set(ByVal v As Pigment())
  282. If v.Length <> Count Then Throw New IndexOutOfRangeException
  283.  
  284. P1 = New Pen(v(0).Value)
  285. P2 = New Pen(v(2).Value)
  286.  
  287. B1 = New SolidBrush(v(6).Value)
  288. B2 = New SolidBrush(v(5).Value)
  289.  
  290. C = v
  291. Invalidate()
  292. End Set
  293. End Property
  294.  
  295. Private P1, P2 As Pen
  296. Private B1, B2 As SolidBrush, B3 As LinearGradientBrush
  297. Private SZ As Size, PT As Point
  298.  
  299. Private G As Graphics, B As Bitmap
  300. Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  301. B = New Bitmap(Width, Height)
  302. G = Graphics.FromImage(B)
  303.  
  304. If Down Then
  305. B3 = New LinearGradientBrush(ClientRectangle, C(4).Value, C(3).Value, 90.0F)
  306. Else
  307. B3 = New LinearGradientBrush(ClientRectangle, C(3).Value, C(4).Value, 90.0F)
  308. End If
  309. G.FillRectangle(B3, ClientRectangle)
  310.  
  311. If Not String.IsNullOrEmpty(Text) Then
  312. SZ = G.MeasureString(Text, Font).ToSize
  313. PT = New Point(CInt(Width / 2 - SZ.Width / 2), CInt(Height / 2 - SZ.Height / 2))
  314. If Shadow_ Then G.DrawString(Text, Font, B1, PT.X + 1, PT.Y + 1)
  315. G.DrawString(Text, Font, B2, PT)
  316. End If
  317.  
  318. G.DrawRectangle(P1, New Rectangle(0, 0, Width - 1, Height - 1))
  319. G.DrawRectangle(P2, New Rectangle(1, 1, Width - 3, Height - 3))
  320.  
  321. B.SetPixel(0, 0, C(1).Value)
  322. B.SetPixel(Width - 1, 0, C(1).Value)
  323. B.SetPixel(Width - 1, Height - 1, C(1).Value)
  324. B.SetPixel(0, Height - 1, C(1).Value)
  325.  
  326. e.Graphics.DrawImage(B, 0, 0)
  327. B3.Dispose()
  328. G.Dispose()
  329. B.Dispose()
  330. End Sub
  331.  
  332. Private Down As Boolean
  333. Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  334. If e.Button = MouseButtons.Left Then
  335. Down = True
  336. Invalidate()
  337. End If
  338. MyBase.OnMouseDown(e)
  339. End Sub
  340. Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
  341. Down = False
  342. Invalidate()
  343. MyBase.OnMouseUp(e)
  344. End Sub
  345.  
  346. End Class
  347. Class FProgressBar
  348. Inherits Control
  349.  
  350. Private _Maximum As Double = 100
  351. Public Property Maximum() As Double
  352. Get
  353. Return _Maximum
  354. End Get
  355. Set(ByVal v As Double)
  356. _Maximum = v
  357. Progress = _Current / v * 100
  358. End Set
  359. End Property
  360. Private _Current As Double
  361. Public Property Current() As Double
  362. Get
  363. Return _Current
  364. End Get
  365. Set(ByVal v As Double)
  366. Progress = v / _Maximum * 100
  367. End Set
  368. End Property
  369. Private _Progress As Double
  370. Public Property Progress() As Double
  371. Get
  372. Return _Progress
  373. End Get
  374. Set(ByVal v As Double)
  375. If v < 0 Then v = 0 Else If v > 100 Then v = 100
  376. _Progress = v
  377. _Current = v * 0.01 * _Maximum
  378. Invalidate()
  379. End Set
  380. End Property
  381.  
  382. Sub New()
  383. SetStyle(DirectCast(8198, ControlStyles), True)
  384. Colors = New Pigment() { _
  385. New Pigment("Border", 214, 214, 216), New Pigment("Backcolor1", 247, 247, 251), _
  386. New Pigment("Backcolor2", 239, 239, 242), New Pigment("Highlight", 100, 255, 255, 255), _
  387. New Pigment("Forecolor", 224, 224, 224), New Pigment("Gloss", 130, 255, 255, 255)}
  388. End Sub
  389.  
  390. Const Count As Byte = 6
  391. Private C As Pigment()
  392. Public Property Colors() As Pigment()
  393. Get
  394. Return C
  395. End Get
  396. Set(ByVal v As Pigment())
  397. If v.Length <> Count Then Throw New IndexOutOfRangeException
  398.  
  399. P1 = New Pen(v(0).Value)
  400. P2 = New Pen(v(3).Value)
  401.  
  402. B1 = New SolidBrush(v(4).Value)
  403.  
  404. CB = New ColorBlend
  405. CB.Colors = New Color() {v(5).Value, Color.Transparent, Color.Transparent}
  406. CB.Positions = New Single() {0, 0.3, 1}
  407.  
  408. C = v
  409. Invalidate()
  410. End Set
  411. End Property
  412.  
  413. Private P1, P2 As Pen
  414. Private B1 As SolidBrush, B2 As LinearGradientBrush
  415. Private CB As ColorBlend
  416.  
  417. Private G As Graphics, B As Bitmap
  418. Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  419. B = New Bitmap(Width, Height)
  420. G = Graphics.FromImage(B)
  421.  
  422. G.Clear(C(2).Value)
  423.  
  424. G.FillRectangle(B1, New Rectangle(1, 1, CInt((Width * _Progress * 0.01) - 2), Height - 2))
  425.  
  426. B2 = New LinearGradientBrush(ClientRectangle, Color.Empty, Color.Empty, 90.0F)
  427. B2.InterpolationColors = CB
  428. G.FillRectangle(B2, ClientRectangle)
  429.  
  430. G.DrawRectangle(P1, New Rectangle(0, 0, Width - 1, Height - 1))
  431. G.DrawRectangle(P2, New Rectangle(1, 1, Width - 3, Height - 3))
  432.  
  433. B.SetPixel(0, 0, C(1).Value)
  434. B.SetPixel(Width - 1, 0, C(1).Value)
  435. B.SetPixel(Width - 1, Height - 1, C(1).Value)
  436. B.SetPixel(0, Height - 1, C(1).Value)
  437.  
  438. e.Graphics.DrawImage(B, 0, 0)
  439. B2.Dispose()
  440. G.Dispose()
  441. B.Dispose()
  442. End Sub
  443.  
  444. Protected Overrides Sub OnSizeChanged(ByVal e As EventArgs)
  445. Invalidate()
  446. MyBase.OnSizeChanged(e)
  447. End Sub
  448. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement