Guest User

كود الثيم من الجوكر

a guest
Dec 19th, 2015
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.27 KB | None | 0 0
  1. ' ##################################################
  2. ' # Credits: #
  3. ' # #
  4. ' # Tedd - Theme #
  5. ' # AeonHack - Themebase #
  6. ' # xZ3R0xPROJ3CTx - Help and ideas #
  7. ' # #
  8. ' ##################################################
  9. Imports System.Drawing.Drawing2D
  10. Imports System.ComponentModel
  11. Imports System.Runtime.InteropServices
  12.  
  13. MustInherit Class Theme
  14. Inherits ContainerControl
  15.  
  16. #Region " Initialization "
  17.  
  18. Protected G As Graphics
  19. Sub New()
  20. SetStyle(DirectCast(139270, ControlStyles), True)
  21. End Sub
  22.  
  23. Private ParentIsForm As Boolean
  24. Protected Overrides Sub OnHandleCreated(ByVal e As EventArgs)
  25. Dock = DockStyle.Fill
  26. ParentIsForm = TypeOf Parent Is Form
  27. If ParentIsForm Then
  28. If Not _TransparencyKey = Color.Empty Then ParentForm.TransparencyKey = _TransparencyKey
  29. ParentForm.FormBorderStyle = FormBorderStyle.FixedSingle
  30. End If
  31. MyBase.OnHandleCreated(e)
  32. End Sub
  33.  
  34. Overrides Property Text As String
  35. Get
  36. Return MyBase.Text
  37. End Get
  38. Set(ByVal v As String)
  39. MyBase.Text = v
  40. Invalidate()
  41. End Set
  42. End Property
  43. #End Region
  44.  
  45. #Region " Sizing and Movement "
  46.  
  47. Private _Resizable As Boolean = True
  48. Property Resizable() As Boolean
  49. Get
  50. Return _Resizable
  51. End Get
  52. Set(ByVal value As Boolean)
  53. _Resizable = value
  54. End Set
  55. End Property
  56.  
  57. Private _MoveHeight As Integer = 24
  58. Property MoveHeight() As Integer
  59. Get
  60. Return _MoveHeight
  61. End Get
  62. Set(ByVal v As Integer)
  63. _MoveHeight = v
  64. Header = New Rectangle(7, 7, Width - 14, _MoveHeight - 7)
  65. End Set
  66. End Property
  67.  
  68. Private Flag As IntPtr
  69. Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  70. If Not e.Button = MouseButtons.Left Then Return
  71. If ParentIsForm Then If ParentForm.WindowState = FormWindowState.Maximized Then Return
  72.  
  73. If Header.Contains(e.Location) Then
  74. Flag = New IntPtr(2)
  75. ElseIf Current.Position = 0 Or Not _Resizable Then
  76. Return
  77. Else
  78. Flag = New IntPtr(Current.Position)
  79. End If
  80.  
  81. Capture = False
  82. DefWndProc(Message.Create(Parent.Handle, 161, Flag, Nothing))
  83.  
  84. MyBase.OnMouseDown(e)
  85. End Sub
  86.  
  87. Private Structure Pointer
  88. ReadOnly Cursor As Cursor, Position As Byte
  89. Sub New(ByVal c As Cursor, ByVal p As Byte)
  90. Cursor = c
  91. Position = p
  92. End Sub
  93. End Structure
  94.  
  95. Private F1, F2, F3, F4 As Boolean, PTC As Point
  96. Private Function GetPointer() As Pointer
  97. PTC = PointToClient(MousePosition)
  98. F1 = PTC.X < 7
  99. F2 = PTC.X > Width - 7
  100. F3 = PTC.Y < 7
  101. F4 = PTC.Y > Height - 7
  102.  
  103. If F1 And F3 Then Return New Pointer(Cursors.SizeNWSE, 13)
  104. If F1 And F4 Then Return New Pointer(Cursors.SizeNESW, 16)
  105. If F2 And F3 Then Return New Pointer(Cursors.SizeNESW, 14)
  106. If F2 And F4 Then Return New Pointer(Cursors.SizeNWSE, 17)
  107. If F1 Then Return New Pointer(Cursors.SizeWE, 10)
  108. If F2 Then Return New Pointer(Cursors.SizeWE, 11)
  109. If F3 Then Return New Pointer(Cursors.SizeNS, 12)
  110. If F4 Then Return New Pointer(Cursors.SizeNS, 15)
  111. Return New Pointer(Cursors.Default, 0)
  112. End Function
  113.  
  114. Private Current, Pending As Pointer
  115. Private Sub SetCurrent()
  116. Pending = GetPointer()
  117. If Current.Position = Pending.Position Then Return
  118. Current = GetPointer()
  119. Cursor = Current.Cursor
  120. End Sub
  121.  
  122. Protected Overrides Sub OnMouseMove(ByVal e As MouseEventArgs)
  123. If _Resizable Then SetCurrent()
  124. MyBase.OnMouseMove(e)
  125. End Sub
  126.  
  127. Protected Header As Rectangle
  128. Protected Overrides Sub OnSizeChanged(ByVal e As EventArgs)
  129. If Width = 0 OrElse Height = 0 Then Return
  130. Header = New Rectangle(7, 7, Width - 14, _MoveHeight - 7)
  131. Invalidate()
  132. MyBase.OnSizeChanged(e)
  133. End Sub
  134.  
  135. #End Region
  136.  
  137. #Region " Convienence "
  138.  
  139. MustOverride Sub PaintHook()
  140. Protected NotOverridable Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  141. If Width = 0 OrElse Height = 0 Then Return
  142. G = e.Graphics
  143. PaintHook()
  144. End Sub
  145.  
  146. Private _TransparencyKey As Color
  147. Property TransparencyKey() As Color
  148. Get
  149. Return _TransparencyKey
  150. End Get
  151. Set(ByVal v As Color)
  152. _TransparencyKey = v
  153. Invalidate()
  154. End Set
  155. End Property
  156.  
  157. Private _Image As Image
  158. Property Image() As Image
  159. Get
  160. Return _Image
  161. End Get
  162. Set(ByVal value As Image)
  163. _Image = value
  164. Invalidate()
  165. End Set
  166. End Property
  167. ReadOnly Property ImageWidth() As Integer
  168. Get
  169. If _Image Is Nothing Then Return 0
  170. Return _Image.Width
  171. End Get
  172. End Property
  173.  
  174. Private _Size As Size
  175. Private _Rectangle As Rectangle
  176. Private _Gradient As LinearGradientBrush
  177. Private _Brush As SolidBrush
  178.  
  179. Protected Sub DrawCorners(ByVal c As Color, ByVal rect As Rectangle)
  180. _Brush = New SolidBrush(c)
  181. G.FillRectangle(_Brush, rect.X, rect.Y, 1, 1)
  182. G.FillRectangle(_Brush, rect.X + (rect.Width - 1), rect.Y, 1, 1)
  183. G.FillRectangle(_Brush, rect.X, rect.Y + (rect.Height - 1), 1, 1)
  184. G.FillRectangle(_Brush, rect.X + (rect.Width - 1), rect.Y + (rect.Height - 1), 1, 1)
  185. End Sub
  186.  
  187. Protected Sub DrawBorders(ByVal p1 As Pen, ByVal p2 As Pen, ByVal rect As Rectangle)
  188. G.DrawRectangle(p1, rect.X, rect.Y, rect.Width - 1, rect.Height - 1)
  189. G.DrawRectangle(p2, rect.X + 1, rect.Y + 1, rect.Width - 3, rect.Height - 3)
  190. End Sub
  191.  
  192. Protected Sub DrawText(ByVal a As HorizontalAlignment, ByVal c As Color, ByVal x As Integer)
  193. DrawText(a, c, x, 0)
  194. End Sub
  195. Protected Sub DrawText(ByVal a As HorizontalAlignment, ByVal c As Color, ByVal x As Integer, ByVal y As Integer)
  196. If String.IsNullOrEmpty(Text) Then Return
  197. _Size = G.MeasureString(Text, Font).ToSize
  198. _Brush = New SolidBrush(c)
  199.  
  200. Select Case a
  201. Case HorizontalAlignment.Left
  202. G.DrawString(Text, Font, _Brush, x, _MoveHeight \ 2 - _Size.Height \ 2 + y)
  203. Case HorizontalAlignment.Right
  204. G.DrawString(Text, Font, _Brush, Width - _Size.Width - x, _MoveHeight \ 2 - _Size.Height \ 2 + y)
  205. Case HorizontalAlignment.Center
  206. G.DrawString(Text, Font, _Brush, Width \ 2 - _Size.Width \ 2 + x, _MoveHeight \ 2 - _Size.Height \ 2 + y)
  207. End Select
  208. End Sub
  209. Protected Sub DrawText(ByVal a As HorizontalAlignment, ByVal c As Color, ByVal x As Integer, ByVal y As Integer, ByVal f As Font)
  210. If String.IsNullOrEmpty(Text) Then Return
  211. _Size = G.MeasureString(Text, Font).ToSize
  212. _Brush = New SolidBrush(c)
  213.  
  214. Select Case a
  215. Case HorizontalAlignment.Left
  216. G.DrawString(Text, f, _Brush, x, _MoveHeight \ 2 - _Size.Height \ 2 + y)
  217. Case HorizontalAlignment.Right
  218. G.DrawString(Text, f, _Brush, Width - _Size.Width - x, _MoveHeight \ 2 - _Size.Height \ 2 + y)
  219. Case HorizontalAlignment.Center
  220. G.DrawString(Text, f, _Brush, Width \ 2 - _Size.Width \ 2 + x, _MoveHeight \ 2 - _Size.Height \ 2 + y)
  221. End Select
  222. End Sub
  223.  
  224. Protected Sub DrawIcon(ByVal a As HorizontalAlignment, ByVal x As Integer)
  225. DrawIcon(a, x, 0)
  226. End Sub
  227. Protected Sub DrawIcon(ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
  228. If _Image Is Nothing Then Return
  229. Select Case a
  230. Case HorizontalAlignment.Left
  231. G.DrawImage(_Image, x, _MoveHeight \ 2 - _Image.Height \ 2 + y)
  232. Case HorizontalAlignment.Right
  233. G.DrawImage(_Image, Width - _Image.Width - x, _MoveHeight \ 2 - _Image.Height \ 2 + y)
  234. Case HorizontalAlignment.Center
  235. G.DrawImage(_Image, Width \ 2 - _Image.Width \ 2, _MoveHeight \ 2 - _Image.Height \ 2)
  236. End Select
  237. End Sub
  238.  
  239. Protected Sub DrawGradient(ByVal c1 As Color, ByVal c2 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal angle As Single)
  240. _Rectangle = New Rectangle(x, y, width, height)
  241. _Gradient = New LinearGradientBrush(_Rectangle, c1, c2, angle)
  242. G.FillRectangle(_Gradient, _Rectangle)
  243. End Sub
  244.  
  245. #End Region
  246.  
  247. End Class
  248. MustInherit Class ThemeControl
  249. Inherits Control
  250.  
  251. #Region " Initialization "
  252.  
  253. Protected G As Graphics, B As Bitmap
  254. Sub New()
  255. SetStyle(DirectCast(139270, ControlStyles), True)
  256. B = New Bitmap(1, 1)
  257. G = Graphics.FromImage(B)
  258. End Sub
  259.  
  260. Sub AllowTransparent()
  261. SetStyle(ControlStyles.Opaque, False)
  262. SetStyle(ControlStyles.SupportsTransparentBackColor, True)
  263. End Sub
  264.  
  265. Overrides Property Text As String
  266. Get
  267. Return MyBase.Text
  268. End Get
  269. Set(ByVal v As String)
  270. MyBase.Text = v
  271. Invalidate()
  272. End Set
  273. End Property
  274. #End Region
  275.  
  276. #Region " Mouse Handling "
  277.  
  278. Protected Enum State As Byte
  279. MouseNone = 0
  280. MouseOver = 1
  281. MouseDown = 2
  282. End Enum
  283.  
  284. Protected MouseState As State
  285. Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
  286. ChangeMouseState(State.MouseNone)
  287. MyBase.OnMouseLeave(e)
  288. End Sub
  289. Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
  290. ChangeMouseState(State.MouseOver)
  291. MyBase.OnMouseEnter(e)
  292. End Sub
  293. Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  294. ChangeMouseState(State.MouseOver)
  295. MyBase.OnMouseUp(e)
  296. End Sub
  297. Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  298. If e.Button = MouseButtons.Left Then ChangeMouseState(State.MouseDown)
  299. MyBase.OnMouseDown(e)
  300. End Sub
  301.  
  302. Private Sub ChangeMouseState(ByVal e As State)
  303. MouseState = e
  304. Invalidate()
  305. End Sub
  306.  
  307. #End Region
  308.  
  309. #Region " Convienence "
  310.  
  311. MustOverride Sub PaintHook()
  312. Protected NotOverridable Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  313. If Width = 0 OrElse Height = 0 Then Return
  314. PaintHook()
  315. e.Graphics.DrawImage(B, 0, 0)
  316. End Sub
  317.  
  318. Protected Overrides Sub OnSizeChanged(ByVal e As EventArgs)
  319. If Not Width = 0 AndAlso Not Height = 0 Then
  320. B = New Bitmap(Width, Height)
  321. G = Graphics.FromImage(B)
  322. Invalidate()
  323. End If
  324. MyBase.OnSizeChanged(e)
  325. End Sub
  326.  
  327. Private _NoRounding As Boolean
  328. Property NoRounding() As Boolean
  329. Get
  330. Return _NoRounding
  331. End Get
  332. Set(ByVal v As Boolean)
  333. _NoRounding = v
  334. Invalidate()
  335. End Set
  336. End Property
  337.  
  338. Private _Image As Image
  339. Property Image() As Image
  340. Get
  341. Return _Image
  342. End Get
  343. Set(ByVal value As Image)
  344. _Image = value
  345. Invalidate()
  346. End Set
  347. End Property
  348. ReadOnly Property ImageWidth() As Integer
  349. Get
  350. If _Image Is Nothing Then Return 0
  351. Return _Image.Width
  352. End Get
  353. End Property
  354. ReadOnly Property ImageTop() As Integer
  355. Get
  356. If _Image Is Nothing Then Return 0
  357. Return Height \ 2 - _Image.Height \ 2
  358. End Get
  359. End Property
  360.  
  361. Private _Size As Size
  362. Private _Rectangle As Rectangle
  363. Private _Gradient As LinearGradientBrush
  364. Private _Brush As SolidBrush
  365.  
  366. Protected Sub DrawCorners(ByVal c As Color, ByVal rect As Rectangle)
  367. If _NoRounding Then Return
  368.  
  369. B.SetPixel(rect.X, rect.Y, c)
  370. B.SetPixel(rect.X + (rect.Width - 1), rect.Y, c)
  371. B.SetPixel(rect.X, rect.Y + (rect.Height - 1), c)
  372. B.SetPixel(rect.X + (rect.Width - 1), rect.Y + (rect.Height - 1), c)
  373. End Sub
  374.  
  375. Protected Sub DrawBorders(ByVal p1 As Pen, ByVal p2 As Pen, ByVal rect As Rectangle)
  376. G.DrawRectangle(p1, rect.X, rect.Y, rect.Width - 1, rect.Height - 1)
  377. G.DrawRectangle(p2, rect.X + 1, rect.Y + 1, rect.Width - 3, rect.Height - 3)
  378. End Sub
  379.  
  380. Protected Sub DrawText(ByVal a As HorizontalAlignment, ByVal c As Color, ByVal x As Integer)
  381. DrawText(a, c, x, 0)
  382. End Sub
  383. Protected Sub DrawText(ByVal a As HorizontalAlignment, ByVal c As Color, ByVal x As Integer, ByVal y As Integer)
  384. If String.IsNullOrEmpty(Text) Then Return
  385. _Size = G.MeasureString(Text, Font).ToSize
  386. _Brush = New SolidBrush(c)
  387.  
  388. Select Case a
  389. Case HorizontalAlignment.Left
  390. G.DrawString(Text, Font, _Brush, x, Height \ 2 - _Size.Height \ 2 + y)
  391. Case HorizontalAlignment.Right
  392. G.DrawString(Text, Font, _Brush, Width - _Size.Width - x, Height \ 2 - _Size.Height \ 2 + y)
  393. Case HorizontalAlignment.Center
  394. G.DrawString(Text, Font, _Brush, Width \ 2 - _Size.Width \ 2 + x, Height \ 2 - _Size.Height \ 2 + y)
  395. End Select
  396. End Sub
  397.  
  398. Protected Sub DrawIcon(ByVal a As HorizontalAlignment, ByVal x As Integer)
  399. DrawIcon(a, x, 0)
  400. End Sub
  401. Protected Sub DrawIcon(ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
  402. If _Image Is Nothing Then Return
  403. Select Case a
  404. Case HorizontalAlignment.Left
  405. G.DrawImage(_Image, x, Height \ 2 - _Image.Height \ 2 + y)
  406. Case HorizontalAlignment.Right
  407. G.DrawImage(_Image, Width - _Image.Width - x, Height \ 2 - _Image.Height \ 2 + y)
  408. Case HorizontalAlignment.Center
  409. G.DrawImage(_Image, Width \ 2 - _Image.Width \ 2, Height \ 2 - _Image.Height \ 2)
  410. End Select
  411. End Sub
  412.  
  413. Protected Sub DrawGradient(ByVal c1 As Color, ByVal c2 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal angle As Single)
  414. _Rectangle = New Rectangle(x, y, width, height)
  415. _Gradient = New LinearGradientBrush(_Rectangle, c1, c2, angle)
  416. G.FillRectangle(_Gradient, _Rectangle)
  417. End Sub
  418. #End Region
  419.  
  420. End Class
  421. MustInherit Class ThemeContainerControl
  422. Inherits ContainerControl
  423.  
  424. #Region " Initialization "
  425.  
  426. Protected G As Graphics, B As Bitmap
  427. Sub New()
  428. SetStyle(DirectCast(139270, ControlStyles), True)
  429. B = New Bitmap(1, 1)
  430. G = Graphics.FromImage(B)
  431. End Sub
  432.  
  433. Sub AllowTransparent()
  434. SetStyle(ControlStyles.Opaque, False)
  435. SetStyle(ControlStyles.SupportsTransparentBackColor, True)
  436. End Sub
  437.  
  438. #End Region
  439.  
  440. #Region " Convienence "
  441.  
  442. MustOverride Sub PaintHook()
  443. Protected NotOverridable Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  444. If Width = 0 OrElse Height = 0 Then Return
  445. PaintHook()
  446. e.Graphics.DrawImage(B, 0, 0)
  447. End Sub
  448.  
  449. Protected Overrides Sub OnSizeChanged(ByVal e As EventArgs)
  450. If Not Width = 0 AndAlso Not Height = 0 Then
  451. B = New Bitmap(Width, Height)
  452. G = Graphics.FromImage(B)
  453. Invalidate()
  454. End If
  455. MyBase.OnSizeChanged(e)
  456. End Sub
  457.  
  458. Private _NoRounding As Boolean
  459. Property NoRounding() As Boolean
  460. Get
  461. Return _NoRounding
  462. End Get
  463. Set(ByVal v As Boolean)
  464. _NoRounding = v
  465. Invalidate()
  466. End Set
  467. End Property
  468.  
  469. Private _Rectangle As Rectangle
  470. Private _Gradient As LinearGradientBrush
  471.  
  472. Protected Sub DrawCorners(ByVal c As Color, ByVal rect As Rectangle)
  473. If _NoRounding Then Return
  474. B.SetPixel(rect.X, rect.Y, c)
  475. B.SetPixel(rect.X + (rect.Width - 1), rect.Y, c)
  476. B.SetPixel(rect.X, rect.Y + (rect.Height - 1), c)
  477. B.SetPixel(rect.X + (rect.Width - 1), rect.Y + (rect.Height - 1), c)
  478. End Sub
  479.  
  480. Protected Sub DrawBorders(ByVal p1 As Pen, ByVal p2 As Pen, ByVal rect As Rectangle)
  481. G.DrawRectangle(p1, rect.X, rect.Y, rect.Width - 1, rect.Height - 1)
  482. G.DrawRectangle(p2, rect.X + 1, rect.Y + 1, rect.Width - 3, rect.Height - 3)
  483. End Sub
  484.  
  485. Protected Sub DrawGradient(ByVal c1 As Color, ByVal c2 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal angle As Single)
  486. _Rectangle = New Rectangle(x, y, width, height)
  487. _Gradient = New LinearGradientBrush(_Rectangle, c1, c2, angle)
  488. G.FillRectangle(_Gradient, _Rectangle)
  489. End Sub
  490. #End Region
  491.  
  492. End Class
  493.  
  494. Class AdobeTheme
  495. Inherits Theme
  496. Enum TextAlign As Integer
  497. Left = 0
  498. Center = 1
  499. Right = 2
  500. End Enum
  501.  
  502. Private TA As TextAlign
  503. Public Property TextAlignment() As TextAlign
  504. Get
  505. Return TA
  506. End Get
  507. Set(ByVal value As TextAlign)
  508. TA = value
  509. Invalidate()
  510. End Set
  511. End Property
  512.  
  513.  
  514. Sub New()
  515. MoveHeight = 19
  516. TransparencyKey = Color.Fuchsia
  517. Me.Resizable = False
  518. BackColor = Color.FromArgb(51, 51, 51)
  519. Me.Font = New Font("Microsoft Sans Serif", 9, FontStyle.Bold)
  520. Me.TextAlignment = Left
  521. End Sub
  522.  
  523. Public Overrides Sub PaintHook()
  524. G.Clear(Color.FromArgb(68, 68, 68))
  525. DrawGradient(Color.FromArgb(51, 51, 51), Color.FromArgb(51, 51, 51), 0, 0, Width, 37, 45S)
  526. G.DrawLine(New Pen(New SolidBrush(Color.FromArgb(31, 31, 31))), 0, 37, Width, 37)
  527. G.DrawLine(New Pen(New SolidBrush(Color.FromArgb(60, 60, 60))), 0, 38, Width, 38)
  528. G.FillRectangle(New SolidBrush(Color.FromArgb(68, 68, 68)), 1, 39, Width - 2, Height - 39 - 2)
  529. Select Case TA
  530. Case 0
  531. DrawText(HorizontalAlignment.Left, Color.FromArgb(120, Color.Black), 12, 18, New Font("Microsoft Sans Serif", 10, FontStyle.Bold))
  532. DrawText(HorizontalAlignment.Left, Color.White, 10, 16, New Font("Microsoft Sans Serif", 10, FontStyle.Bold))
  533. Case 1
  534. DrawText(HorizontalAlignment.Center, Color.FromArgb(120, Color.Black), -1, 18, New Font("Microsoft Sans Serif", 10, FontStyle.Bold))
  535. DrawText(HorizontalAlignment.Center, Color.White, 1, 16, New Font("Microsoft Sans Serif", 10, FontStyle.Bold))
  536. Case 2
  537. DrawText(HorizontalAlignment.Right, Color.FromArgb(120, Color.Black), -1 + CInt(G.MeasureString(Text, Font).Width / 6), 18, New Font("Microsoft Sans Serif", 10, FontStyle.Bold))
  538. DrawText(HorizontalAlignment.Right, Color.White, 1 + CInt(G.MeasureString(Text, Font).Width / 6), 16, New Font("Microsoft Sans Serif", 10, FontStyle.Bold))
  539. End Select
  540.  
  541. G.FillRectangle(New SolidBrush(Color.FromArgb(51, 51, 51)), 1, Height - 37, Width - 2, Height - 2)
  542. G.DrawLine(New Pen(New SolidBrush(Color.FromArgb(31, 31, 31))), 0, Height - 37, Width, Height - 37)
  543. G.DrawLine(New Pen(New SolidBrush(Color.FromArgb(60, 60, 60))), 0, Height - 38, Width, Height - 38)
  544.  
  545. DrawBorders(Pens.Black, Pens.Gray, ClientRectangle)
  546. DrawCorners(Color.Fuchsia, ClientRectangle)
  547. End Sub
  548. End Class
  549.  
  550. Class AdobeButton
  551. Inherits ThemeControl
  552.  
  553. #Region " Properties "
  554.  
  555. Private _Orange As Boolean
  556. Public Property Orange() As Boolean
  557. Get
  558. Return _Orange
  559. End Get
  560. Set(ByVal value As Boolean)
  561. _Orange = value
  562. Invalidate()
  563. End Set
  564. End Property
  565.  
  566. #End Region
  567.  
  568. Sub New()
  569. BackColor = Color.FromArgb(51, 51, 51)
  570. End Sub
  571.  
  572. Overrides Sub PaintHook()
  573. G.Clear(Color.FromArgb(102, 102, 102))
  574. Dim gC As Integer = 15
  575. Dim _text As Color = Color.White
  576. Dim C1, C2, C3, C4 As Color
  577.  
  578. Select Case _Orange
  579. Case True
  580. C1 = Color.FromArgb(255, 209, 51)
  581. C2 = Color.FromArgb(255, 165, 13)
  582. C3 = Color.FromArgb(255, 195, 13)
  583. C4 = Color.FromArgb(255, 163, 0)
  584. _text = Color.White
  585. Case False
  586. C1 = Color.FromArgb(105, 105, 105)
  587. C2 = Color.FromArgb(56, 56, 56)
  588. C3 = Color.FromArgb(73, 73, 73)
  589. C4 = Color.FromArgb(48, 48, 48)
  590. End Select
  591.  
  592. DrawGradient(C1, C2, 0, 0, Width, Height, 90S)
  593. DrawGradient(C3, C4, 1, 1, Width - 2, Height - 2, 90S)
  594.  
  595. Select Case MouseState
  596. Case State.MouseNone
  597. 'NULL
  598. Case State.MouseOver
  599. Select Case _Orange
  600. Case True
  601. _text = Color.Black
  602. End Select
  603. gC = 10
  604. Case State.MouseDown
  605. Select Case _Orange
  606. Case True
  607. _text = Color.White
  608. End Select
  609. gC = 5
  610. End Select
  611.  
  612. For i = 1 To 5
  613. G.DrawRectangle(New Pen(New SolidBrush(Color.FromArgb(Int(255 / ((i * gC))), Color.Black))), New Rectangle(i, i, Width - 1 - (i * 2), Height - 1 - (i * 2)))
  614. Next
  615.  
  616. DrawBorders(Pens.Black, Pens.Transparent, ClientRectangle)
  617. DrawText(HorizontalAlignment.Center, _text, -2, 0)
  618. End Sub
  619. End Class
  620.  
  621. Class AdobeCheck
  622. Inherits ThemeControl
  623.  
  624. #Region " Properties "
  625. Private _CheckedState As Boolean
  626. Public Property CheckedState() As Boolean
  627. Get
  628. Return _CheckedState
  629. End Get
  630. Set(ByVal v As Boolean)
  631. _CheckedState = v
  632. Invalidate()
  633. End Set
  634. End Property
  635. #End Region
  636.  
  637. Sub New()
  638. 'Default properties
  639. Size = New Size(90, 15)
  640. MinimumSize = New Size(16, 16)
  641. MaximumSize = New Size(600, 16)
  642. CheckedState = False
  643. End Sub
  644.  
  645. Public Overrides Sub PaintHook()
  646. G.Clear(Color.FromArgb(68, 68, 68))
  647.  
  648. Select Case CheckedState
  649. Case True
  650. 'Fill with blue
  651. DrawGradient(Color.FromArgb(62, 62, 62), Color.FromArgb(38, 38, 38), 0, 0, 15, 15, 90S)
  652. DrawGradient(Color.FromArgb(132, 192, 240), Color.FromArgb(78, 123, 168), 3, 3, 9, 9, 90S)
  653. DrawGradient(Color.FromArgb(98, 159, 220), Color.FromArgb(62, 102, 147), 4, 4, 7, 7, 90S)
  654. Case False
  655. 'Fill with gray
  656. DrawGradient(Color.FromArgb(80, 80, 80), Color.FromArgb(60, 60, 60), 0, 0, 15, 15, 90S)
  657. End Select
  658.  
  659. 'Draw Box (After Fill so no overflow)
  660. DrawBorders(Pens.Black, Pens.DimGray, New Rectangle(0, 0, 15, 15))
  661.  
  662. 'Draw Shadow
  663. DrawText(HorizontalAlignment.Left, Color.Black, 18, 1)
  664.  
  665. 'Draw Text
  666. DrawText(HorizontalAlignment.Left, Color.White, 17, 0)
  667. End Sub
  668.  
  669. Sub changeCheck() Handles Me.Click
  670. Select Case CheckedState
  671. Case True
  672. CheckedState = False
  673. Case False
  674. CheckedState = True
  675. End Select
  676. End Sub
  677. End Class
  678.  
  679. Class AdobeProgressBar
  680. Inherits ThemeControl
  681. Private _Maximum As Integer
  682. Public Property Maximum() As Integer
  683. Get
  684. Return _Maximum
  685. End Get
  686. Set(ByVal v As Integer)
  687. Select Case v
  688. Case Is < _Value
  689. _Value = v
  690. End Select
  691. _Maximum = v
  692. Invalidate()
  693. End Set
  694. End Property
  695. Private _Value As Integer
  696. Public Property Value() As Integer
  697. Get
  698. Return _Value
  699. End Get
  700. Set(ByVal v As Integer)
  701. Select Case v
  702. Case Is > _Maximum
  703. v = _Maximum
  704. End Select
  705. _Value = v
  706. Invalidate()
  707. End Set
  708. End Property
  709. Overrides Sub PaintHook()
  710. G.Clear(Color.FromArgb(51, 51, 51))
  711. 'Fill
  712. Select Case _Value
  713. Case Is > 6
  714. DrawGradient(Color.FromArgb(132, 192, 240), Color.FromArgb(78, 123, 168), 3, 3, CInt(_Value / _Maximum * Width) - 6, Height - 6, 90S)
  715. DrawGradient(Color.FromArgb(98, 159, 220), Color.FromArgb(62, 102, 147), 4, 4, CInt(_Value / _Maximum * Width) - 8, Height - 8, 90S)
  716. Case Is > 1
  717. DrawGradient(Color.FromArgb(132, 192, 240), Color.FromArgb(78, 123, 168), 3, 3, CInt(_Value / _Maximum * Width), Height - 6, 90S)
  718. DrawGradient(Color.FromArgb(98, 159, 220), Color.FromArgb(62, 102, 147), 4, 4, CInt(_Value / _Maximum * Width) - 2, Height - 8, 90S)
  719. End Select
  720.  
  721. 'Borders
  722. G.DrawRectangle(Pens.Black, 0, 0, Width - 1, Height - 1)
  723. G.DrawRectangle(Pens.Gray, 1, 1, Width - 3, Height - 3)
  724. End Sub
  725. Public Sub Increment(ByVal Amount As Integer)
  726. If Me.Value + Amount > Maximum Then
  727. Me.Value = Maximum
  728. Else
  729. Me.Value += Amount
  730. End If
  731. End Sub
  732. End Class
Add Comment
Please, Sign In to add comment