Guest User

Untitled

a guest
Jul 11th, 2012
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 100.67 KB | None | 0 0
  1. Imports System.IO
  2. Imports System.Drawing.Imaging
  3. Imports System.Drawing.Drawing2D
  4. Imports System.ComponentModel
  5. Imports System.Runtime.InteropServices
  6.  
  7. #Region "Themebase"
  8. '------------------
  9. 'Creator: aeonhack
  10. 'Site: elitevs.net
  11. 'Created: 08/02/2011
  12. 'Changed: 12/06/2011
  13. 'Version: 1.5.4
  14. '------------------
  15.  
  16. MustInherit Class ThemeContainer154
  17. Inherits ContainerControl
  18.  
  19. #Region " Initialization "
  20.  
  21. Protected G As Graphics, B As Bitmap
  22.  
  23. Sub New()
  24. SetStyle(DirectCast(139270, ControlStyles), True)
  25.  
  26. _ImageSize = Size.Empty
  27. Font = New Font("Verdana", 10S, FontStyle.Bold)
  28.  
  29. MeasureBitmap = New Bitmap(1, 1)
  30. MeasureGraphics = Graphics.FromImage(MeasureBitmap)
  31.  
  32. DrawRadialPath = New GraphicsPath
  33.  
  34. InvalidateCustimization()
  35. End Sub
  36.  
  37. Protected NotOverridable Overrides Sub OnHandleCreated(ByVal e As EventArgs)
  38. If DoneCreation Then InitializeMessages()
  39.  
  40. InvalidateCustimization()
  41. ColorHook()
  42.  
  43. If Not _LockWidth = 0 Then Width = _LockWidth
  44. If Not _LockHeight = 0 Then Height = _LockHeight
  45. If Not _ControlMode Then MyBase.Dock = DockStyle.Fill
  46.  
  47. Transparent = _Transparent
  48. If _Transparent AndAlso _BackColor Then BackColor = Color.Transparent
  49.  
  50. MyBase.OnHandleCreated(e)
  51. End Sub
  52.  
  53. Private DoneCreation As Boolean
  54. Protected NotOverridable Overrides Sub OnParentChanged(ByVal e As EventArgs)
  55. MyBase.OnParentChanged(e)
  56.  
  57. If Parent Is Nothing Then Return
  58. _IsParentForm = TypeOf Parent Is Form
  59.  
  60. If Not _ControlMode Then
  61. InitializeMessages()
  62.  
  63. If _IsParentForm Then
  64. ParentForm.FormBorderStyle = _BorderStyle
  65. ParentForm.TransparencyKey = _TransparencyKey
  66.  
  67. If Not DesignMode Then
  68. AddHandler ParentForm.Shown, AddressOf FormShown
  69. End If
  70. End If
  71.  
  72. Parent.BackColor = BackColor
  73. End If
  74.  
  75. OnCreation()
  76. DoneCreation = True
  77. InvalidateTimer()
  78. End Sub
  79.  
  80. #End Region
  81.  
  82. Private Sub DoAnimation(ByVal i As Boolean)
  83. OnAnimation()
  84. If i Then Invalidate()
  85. End Sub
  86.  
  87. Protected NotOverridable Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  88. If Width = 0 OrElse Height = 0 Then Return
  89.  
  90. If _Transparent AndAlso _ControlMode Then
  91. PaintHook()
  92. e.Graphics.DrawImage(B, 0, 0)
  93. Else
  94. G = e.Graphics
  95. PaintHook()
  96. End If
  97. End Sub
  98.  
  99. Protected Overrides Sub OnHandleDestroyed(ByVal e As EventArgs)
  100. RemoveAnimationCallback(AddressOf DoAnimation)
  101. MyBase.OnHandleDestroyed(e)
  102. End Sub
  103.  
  104. Private HasShown As Boolean
  105. Private Sub FormShown(ByVal sender As Object, ByVal e As EventArgs)
  106. If _ControlMode OrElse HasShown Then Return
  107.  
  108. If _StartPosition = FormStartPosition.CenterParent OrElse _StartPosition = FormStartPosition.CenterScreen Then
  109. Dim SB As Rectangle = Screen.PrimaryScreen.Bounds
  110. Dim CB As Rectangle = ParentForm.Bounds
  111. ParentForm.Location = New Point(SB.Width \ 2 - CB.Width \ 2, SB.Height \ 2 - CB.Width \ 2)
  112. End If
  113.  
  114. HasShown = True
  115. End Sub
  116.  
  117.  
  118. #Region " Size Handling "
  119.  
  120. Private Frame As Rectangle
  121. Protected NotOverridable Overrides Sub OnSizeChanged(ByVal e As EventArgs)
  122. If _Movable AndAlso Not _ControlMode Then
  123. Frame = New Rectangle(7, 7, Width - 14, _Header - 7)
  124. End If
  125.  
  126. InvalidateBitmap()
  127. Invalidate()
  128.  
  129. MyBase.OnSizeChanged(e)
  130. End Sub
  131.  
  132. Protected Overrides Sub SetBoundsCore(ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal specified As BoundsSpecified)
  133. If Not _LockWidth = 0 Then width = _LockWidth
  134. If Not _LockHeight = 0 Then height = _LockHeight
  135. MyBase.SetBoundsCore(x, y, width, height, specified)
  136. End Sub
  137.  
  138. #End Region
  139.  
  140. #Region " State Handling "
  141.  
  142. Protected State As MouseState
  143. Private Sub SetState(ByVal current As MouseState)
  144. State = current
  145. Invalidate()
  146. End Sub
  147.  
  148. Protected Overrides Sub OnMouseMove(ByVal e As MouseEventArgs)
  149. If Not (_IsParentForm AndAlso ParentForm.WindowState = FormWindowState.Maximized) Then
  150. If _Sizable AndAlso Not _ControlMode Then InvalidateMouse()
  151. End If
  152.  
  153. MyBase.OnMouseMove(e)
  154. End Sub
  155.  
  156. Protected Overrides Sub OnEnabledChanged(ByVal e As EventArgs)
  157. If Enabled Then SetState(MouseState.None) Else SetState(MouseState.Block)
  158. MyBase.OnEnabledChanged(e)
  159. End Sub
  160.  
  161. Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
  162. SetState(MouseState.Over)
  163. MyBase.OnMouseEnter(e)
  164. End Sub
  165.  
  166. Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  167. SetState(MouseState.Over)
  168. MyBase.OnMouseUp(e)
  169. End Sub
  170.  
  171. Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
  172. SetState(MouseState.None)
  173.  
  174. If GetChildAtPoint(PointToClient(MousePosition)) IsNot Nothing Then
  175. If _Sizable AndAlso Not _ControlMode Then
  176. Cursor = Cursors.Default
  177. Previous = 0
  178. End If
  179. End If
  180.  
  181. MyBase.OnMouseLeave(e)
  182. End Sub
  183.  
  184. Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  185. If e.Button = Windows.Forms.MouseButtons.Left Then SetState(MouseState.Down)
  186.  
  187. If Not (_IsParentForm AndAlso ParentForm.WindowState = FormWindowState.Maximized OrElse _ControlMode) Then
  188. If _Movable AndAlso Frame.Contains(e.Location) Then
  189. Capture = False
  190. WM_LMBUTTONDOWN = True
  191. DefWndProc(Messages(0))
  192. ElseIf _Sizable AndAlso Not Previous = 0 Then
  193. Capture = False
  194. WM_LMBUTTONDOWN = True
  195. DefWndProc(Messages(Previous))
  196. End If
  197. End If
  198.  
  199. MyBase.OnMouseDown(e)
  200. End Sub
  201.  
  202. Private WM_LMBUTTONDOWN As Boolean
  203. Protected Overrides Sub WndProc(ByRef m As Message)
  204. MyBase.WndProc(m)
  205.  
  206. If WM_LMBUTTONDOWN AndAlso m.Msg = 513 Then
  207. WM_LMBUTTONDOWN = False
  208.  
  209. SetState(MouseState.Over)
  210. If Not _SmartBounds Then Return
  211.  
  212. If IsParentMdi Then
  213. CorrectBounds(New Rectangle(Point.Empty, Parent.Parent.Size))
  214. Else
  215. CorrectBounds(Screen.FromControl(Parent).WorkingArea)
  216. End If
  217. End If
  218. End Sub
  219.  
  220. Private GetIndexPoint As Point
  221. Private B1, B2, B3, B4 As Boolean
  222. Private Function GetIndex() As Integer
  223. GetIndexPoint = PointToClient(MousePosition)
  224. B1 = GetIndexPoint.X < 7
  225. B2 = GetIndexPoint.X > Width - 7
  226. B3 = GetIndexPoint.Y < 7
  227. B4 = GetIndexPoint.Y > Height - 7
  228.  
  229. If B1 AndAlso B3 Then Return 4
  230. If B1 AndAlso B4 Then Return 7
  231. If B2 AndAlso B3 Then Return 5
  232. If B2 AndAlso B4 Then Return 8
  233. If B1 Then Return 1
  234. If B2 Then Return 2
  235. If B3 Then Return 3
  236. If B4 Then Return 6
  237. Return 0
  238. End Function
  239.  
  240. Private Current, Previous As Integer
  241. Private Sub InvalidateMouse()
  242. Current = GetIndex()
  243. If Current = Previous Then Return
  244.  
  245. Previous = Current
  246. Select Case Previous
  247. Case 0
  248. Cursor = Cursors.Default
  249. Case 1, 2
  250. Cursor = Cursors.SizeWE
  251. Case 3, 6
  252. Cursor = Cursors.SizeNS
  253. Case 4, 8
  254. Cursor = Cursors.SizeNWSE
  255. Case 5, 7
  256. Cursor = Cursors.SizeNESW
  257. End Select
  258. End Sub
  259.  
  260. Private Messages(8) As Message
  261. Private Sub InitializeMessages()
  262. Messages(0) = Message.Create(Parent.Handle, 161, New IntPtr(2), IntPtr.Zero)
  263. For I As Integer = 1 To 8
  264. Messages(I) = Message.Create(Parent.Handle, 161, New IntPtr(I + 9), IntPtr.Zero)
  265. Next
  266. End Sub
  267.  
  268. Private Sub CorrectBounds(ByVal bounds As Rectangle)
  269. If Parent.Width > bounds.Width Then Parent.Width = bounds.Width
  270. If Parent.Height > bounds.Height Then Parent.Height = bounds.Height
  271.  
  272. Dim X As Integer = Parent.Location.X
  273. Dim Y As Integer = Parent.Location.Y
  274.  
  275. If X < bounds.X Then X = bounds.X
  276. If Y < bounds.Y Then Y = bounds.Y
  277.  
  278. Dim Width As Integer = bounds.X + bounds.Width
  279. Dim Height As Integer = bounds.Y + bounds.Height
  280.  
  281. If X + Parent.Width > Width Then X = Width - Parent.Width
  282. If Y + Parent.Height > Height Then Y = Height - Parent.Height
  283.  
  284. Parent.Location = New Point(X, Y)
  285. End Sub
  286.  
  287. #End Region
  288.  
  289.  
  290. #Region " Base Properties "
  291.  
  292. Overrides Property Dock As DockStyle
  293. Get
  294. Return MyBase.Dock
  295. End Get
  296. Set(ByVal value As DockStyle)
  297. If Not _ControlMode Then Return
  298. MyBase.Dock = value
  299. End Set
  300. End Property
  301.  
  302. Private _BackColor As Boolean
  303. <Category("Misc")> _
  304. Overrides Property BackColor() As Color
  305. Get
  306. Return MyBase.BackColor
  307. End Get
  308. Set(ByVal value As Color)
  309. If value = MyBase.BackColor Then Return
  310.  
  311. If Not IsHandleCreated AndAlso _ControlMode AndAlso value = Color.Transparent Then
  312. _BackColor = True
  313. Return
  314. End If
  315.  
  316. MyBase.BackColor = value
  317. If Parent IsNot Nothing Then
  318. If Not _ControlMode Then Parent.BackColor = value
  319. ColorHook()
  320. End If
  321. End Set
  322. End Property
  323.  
  324. Overrides Property MinimumSize As Size
  325. Get
  326. Return MyBase.MinimumSize
  327. End Get
  328. Set(ByVal value As Size)
  329. MyBase.MinimumSize = value
  330. If Parent IsNot Nothing Then Parent.MinimumSize = value
  331. End Set
  332. End Property
  333.  
  334. Overrides Property MaximumSize As Size
  335. Get
  336. Return MyBase.MaximumSize
  337. End Get
  338. Set(ByVal value As Size)
  339. MyBase.MaximumSize = value
  340. If Parent IsNot Nothing Then Parent.MaximumSize = value
  341. End Set
  342. End Property
  343.  
  344. Overrides Property Text() As String
  345. Get
  346. Return MyBase.Text
  347. End Get
  348. Set(ByVal value As String)
  349. MyBase.Text = value
  350. Invalidate()
  351. End Set
  352. End Property
  353.  
  354. Overrides Property Font() As Font
  355. Get
  356. Return MyBase.Font
  357. End Get
  358. Set(ByVal value As Font)
  359. MyBase.Font = value
  360. Invalidate()
  361. End Set
  362. End Property
  363.  
  364. <Browsable(False), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
  365. Overrides Property ForeColor() As Color
  366. Get
  367. Return Color.Empty
  368. End Get
  369. Set(ByVal value As Color)
  370. End Set
  371. End Property
  372. <Browsable(False), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
  373. Overrides Property BackgroundImage() As Image
  374. Get
  375. Return Nothing
  376. End Get
  377. Set(ByVal value As Image)
  378. End Set
  379. End Property
  380. <Browsable(False), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
  381. Overrides Property BackgroundImageLayout() As ImageLayout
  382. Get
  383. Return ImageLayout.None
  384. End Get
  385. Set(ByVal value As ImageLayout)
  386. End Set
  387. End Property
  388.  
  389. #End Region
  390.  
  391. #Region " Public Properties "
  392.  
  393. Private _SmartBounds As Boolean = True
  394. Property SmartBounds() As Boolean
  395. Get
  396. Return _SmartBounds
  397. End Get
  398. Set(ByVal value As Boolean)
  399. _SmartBounds = value
  400. End Set
  401. End Property
  402.  
  403. Private _Movable As Boolean = True
  404. Property Movable() As Boolean
  405. Get
  406. Return _Movable
  407. End Get
  408. Set(ByVal value As Boolean)
  409. _Movable = value
  410. End Set
  411. End Property
  412.  
  413. Private _Sizable As Boolean = True
  414. Property Sizable() As Boolean
  415. Get
  416. Return _Sizable
  417. End Get
  418. Set(ByVal value As Boolean)
  419. _Sizable = value
  420. End Set
  421. End Property
  422.  
  423. Private _TransparencyKey As Color
  424. Property TransparencyKey() As Color
  425. Get
  426. If _IsParentForm AndAlso Not _ControlMode Then Return ParentForm.TransparencyKey Else Return _TransparencyKey
  427. End Get
  428. Set(ByVal value As Color)
  429. If value = _TransparencyKey Then Return
  430. _TransparencyKey = value
  431.  
  432. If _IsParentForm AndAlso Not _ControlMode Then
  433. ParentForm.TransparencyKey = value
  434. ColorHook()
  435. End If
  436. End Set
  437. End Property
  438.  
  439. Private _BorderStyle As FormBorderStyle
  440. Property BorderStyle() As FormBorderStyle
  441. Get
  442. If _IsParentForm AndAlso Not _ControlMode Then Return ParentForm.FormBorderStyle Else Return _BorderStyle
  443. End Get
  444. Set(ByVal value As FormBorderStyle)
  445. _BorderStyle = value
  446.  
  447. If _IsParentForm AndAlso Not _ControlMode Then
  448. ParentForm.FormBorderStyle = value
  449.  
  450. If Not value = FormBorderStyle.None Then
  451. Movable = False
  452. Sizable = False
  453. End If
  454. End If
  455. End Set
  456. End Property
  457.  
  458. Private _StartPosition As FormStartPosition
  459. Property StartPosition As FormStartPosition
  460. Get
  461. If _IsParentForm AndAlso Not _ControlMode Then Return ParentForm.StartPosition Else Return _StartPosition
  462. End Get
  463. Set(ByVal value As FormStartPosition)
  464. _StartPosition = value
  465.  
  466. If _IsParentForm AndAlso Not _ControlMode Then
  467. ParentForm.StartPosition = value
  468. End If
  469. End Set
  470. End Property
  471.  
  472. Private _NoRounding As Boolean
  473. Property NoRounding() As Boolean
  474. Get
  475. Return _NoRounding
  476. End Get
  477. Set(ByVal v As Boolean)
  478. _NoRounding = v
  479. Invalidate()
  480. End Set
  481. End Property
  482.  
  483. Private _Image As Image
  484. Property Image() As Image
  485. Get
  486. Return _Image
  487. End Get
  488. Set(ByVal value As Image)
  489. If value Is Nothing Then _ImageSize = Size.Empty Else _ImageSize = value.Size
  490.  
  491. _Image = value
  492. Invalidate()
  493. End Set
  494. End Property
  495.  
  496. Private Items As New Dictionary(Of String, Color)
  497. Property Colors() As Bloom()
  498. Get
  499. Dim T As New List(Of Bloom)
  500. Dim E As Dictionary(Of String, Color).Enumerator = Items.GetEnumerator
  501.  
  502. While E.MoveNext
  503. T.Add(New Bloom(E.Current.Key, E.Current.Value))
  504. End While
  505.  
  506. Return T.ToArray
  507. End Get
  508. Set(ByVal value As Bloom())
  509. For Each B As Bloom In value
  510. If Items.ContainsKey(B.Name) Then Items(B.Name) = B.Value
  511. Next
  512.  
  513. InvalidateCustimization()
  514. ColorHook()
  515. Invalidate()
  516. End Set
  517. End Property
  518.  
  519. Private _Customization As String
  520. Property Customization() As String
  521. Get
  522. Return _Customization
  523. End Get
  524. Set(ByVal value As String)
  525. If value = _Customization Then Return
  526.  
  527. Dim Data As Byte()
  528. Dim Items As Bloom() = Colors
  529.  
  530. Try
  531. Data = Convert.FromBase64String(value)
  532. For I As Integer = 0 To Items.Length - 1
  533. Items(I).Value = Color.FromArgb(BitConverter.ToInt32(Data, I * 4))
  534. Next
  535. Catch
  536. Return
  537. End Try
  538.  
  539. _Customization = value
  540.  
  541. Colors = Items
  542. ColorHook()
  543. Invalidate()
  544. End Set
  545. End Property
  546.  
  547. Private _Transparent As Boolean
  548. Property Transparent() As Boolean
  549. Get
  550. Return _Transparent
  551. End Get
  552. Set(ByVal value As Boolean)
  553. _Transparent = value
  554. If Not (IsHandleCreated OrElse _ControlMode) Then Return
  555.  
  556. If Not value AndAlso Not BackColor.A = 255 Then
  557. Throw New Exception("Unable to change value to false while a transparent BackColor is in use.")
  558. End If
  559.  
  560. SetStyle(ControlStyles.Opaque, Not value)
  561. SetStyle(ControlStyles.SupportsTransparentBackColor, value)
  562.  
  563. InvalidateBitmap()
  564. Invalidate()
  565. End Set
  566. End Property
  567.  
  568. #End Region
  569.  
  570. #Region " Private Properties "
  571.  
  572. Private _ImageSize As Size
  573. Protected ReadOnly Property ImageSize() As Size
  574. Get
  575. Return _ImageSize
  576. End Get
  577. End Property
  578.  
  579. Private _IsParentForm As Boolean
  580. Protected ReadOnly Property IsParentForm As Boolean
  581. Get
  582. Return _IsParentForm
  583. End Get
  584. End Property
  585.  
  586. Protected ReadOnly Property IsParentMdi As Boolean
  587. Get
  588. If Parent Is Nothing Then Return False
  589. Return Parent.Parent IsNot Nothing
  590. End Get
  591. End Property
  592.  
  593. Private _LockWidth As Integer
  594. Protected Property LockWidth() As Integer
  595. Get
  596. Return _LockWidth
  597. End Get
  598. Set(ByVal value As Integer)
  599. _LockWidth = value
  600. If Not LockWidth = 0 AndAlso IsHandleCreated Then Width = LockWidth
  601. End Set
  602. End Property
  603.  
  604. Private _LockHeight As Integer
  605. Protected Property LockHeight() As Integer
  606. Get
  607. Return _LockHeight
  608. End Get
  609. Set(ByVal value As Integer)
  610. _LockHeight = value
  611. If Not LockHeight = 0 AndAlso IsHandleCreated Then Height = LockHeight
  612. End Set
  613. End Property
  614.  
  615. Private _Header As Integer = 24
  616. Protected Property Header() As Integer
  617. Get
  618. Return _Header
  619. End Get
  620. Set(ByVal v As Integer)
  621. _Header = v
  622.  
  623. If Not _ControlMode Then
  624. Frame = New Rectangle(7, 7, Width - 14, v - 7)
  625. Invalidate()
  626. End If
  627. End Set
  628. End Property
  629.  
  630. Private _ControlMode As Boolean
  631. Protected Property ControlMode() As Boolean
  632. Get
  633. Return _ControlMode
  634. End Get
  635. Set(ByVal v As Boolean)
  636. _ControlMode = v
  637.  
  638. Transparent = _Transparent
  639. If _Transparent AndAlso _BackColor Then BackColor = Color.Transparent
  640.  
  641. InvalidateBitmap()
  642. Invalidate()
  643. End Set
  644. End Property
  645.  
  646. Private _IsAnimated As Boolean
  647. Protected Property IsAnimated() As Boolean
  648. Get
  649. Return _IsAnimated
  650. End Get
  651. Set(ByVal value As Boolean)
  652. _IsAnimated = value
  653. InvalidateTimer()
  654. End Set
  655. End Property
  656.  
  657. #End Region
  658.  
  659.  
  660. #Region " Property Helpers "
  661.  
  662. Protected Function GetPen(ByVal name As String) As Pen
  663. Return New Pen(Items(name))
  664. End Function
  665. Protected Function GetPen(ByVal name As String, ByVal width As Single) As Pen
  666. Return New Pen(Items(name), width)
  667. End Function
  668.  
  669. Protected Function GetBrush(ByVal name As String) As SolidBrush
  670. Return New SolidBrush(Items(name))
  671. End Function
  672.  
  673. Protected Function GetColor(ByVal name As String) As Color
  674. Return Items(name)
  675. End Function
  676.  
  677. Protected Sub SetColor(ByVal name As String, ByVal value As Color)
  678. If Items.ContainsKey(name) Then Items(name) = value Else Items.Add(name, value)
  679. End Sub
  680. Protected Sub SetColor(ByVal name As String, ByVal r As Byte, ByVal g As Byte, ByVal b As Byte)
  681. SetColor(name, Color.FromArgb(r, g, b))
  682. End Sub
  683. Protected Sub SetColor(ByVal name As String, ByVal a As Byte, ByVal r As Byte, ByVal g As Byte, ByVal b As Byte)
  684. SetColor(name, Color.FromArgb(a, r, g, b))
  685. End Sub
  686. Protected Sub SetColor(ByVal name As String, ByVal a As Byte, ByVal value As Color)
  687. SetColor(name, Color.FromArgb(a, value))
  688. End Sub
  689.  
  690. Private Sub InvalidateBitmap()
  691. If _Transparent AndAlso _ControlMode Then
  692. If Width = 0 OrElse Height = 0 Then Return
  693. B = New Bitmap(Width, Height, PixelFormat.Format32bppPArgb)
  694. G = Graphics.FromImage(B)
  695. Else
  696. G = Nothing
  697. B = Nothing
  698. End If
  699. End Sub
  700.  
  701. Private Sub InvalidateCustimization()
  702. Dim M As New MemoryStream(Items.Count * 4)
  703.  
  704. For Each B As Bloom In Colors
  705. M.Write(BitConverter.GetBytes(B.Value.ToArgb), 0, 4)
  706. Next
  707.  
  708. M.Close()
  709. _Customization = Convert.ToBase64String(M.ToArray)
  710. End Sub
  711.  
  712. Private Sub InvalidateTimer()
  713. If DesignMode OrElse Not DoneCreation Then Return
  714.  
  715. If _IsAnimated Then
  716. AddAnimationCallback(AddressOf DoAnimation)
  717. Else
  718. RemoveAnimationCallback(AddressOf DoAnimation)
  719. End If
  720. End Sub
  721.  
  722. #End Region
  723.  
  724.  
  725. #Region " User Hooks "
  726.  
  727. Protected MustOverride Sub ColorHook()
  728. Protected MustOverride Sub PaintHook()
  729.  
  730. Protected Overridable Sub OnCreation()
  731. End Sub
  732.  
  733. Protected Overridable Sub OnAnimation()
  734. End Sub
  735.  
  736. #End Region
  737.  
  738.  
  739. #Region " Offset "
  740.  
  741. Private OffsetReturnRectangle As Rectangle
  742. Protected Function Offset(ByVal r As Rectangle, ByVal amount As Integer) As Rectangle
  743. OffsetReturnRectangle = New Rectangle(r.X + amount, r.Y + amount, r.Width - (amount * 2), r.Height - (amount * 2))
  744. Return OffsetReturnRectangle
  745. End Function
  746.  
  747. Private OffsetReturnSize As Size
  748. Protected Function Offset(ByVal s As Size, ByVal amount As Integer) As Size
  749. OffsetReturnSize = New Size(s.Width + amount, s.Height + amount)
  750. Return OffsetReturnSize
  751. End Function
  752.  
  753. Private OffsetReturnPoint As Point
  754. Protected Function Offset(ByVal p As Point, ByVal amount As Integer) As Point
  755. OffsetReturnPoint = New Point(p.X + amount, p.Y + amount)
  756. Return OffsetReturnPoint
  757. End Function
  758.  
  759. #End Region
  760.  
  761. #Region " Center "
  762.  
  763. Private CenterReturn As Point
  764.  
  765. Protected Function Center(ByVal p As Rectangle, ByVal c As Rectangle) As Point
  766. CenterReturn = New Point((p.Width \ 2 - c.Width \ 2) + p.X + c.X, (p.Height \ 2 - c.Height \ 2) + p.Y + c.Y)
  767. Return CenterReturn
  768. End Function
  769. Protected Function Center(ByVal p As Rectangle, ByVal c As Size) As Point
  770. CenterReturn = New Point((p.Width \ 2 - c.Width \ 2) + p.X, (p.Height \ 2 - c.Height \ 2) + p.Y)
  771. Return CenterReturn
  772. End Function
  773.  
  774. Protected Function Center(ByVal child As Rectangle) As Point
  775. Return Center(Width, Height, child.Width, child.Height)
  776. End Function
  777. Protected Function Center(ByVal child As Size) As Point
  778. Return Center(Width, Height, child.Width, child.Height)
  779. End Function
  780. Protected Function Center(ByVal childWidth As Integer, ByVal childHeight As Integer) As Point
  781. Return Center(Width, Height, childWidth, childHeight)
  782. End Function
  783.  
  784. Protected Function Center(ByVal p As Size, ByVal c As Size) As Point
  785. Return Center(p.Width, p.Height, c.Width, c.Height)
  786. End Function
  787.  
  788. Protected Function Center(ByVal pWidth As Integer, ByVal pHeight As Integer, ByVal cWidth As Integer, ByVal cHeight As Integer) As Point
  789. CenterReturn = New Point(pWidth \ 2 - cWidth \ 2, pHeight \ 2 - cHeight \ 2)
  790. Return CenterReturn
  791. End Function
  792.  
  793. #End Region
  794.  
  795. #Region " Measure "
  796.  
  797. Private MeasureBitmap As Bitmap
  798. Private MeasureGraphics As Graphics
  799.  
  800. Protected Function Measure() As Size
  801. SyncLock MeasureGraphics
  802. Return MeasureGraphics.MeasureString(Text, Font, Width).ToSize
  803. End SyncLock
  804. End Function
  805. Protected Function Measure(ByVal text As String) As Size
  806. SyncLock MeasureGraphics
  807. Return MeasureGraphics.MeasureString(text, Font, Width).ToSize
  808. End SyncLock
  809. End Function
  810.  
  811. #End Region
  812.  
  813.  
  814. #Region " DrawPixel "
  815.  
  816. Private DrawPixelBrush As SolidBrush
  817.  
  818. Protected Sub DrawPixel(ByVal c1 As Color, ByVal x As Integer, ByVal y As Integer)
  819. If _Transparent Then
  820. B.SetPixel(x, y, c1)
  821. Else
  822. DrawPixelBrush = New SolidBrush(c1)
  823. G.FillRectangle(DrawPixelBrush, x, y, 1, 1)
  824. End If
  825. End Sub
  826.  
  827. #End Region
  828.  
  829. #Region " DrawCorners "
  830.  
  831. Private DrawCornersBrush As SolidBrush
  832.  
  833. Protected Sub DrawCorners(ByVal c1 As Color, ByVal offset As Integer)
  834. DrawCorners(c1, 0, 0, Width, Height, offset)
  835. End Sub
  836. Protected Sub DrawCorners(ByVal c1 As Color, ByVal r1 As Rectangle, ByVal offset As Integer)
  837. DrawCorners(c1, r1.X, r1.Y, r1.Width, r1.Height, offset)
  838. End Sub
  839. Protected Sub DrawCorners(ByVal c1 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal offset As Integer)
  840. DrawCorners(c1, x + offset, y + offset, width - (offset * 2), height - (offset * 2))
  841. End Sub
  842.  
  843. Protected Sub DrawCorners(ByVal c1 As Color)
  844. DrawCorners(c1, 0, 0, Width, Height)
  845. End Sub
  846. Protected Sub DrawCorners(ByVal c1 As Color, ByVal r1 As Rectangle)
  847. DrawCorners(c1, r1.X, r1.Y, r1.Width, r1.Height)
  848. End Sub
  849. Protected Sub DrawCorners(ByVal c1 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
  850. If _NoRounding Then Return
  851.  
  852. If _Transparent Then
  853. B.SetPixel(x, y, c1)
  854. B.SetPixel(x + (width - 1), y, c1)
  855. B.SetPixel(x, y + (height - 1), c1)
  856. B.SetPixel(x + (width - 1), y + (height - 1), c1)
  857. Else
  858. DrawCornersBrush = New SolidBrush(c1)
  859. G.FillRectangle(DrawCornersBrush, x, y, 1, 1)
  860. G.FillRectangle(DrawCornersBrush, x + (width - 1), y, 1, 1)
  861. G.FillRectangle(DrawCornersBrush, x, y + (height - 1), 1, 1)
  862. G.FillRectangle(DrawCornersBrush, x + (width - 1), y + (height - 1), 1, 1)
  863. End If
  864. End Sub
  865.  
  866. #End Region
  867.  
  868. #Region " DrawBorders "
  869.  
  870. Protected Sub DrawBorders(ByVal p1 As Pen, ByVal offset As Integer)
  871. DrawBorders(p1, 0, 0, Width, Height, offset)
  872. End Sub
  873. Protected Sub DrawBorders(ByVal p1 As Pen, ByVal r As Rectangle, ByVal offset As Integer)
  874. DrawBorders(p1, r.X, r.Y, r.Width, r.Height, offset)
  875. End Sub
  876. Protected Sub DrawBorders(ByVal p1 As Pen, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal offset As Integer)
  877. DrawBorders(p1, x + offset, y + offset, width - (offset * 2), height - (offset * 2))
  878. End Sub
  879.  
  880. Protected Sub DrawBorders(ByVal p1 As Pen)
  881. DrawBorders(p1, 0, 0, Width, Height)
  882. End Sub
  883. Protected Sub DrawBorders(ByVal p1 As Pen, ByVal r As Rectangle)
  884. DrawBorders(p1, r.X, r.Y, r.Width, r.Height)
  885. End Sub
  886. Protected Sub DrawBorders(ByVal p1 As Pen, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
  887. G.DrawRectangle(p1, x, y, width - 1, height - 1)
  888. End Sub
  889.  
  890. #End Region
  891.  
  892. #Region " DrawText "
  893.  
  894. Private DrawTextPoint As Point
  895. Private DrawTextSize As Size
  896.  
  897. Protected Sub DrawText(ByVal b1 As Brush, ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
  898. DrawText(b1, Text, a, x, y)
  899. End Sub
  900. Protected Sub DrawText(ByVal b1 As Brush, ByVal text As String, ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
  901. If text.Length = 0 Then Return
  902.  
  903. DrawTextSize = Measure(text)
  904. DrawTextPoint = New Point(Width \ 2 - DrawTextSize.Width \ 2, Header \ 2 - DrawTextSize.Height \ 2)
  905.  
  906. Select Case a
  907. Case HorizontalAlignment.Left
  908. G.DrawString(text, Font, b1, x, DrawTextPoint.Y + y)
  909. Case HorizontalAlignment.Center
  910. G.DrawString(text, Font, b1, DrawTextPoint.X + x, DrawTextPoint.Y + y)
  911. Case HorizontalAlignment.Right
  912. G.DrawString(text, Font, b1, Width - DrawTextSize.Width - x, DrawTextPoint.Y + y)
  913. End Select
  914. End Sub
  915.  
  916. Protected Sub DrawText(ByVal b1 As Brush, ByVal p1 As Point)
  917. If Text.Length = 0 Then Return
  918. G.DrawString(Text, Font, b1, p1)
  919. End Sub
  920. Protected Sub DrawText(ByVal b1 As Brush, ByVal x As Integer, ByVal y As Integer)
  921. If Text.Length = 0 Then Return
  922. G.DrawString(Text, Font, b1, x, y)
  923. End Sub
  924.  
  925. #End Region
  926.  
  927. #Region " DrawImage "
  928.  
  929. Private DrawImagePoint As Point
  930.  
  931. Protected Sub DrawImage(ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
  932. DrawImage(_Image, a, x, y)
  933. End Sub
  934. Protected Sub DrawImage(ByVal image As Image, ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
  935. If image Is Nothing Then Return
  936. DrawImagePoint = New Point(Width \ 2 - image.Width \ 2, Header \ 2 - image.Height \ 2)
  937.  
  938. Select Case a
  939. Case HorizontalAlignment.Left
  940. G.DrawImage(image, x, DrawImagePoint.Y + y, image.Width, image.Height)
  941. Case HorizontalAlignment.Center
  942. G.DrawImage(image, DrawImagePoint.X + x, DrawImagePoint.Y + y, image.Width, image.Height)
  943. Case HorizontalAlignment.Right
  944. G.DrawImage(image, Width - image.Width - x, DrawImagePoint.Y + y, image.Width, image.Height)
  945. End Select
  946. End Sub
  947.  
  948. Protected Sub DrawImage(ByVal p1 As Point)
  949. DrawImage(_Image, p1.X, p1.Y)
  950. End Sub
  951. Protected Sub DrawImage(ByVal x As Integer, ByVal y As Integer)
  952. DrawImage(_Image, x, y)
  953. End Sub
  954.  
  955. Protected Sub DrawImage(ByVal image As Image, ByVal p1 As Point)
  956. DrawImage(image, p1.X, p1.Y)
  957. End Sub
  958. Protected Sub DrawImage(ByVal image As Image, ByVal x As Integer, ByVal y As Integer)
  959. If image Is Nothing Then Return
  960. G.DrawImage(image, x, y, image.Width, image.Height)
  961. End Sub
  962.  
  963. #End Region
  964.  
  965. #Region " DrawGradient "
  966.  
  967. Private DrawGradientBrush As LinearGradientBrush
  968. Private DrawGradientRectangle As Rectangle
  969.  
  970. Protected Sub DrawGradient(ByVal blend As ColorBlend, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
  971. DrawGradientRectangle = New Rectangle(x, y, width, height)
  972. DrawGradient(blend, DrawGradientRectangle)
  973. End Sub
  974. Protected Sub DrawGradient(ByVal blend As ColorBlend, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal angle As Single)
  975. DrawGradientRectangle = New Rectangle(x, y, width, height)
  976. DrawGradient(blend, DrawGradientRectangle, angle)
  977. End Sub
  978.  
  979. Protected Sub DrawGradient(ByVal blend As ColorBlend, ByVal r As Rectangle)
  980. DrawGradientBrush = New LinearGradientBrush(r, Color.Empty, Color.Empty, 90.0F)
  981. DrawGradientBrush.InterpolationColors = blend
  982. G.FillRectangle(DrawGradientBrush, r)
  983. End Sub
  984. Protected Sub DrawGradient(ByVal blend As ColorBlend, ByVal r As Rectangle, ByVal angle As Single)
  985. DrawGradientBrush = New LinearGradientBrush(r, Color.Empty, Color.Empty, angle)
  986. DrawGradientBrush.InterpolationColors = blend
  987. G.FillRectangle(DrawGradientBrush, r)
  988. End Sub
  989.  
  990.  
  991. 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)
  992. DrawGradientRectangle = New Rectangle(x, y, width, height)
  993. DrawGradient(c1, c2, DrawGradientRectangle)
  994. End Sub
  995. 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)
  996. DrawGradientRectangle = New Rectangle(x, y, width, height)
  997. DrawGradient(c1, c2, DrawGradientRectangle, angle)
  998. End Sub
  999.  
  1000. Protected Sub DrawGradient(ByVal c1 As Color, ByVal c2 As Color, ByVal r As Rectangle)
  1001. DrawGradientBrush = New LinearGradientBrush(r, c1, c2, 90.0F)
  1002. G.FillRectangle(DrawGradientBrush, r)
  1003. End Sub
  1004. Protected Sub DrawGradient(ByVal c1 As Color, ByVal c2 As Color, ByVal r As Rectangle, ByVal angle As Single)
  1005. DrawGradientBrush = New LinearGradientBrush(r, c1, c2, angle)
  1006. G.FillRectangle(DrawGradientBrush, r)
  1007. End Sub
  1008.  
  1009. #End Region
  1010.  
  1011. #Region " DrawRadial "
  1012.  
  1013. Private DrawRadialPath As GraphicsPath
  1014. Private DrawRadialBrush1 As PathGradientBrush
  1015. Private DrawRadialBrush2 As LinearGradientBrush
  1016. Private DrawRadialRectangle As Rectangle
  1017.  
  1018. Sub DrawRadial(ByVal blend As ColorBlend, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
  1019. DrawRadialRectangle = New Rectangle(x, y, width, height)
  1020. DrawRadial(blend, DrawRadialRectangle, width \ 2, height \ 2)
  1021. End Sub
  1022. Sub DrawRadial(ByVal blend As ColorBlend, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal center As Point)
  1023. DrawRadialRectangle = New Rectangle(x, y, width, height)
  1024. DrawRadial(blend, DrawRadialRectangle, center.X, center.Y)
  1025. End Sub
  1026. Sub DrawRadial(ByVal blend As ColorBlend, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal cx As Integer, ByVal cy As Integer)
  1027. DrawRadialRectangle = New Rectangle(x, y, width, height)
  1028. DrawRadial(blend, DrawRadialRectangle, cx, cy)
  1029. End Sub
  1030.  
  1031. Sub DrawRadial(ByVal blend As ColorBlend, ByVal r As Rectangle)
  1032. DrawRadial(blend, r, r.Width \ 2, r.Height \ 2)
  1033. End Sub
  1034. Sub DrawRadial(ByVal blend As ColorBlend, ByVal r As Rectangle, ByVal center As Point)
  1035. DrawRadial(blend, r, center.X, center.Y)
  1036. End Sub
  1037. Sub DrawRadial(ByVal blend As ColorBlend, ByVal r As Rectangle, ByVal cx As Integer, ByVal cy As Integer)
  1038. DrawRadialPath.Reset()
  1039. DrawRadialPath.AddEllipse(r.X, r.Y, r.Width - 1, r.Height - 1)
  1040.  
  1041. DrawRadialBrush1 = New PathGradientBrush(DrawRadialPath)
  1042. DrawRadialBrush1.CenterPoint = New Point(r.X + cx, r.Y + cy)
  1043. DrawRadialBrush1.InterpolationColors = blend
  1044.  
  1045. If G.SmoothingMode = SmoothingMode.AntiAlias Then
  1046. G.FillEllipse(DrawRadialBrush1, r.X + 1, r.Y + 1, r.Width - 3, r.Height - 3)
  1047. Else
  1048. G.FillEllipse(DrawRadialBrush1, r)
  1049. End If
  1050. End Sub
  1051.  
  1052.  
  1053. Protected Sub DrawRadial(ByVal c1 As Color, ByVal c2 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
  1054. DrawRadialRectangle = New Rectangle(x, y, width, height)
  1055. DrawRadial(c1, c2, DrawGradientRectangle)
  1056. End Sub
  1057. Protected Sub DrawRadial(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)
  1058. DrawRadialRectangle = New Rectangle(x, y, width, height)
  1059. DrawRadial(c1, c2, DrawGradientRectangle, angle)
  1060. End Sub
  1061.  
  1062. Protected Sub DrawRadial(ByVal c1 As Color, ByVal c2 As Color, ByVal r As Rectangle)
  1063. DrawRadialBrush2 = New LinearGradientBrush(r, c1, c2, 90.0F)
  1064. G.FillRectangle(DrawGradientBrush, r)
  1065. End Sub
  1066. Protected Sub DrawRadial(ByVal c1 As Color, ByVal c2 As Color, ByVal r As Rectangle, ByVal angle As Single)
  1067. DrawRadialBrush2 = New LinearGradientBrush(r, c1, c2, angle)
  1068. G.FillEllipse(DrawGradientBrush, r)
  1069. End Sub
  1070.  
  1071. #End Region
  1072.  
  1073. #Region " CreateRound "
  1074.  
  1075. Private CreateRoundPath As GraphicsPath
  1076. Private CreateRoundRectangle As Rectangle
  1077.  
  1078. Function CreateRound(ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal slope As Integer) As GraphicsPath
  1079. CreateRoundRectangle = New Rectangle(x, y, width, height)
  1080. Return CreateRound(CreateRoundRectangle, slope)
  1081. End Function
  1082.  
  1083. Function CreateRound(ByVal r As Rectangle, ByVal slope As Integer) As GraphicsPath
  1084. CreateRoundPath = New GraphicsPath(FillMode.Winding)
  1085. CreateRoundPath.AddArc(r.X, r.Y, slope, slope, 180.0F, 90.0F)
  1086. CreateRoundPath.AddArc(r.Right - slope, r.Y, slope, slope, 270.0F, 90.0F)
  1087. CreateRoundPath.AddArc(r.Right - slope, r.Bottom - slope, slope, slope, 0.0F, 90.0F)
  1088. CreateRoundPath.AddArc(r.X, r.Bottom - slope, slope, slope, 90.0F, 90.0F)
  1089. CreateRoundPath.CloseFigure()
  1090. Return CreateRoundPath
  1091. End Function
  1092.  
  1093. #End Region
  1094.  
  1095. End Class
  1096.  
  1097. MustInherit Class ThemeControl154
  1098. Inherits Control
  1099.  
  1100.  
  1101. #Region " Initialization "
  1102.  
  1103. Protected G As Graphics, B As Bitmap
  1104.  
  1105. Sub New()
  1106. SetStyle(DirectCast(139270, ControlStyles), True)
  1107. _ImageSize = Size.Empty
  1108. Font = New Font("Verdana", 8S)
  1109.  
  1110. MeasureBitmap = New Bitmap(1, 1)
  1111. MeasureGraphics = Graphics.FromImage(MeasureBitmap)
  1112.  
  1113. DrawRadialPath = New GraphicsPath
  1114.  
  1115. InvalidateCustimization() 'Remove?
  1116. End Sub
  1117.  
  1118. Protected NotOverridable Overrides Sub OnHandleCreated(ByVal e As EventArgs)
  1119. InvalidateCustimization()
  1120. ColorHook()
  1121.  
  1122. If Not _LockWidth = 0 Then Width = _LockWidth
  1123. If Not _LockHeight = 0 Then Height = _LockHeight
  1124.  
  1125. Transparent = _Transparent
  1126. If _Transparent AndAlso _BackColor Then BackColor = Color.Transparent
  1127.  
  1128. MyBase.OnHandleCreated(e)
  1129. End Sub
  1130.  
  1131. Private DoneCreation As Boolean
  1132. Protected NotOverridable Overrides Sub OnParentChanged(ByVal e As EventArgs)
  1133. If Parent IsNot Nothing Then
  1134. OnCreation()
  1135. DoneCreation = True
  1136. InvalidateTimer()
  1137. End If
  1138.  
  1139. MyBase.OnParentChanged(e)
  1140. End Sub
  1141.  
  1142. #End Region
  1143.  
  1144. Private Sub DoAnimation(ByVal i As Boolean)
  1145. OnAnimation()
  1146. If i Then Invalidate()
  1147. End Sub
  1148.  
  1149. Protected NotOverridable Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  1150. If Width = 0 OrElse Height = 0 Then Return
  1151.  
  1152. If _Transparent Then
  1153. PaintHook()
  1154. e.Graphics.DrawImage(B, 0, 0)
  1155. Else
  1156. G = e.Graphics
  1157. PaintHook()
  1158. End If
  1159. End Sub
  1160.  
  1161. Protected Overrides Sub OnHandleDestroyed(ByVal e As EventArgs)
  1162. RemoveAnimationCallback(AddressOf DoAnimation)
  1163. MyBase.OnHandleDestroyed(e)
  1164. End Sub
  1165.  
  1166. #Region " Size Handling "
  1167.  
  1168. Protected NotOverridable Overrides Sub OnSizeChanged(ByVal e As EventArgs)
  1169. If _Transparent Then
  1170. InvalidateBitmap()
  1171. End If
  1172.  
  1173. Invalidate()
  1174. MyBase.OnSizeChanged(e)
  1175. End Sub
  1176.  
  1177. Protected Overrides Sub SetBoundsCore(ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal specified As BoundsSpecified)
  1178. If Not _LockWidth = 0 Then width = _LockWidth
  1179. If Not _LockHeight = 0 Then height = _LockHeight
  1180. MyBase.SetBoundsCore(x, y, width, height, specified)
  1181. End Sub
  1182.  
  1183. #End Region
  1184.  
  1185. #Region " State Handling "
  1186.  
  1187. Private InPosition As Boolean
  1188. Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
  1189. InPosition = True
  1190. SetState(MouseState.Over)
  1191. MyBase.OnMouseEnter(e)
  1192. End Sub
  1193.  
  1194. Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  1195. If InPosition Then SetState(MouseState.Over)
  1196. MyBase.OnMouseUp(e)
  1197. End Sub
  1198.  
  1199. Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  1200. If e.Button = Windows.Forms.MouseButtons.Left Then SetState(MouseState.Down)
  1201. MyBase.OnMouseDown(e)
  1202. End Sub
  1203.  
  1204. Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
  1205. InPosition = False
  1206. SetState(MouseState.None)
  1207. MyBase.OnMouseLeave(e)
  1208. End Sub
  1209.  
  1210. Protected Overrides Sub OnEnabledChanged(ByVal e As EventArgs)
  1211. If Enabled Then SetState(MouseState.None) Else SetState(MouseState.Block)
  1212. MyBase.OnEnabledChanged(e)
  1213. End Sub
  1214.  
  1215. Protected State As MouseState
  1216. Private Sub SetState(ByVal current As MouseState)
  1217. State = current
  1218. Invalidate()
  1219. End Sub
  1220.  
  1221. #End Region
  1222.  
  1223.  
  1224. #Region " Base Properties "
  1225.  
  1226. <Browsable(False), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
  1227. Overrides Property ForeColor() As Color
  1228. Get
  1229. Return Color.Empty
  1230. End Get
  1231. Set(ByVal value As Color)
  1232. End Set
  1233. End Property
  1234. <Browsable(False), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
  1235. Overrides Property BackgroundImage() As Image
  1236. Get
  1237. Return Nothing
  1238. End Get
  1239. Set(ByVal value As Image)
  1240. End Set
  1241. End Property
  1242. <Browsable(False), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
  1243. Overrides Property BackgroundImageLayout() As ImageLayout
  1244. Get
  1245. Return ImageLayout.None
  1246. End Get
  1247. Set(ByVal value As ImageLayout)
  1248. End Set
  1249. End Property
  1250.  
  1251. Overrides Property Text() As String
  1252. Get
  1253. Return MyBase.Text
  1254. End Get
  1255. Set(ByVal value As String)
  1256. MyBase.Text = value
  1257. Invalidate()
  1258. End Set
  1259. End Property
  1260. Overrides Property Font() As Font
  1261. Get
  1262. Return MyBase.Font
  1263. End Get
  1264. Set(ByVal value As Font)
  1265. MyBase.Font = value
  1266. Invalidate()
  1267. End Set
  1268. End Property
  1269.  
  1270. Private _BackColor As Boolean
  1271. <Category("Misc")> _
  1272. Overrides Property BackColor() As Color
  1273. Get
  1274. Return MyBase.BackColor
  1275. End Get
  1276. Set(ByVal value As Color)
  1277. If Not IsHandleCreated AndAlso value = Color.Transparent Then
  1278. _BackColor = True
  1279. Return
  1280. End If
  1281.  
  1282. MyBase.BackColor = value
  1283. If Parent IsNot Nothing Then ColorHook()
  1284. End Set
  1285. End Property
  1286.  
  1287. #End Region
  1288.  
  1289. #Region " Public Properties "
  1290.  
  1291. Private _NoRounding As Boolean
  1292. Property NoRounding() As Boolean
  1293. Get
  1294. Return _NoRounding
  1295. End Get
  1296. Set(ByVal v As Boolean)
  1297. _NoRounding = v
  1298. Invalidate()
  1299. End Set
  1300. End Property
  1301.  
  1302. Private _Image As Image
  1303. Property Image() As Image
  1304. Get
  1305. Return _Image
  1306. End Get
  1307. Set(ByVal value As Image)
  1308. If value Is Nothing Then
  1309. _ImageSize = Size.Empty
  1310. Else
  1311. _ImageSize = value.Size
  1312. End If
  1313.  
  1314. _Image = value
  1315. Invalidate()
  1316. End Set
  1317. End Property
  1318.  
  1319. Private _Transparent As Boolean
  1320. Property Transparent() As Boolean
  1321. Get
  1322. Return _Transparent
  1323. End Get
  1324. Set(ByVal value As Boolean)
  1325. _Transparent = value
  1326. If Not IsHandleCreated Then Return
  1327.  
  1328. If Not value AndAlso Not BackColor.A = 255 Then
  1329. Throw New Exception("Unable to change value to false while a transparent BackColor is in use.")
  1330. End If
  1331.  
  1332. SetStyle(ControlStyles.Opaque, Not value)
  1333. SetStyle(ControlStyles.SupportsTransparentBackColor, value)
  1334.  
  1335. If value Then InvalidateBitmap() Else B = Nothing
  1336. Invalidate()
  1337. End Set
  1338. End Property
  1339.  
  1340. Private Items As New Dictionary(Of String, Color)
  1341. Property Colors() As Bloom()
  1342. Get
  1343. Dim T As New List(Of Bloom)
  1344. Dim E As Dictionary(Of String, Color).Enumerator = Items.GetEnumerator
  1345.  
  1346. While E.MoveNext
  1347. T.Add(New Bloom(E.Current.Key, E.Current.Value))
  1348. End While
  1349.  
  1350. Return T.ToArray
  1351. End Get
  1352. Set(ByVal value As Bloom())
  1353. For Each B As Bloom In value
  1354. If Items.ContainsKey(B.Name) Then Items(B.Name) = B.Value
  1355. Next
  1356.  
  1357. InvalidateCustimization()
  1358. ColorHook()
  1359. Invalidate()
  1360. End Set
  1361. End Property
  1362.  
  1363. Private _Customization As String
  1364. Property Customization() As String
  1365. Get
  1366. Return _Customization
  1367. End Get
  1368. Set(ByVal value As String)
  1369. If value = _Customization Then Return
  1370.  
  1371. Dim Data As Byte()
  1372. Dim Items As Bloom() = Colors
  1373.  
  1374. Try
  1375. Data = Convert.FromBase64String(value)
  1376. For I As Integer = 0 To Items.Length - 1
  1377. Items(I).Value = Color.FromArgb(BitConverter.ToInt32(Data, I * 4))
  1378. Next
  1379. Catch
  1380. Return
  1381. End Try
  1382.  
  1383. _Customization = value
  1384.  
  1385. Colors = Items
  1386. ColorHook()
  1387. Invalidate()
  1388. End Set
  1389. End Property
  1390.  
  1391. #End Region
  1392.  
  1393. #Region " Private Properties "
  1394.  
  1395. Private _ImageSize As Size
  1396. Protected ReadOnly Property ImageSize() As Size
  1397. Get
  1398. Return _ImageSize
  1399. End Get
  1400. End Property
  1401.  
  1402. Private _LockWidth As Integer
  1403. Protected Property LockWidth() As Integer
  1404. Get
  1405. Return _LockWidth
  1406. End Get
  1407. Set(ByVal value As Integer)
  1408. _LockWidth = value
  1409. If Not LockWidth = 0 AndAlso IsHandleCreated Then Width = LockWidth
  1410. End Set
  1411. End Property
  1412.  
  1413. Private _LockHeight As Integer
  1414. Protected Property LockHeight() As Integer
  1415. Get
  1416. Return _LockHeight
  1417. End Get
  1418. Set(ByVal value As Integer)
  1419. _LockHeight = value
  1420. If Not LockHeight = 0 AndAlso IsHandleCreated Then Height = LockHeight
  1421. End Set
  1422. End Property
  1423.  
  1424. Private _IsAnimated As Boolean
  1425. Protected Property IsAnimated() As Boolean
  1426. Get
  1427. Return _IsAnimated
  1428. End Get
  1429. Set(ByVal value As Boolean)
  1430. _IsAnimated = value
  1431. InvalidateTimer()
  1432. End Set
  1433. End Property
  1434.  
  1435. #End Region
  1436.  
  1437.  
  1438. #Region " Property Helpers "
  1439.  
  1440. Protected Function GetPen(ByVal name As String) As Pen
  1441. Return New Pen(Items(name))
  1442. End Function
  1443. Protected Function GetPen(ByVal name As String, ByVal width As Single) As Pen
  1444. Return New Pen(Items(name), width)
  1445. End Function
  1446.  
  1447. Protected Function GetBrush(ByVal name As String) As SolidBrush
  1448. Return New SolidBrush(Items(name))
  1449. End Function
  1450.  
  1451. Protected Function GetColor(ByVal name As String) As Color
  1452. Return Items(name)
  1453. End Function
  1454.  
  1455. Protected Sub SetColor(ByVal name As String, ByVal value As Color)
  1456. If Items.ContainsKey(name) Then Items(name) = value Else Items.Add(name, value)
  1457. End Sub
  1458. Protected Sub SetColor(ByVal name As String, ByVal r As Byte, ByVal g As Byte, ByVal b As Byte)
  1459. SetColor(name, Color.FromArgb(r, g, b))
  1460. End Sub
  1461. Protected Sub SetColor(ByVal name As String, ByVal a As Byte, ByVal r As Byte, ByVal g As Byte, ByVal b As Byte)
  1462. SetColor(name, Color.FromArgb(a, r, g, b))
  1463. End Sub
  1464. Protected Sub SetColor(ByVal name As String, ByVal a As Byte, ByVal value As Color)
  1465. SetColor(name, Color.FromArgb(a, value))
  1466. End Sub
  1467.  
  1468. Private Sub InvalidateBitmap()
  1469. If Width = 0 OrElse Height = 0 Then Return
  1470. B = New Bitmap(Width, Height, PixelFormat.Format32bppPArgb)
  1471. G = Graphics.FromImage(B)
  1472. End Sub
  1473.  
  1474. Private Sub InvalidateCustimization()
  1475. Dim M As New MemoryStream(Items.Count * 4)
  1476.  
  1477. For Each B As Bloom In Colors
  1478. M.Write(BitConverter.GetBytes(B.Value.ToArgb), 0, 4)
  1479. Next
  1480.  
  1481. M.Close()
  1482. _Customization = Convert.ToBase64String(M.ToArray)
  1483. End Sub
  1484.  
  1485. Private Sub InvalidateTimer()
  1486. If DesignMode OrElse Not DoneCreation Then Return
  1487.  
  1488. If _IsAnimated Then
  1489. AddAnimationCallback(AddressOf DoAnimation)
  1490. Else
  1491. RemoveAnimationCallback(AddressOf DoAnimation)
  1492. End If
  1493. End Sub
  1494. #End Region
  1495.  
  1496.  
  1497. #Region " User Hooks "
  1498.  
  1499. Protected MustOverride Sub ColorHook()
  1500. Protected MustOverride Sub PaintHook()
  1501.  
  1502. Protected Overridable Sub OnCreation()
  1503. End Sub
  1504.  
  1505. Protected Overridable Sub OnAnimation()
  1506. End Sub
  1507.  
  1508. #End Region
  1509.  
  1510.  
  1511. #Region " Offset "
  1512.  
  1513. Private OffsetReturnRectangle As Rectangle
  1514. Protected Function Offset(ByVal r As Rectangle, ByVal amount As Integer) As Rectangle
  1515. OffsetReturnRectangle = New Rectangle(r.X + amount, r.Y + amount, r.Width - (amount * 2), r.Height - (amount * 2))
  1516. Return OffsetReturnRectangle
  1517. End Function
  1518.  
  1519. Private OffsetReturnSize As Size
  1520. Protected Function Offset(ByVal s As Size, ByVal amount As Integer) As Size
  1521. OffsetReturnSize = New Size(s.Width + amount, s.Height + amount)
  1522. Return OffsetReturnSize
  1523. End Function
  1524.  
  1525. Private OffsetReturnPoint As Point
  1526. Protected Function Offset(ByVal p As Point, ByVal amount As Integer) As Point
  1527. OffsetReturnPoint = New Point(p.X + amount, p.Y + amount)
  1528. Return OffsetReturnPoint
  1529. End Function
  1530.  
  1531. #End Region
  1532.  
  1533. #Region " Center "
  1534.  
  1535. Private CenterReturn As Point
  1536.  
  1537. Protected Function Center(ByVal p As Rectangle, ByVal c As Rectangle) As Point
  1538. CenterReturn = New Point((p.Width \ 2 - c.Width \ 2) + p.X + c.X, (p.Height \ 2 - c.Height \ 2) + p.Y + c.Y)
  1539. Return CenterReturn
  1540. End Function
  1541. Protected Function Center(ByVal p As Rectangle, ByVal c As Size) As Point
  1542. CenterReturn = New Point((p.Width \ 2 - c.Width \ 2) + p.X, (p.Height \ 2 - c.Height \ 2) + p.Y)
  1543. Return CenterReturn
  1544. End Function
  1545.  
  1546. Protected Function Center(ByVal child As Rectangle) As Point
  1547. Return Center(Width, Height, child.Width, child.Height)
  1548. End Function
  1549. Protected Function Center(ByVal child As Size) As Point
  1550. Return Center(Width, Height, child.Width, child.Height)
  1551. End Function
  1552. Protected Function Center(ByVal childWidth As Integer, ByVal childHeight As Integer) As Point
  1553. Return Center(Width, Height, childWidth, childHeight)
  1554. End Function
  1555.  
  1556. Protected Function Center(ByVal p As Size, ByVal c As Size) As Point
  1557. Return Center(p.Width, p.Height, c.Width, c.Height)
  1558. End Function
  1559.  
  1560. Protected Function Center(ByVal pWidth As Integer, ByVal pHeight As Integer, ByVal cWidth As Integer, ByVal cHeight As Integer) As Point
  1561. CenterReturn = New Point(pWidth \ 2 - cWidth \ 2, pHeight \ 2 - cHeight \ 2)
  1562. Return CenterReturn
  1563. End Function
  1564.  
  1565. #End Region
  1566.  
  1567. #Region " Measure "
  1568.  
  1569. Private MeasureBitmap As Bitmap
  1570. Private MeasureGraphics As Graphics 'TODO: Potential issues during multi-threading.
  1571.  
  1572. Protected Function Measure() As Size
  1573. Return MeasureGraphics.MeasureString(Text, Font, Width).ToSize
  1574. End Function
  1575. Protected Function Measure(ByVal text As String) As Size
  1576. Return MeasureGraphics.MeasureString(text, Font, Width).ToSize
  1577. End Function
  1578.  
  1579. #End Region
  1580.  
  1581.  
  1582. #Region " DrawPixel "
  1583.  
  1584. Private DrawPixelBrush As SolidBrush
  1585.  
  1586. Protected Sub DrawPixel(ByVal c1 As Color, ByVal x As Integer, ByVal y As Integer)
  1587. If _Transparent Then
  1588. B.SetPixel(x, y, c1)
  1589. Else
  1590. DrawPixelBrush = New SolidBrush(c1)
  1591. G.FillRectangle(DrawPixelBrush, x, y, 1, 1)
  1592. End If
  1593. End Sub
  1594.  
  1595. #End Region
  1596.  
  1597. #Region " DrawCorners "
  1598.  
  1599. Private DrawCornersBrush As SolidBrush
  1600.  
  1601. Protected Sub DrawCorners(ByVal c1 As Color, ByVal offset As Integer)
  1602. DrawCorners(c1, 0, 0, Width, Height, offset)
  1603. End Sub
  1604. Protected Sub DrawCorners(ByVal c1 As Color, ByVal r1 As Rectangle, ByVal offset As Integer)
  1605. DrawCorners(c1, r1.X, r1.Y, r1.Width, r1.Height, offset)
  1606. End Sub
  1607. Protected Sub DrawCorners(ByVal c1 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal offset As Integer)
  1608. DrawCorners(c1, x + offset, y + offset, width - (offset * 2), height - (offset * 2))
  1609. End Sub
  1610.  
  1611. Protected Sub DrawCorners(ByVal c1 As Color)
  1612. DrawCorners(c1, 0, 0, Width, Height)
  1613. End Sub
  1614. Protected Sub DrawCorners(ByVal c1 As Color, ByVal r1 As Rectangle)
  1615. DrawCorners(c1, r1.X, r1.Y, r1.Width, r1.Height)
  1616. End Sub
  1617. Protected Sub DrawCorners(ByVal c1 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
  1618. If _NoRounding Then Return
  1619.  
  1620. If _Transparent Then
  1621. B.SetPixel(x, y, c1)
  1622. B.SetPixel(x + (width - 1), y, c1)
  1623. B.SetPixel(x, y + (height - 1), c1)
  1624. B.SetPixel(x + (width - 1), y + (height - 1), c1)
  1625. Else
  1626. DrawCornersBrush = New SolidBrush(c1)
  1627. G.FillRectangle(DrawCornersBrush, x, y, 1, 1)
  1628. G.FillRectangle(DrawCornersBrush, x + (width - 1), y, 1, 1)
  1629. G.FillRectangle(DrawCornersBrush, x, y + (height - 1), 1, 1)
  1630. G.FillRectangle(DrawCornersBrush, x + (width - 1), y + (height - 1), 1, 1)
  1631. End If
  1632. End Sub
  1633.  
  1634. #End Region
  1635.  
  1636. #Region " DrawBorders "
  1637.  
  1638. Protected Sub DrawBorders(ByVal p1 As Pen, ByVal offset As Integer)
  1639. DrawBorders(p1, 0, 0, Width, Height, offset)
  1640. End Sub
  1641. Protected Sub DrawBorders(ByVal p1 As Pen, ByVal r As Rectangle, ByVal offset As Integer)
  1642. DrawBorders(p1, r.X, r.Y, r.Width, r.Height, offset)
  1643. End Sub
  1644. Protected Sub DrawBorders(ByVal p1 As Pen, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal offset As Integer)
  1645. DrawBorders(p1, x + offset, y + offset, width - (offset * 2), height - (offset * 2))
  1646. End Sub
  1647.  
  1648. Protected Sub DrawBorders(ByVal p1 As Pen)
  1649. DrawBorders(p1, 0, 0, Width, Height)
  1650. End Sub
  1651. Protected Sub DrawBorders(ByVal p1 As Pen, ByVal r As Rectangle)
  1652. DrawBorders(p1, r.X, r.Y, r.Width, r.Height)
  1653. End Sub
  1654. Protected Sub DrawBorders(ByVal p1 As Pen, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
  1655. G.DrawRectangle(p1, x, y, width - 1, height - 1)
  1656. End Sub
  1657.  
  1658. #End Region
  1659.  
  1660. #Region " DrawText "
  1661.  
  1662. Private DrawTextPoint As Point
  1663. Private DrawTextSize As Size
  1664.  
  1665. Protected Sub DrawText(ByVal b1 As Brush, ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
  1666. DrawText(b1, Text, a, x, y)
  1667. End Sub
  1668. Protected Sub DrawText(ByVal b1 As Brush, ByVal text As String, ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
  1669. If text.Length = 0 Then Return
  1670.  
  1671. DrawTextSize = Measure(text)
  1672. DrawTextPoint = Center(DrawTextSize)
  1673.  
  1674. Select Case a
  1675. Case HorizontalAlignment.Left
  1676. G.DrawString(text, Font, b1, x, DrawTextPoint.Y + y)
  1677. Case HorizontalAlignment.Center
  1678. G.DrawString(text, Font, b1, DrawTextPoint.X + x, DrawTextPoint.Y + y)
  1679. Case HorizontalAlignment.Right
  1680. G.DrawString(text, Font, b1, Width - DrawTextSize.Width - x, DrawTextPoint.Y + y)
  1681. End Select
  1682. End Sub
  1683.  
  1684. Protected Sub DrawText(ByVal b1 As Brush, ByVal p1 As Point)
  1685. If Text.Length = 0 Then Return
  1686. G.DrawString(Text, Font, b1, p1)
  1687. End Sub
  1688. Protected Sub DrawText(ByVal b1 As Brush, ByVal x As Integer, ByVal y As Integer)
  1689. If Text.Length = 0 Then Return
  1690. G.DrawString(Text, Font, b1, x, y)
  1691. End Sub
  1692.  
  1693. #End Region
  1694.  
  1695. #Region " DrawImage "
  1696.  
  1697. Private DrawImagePoint As Point
  1698.  
  1699. Protected Sub DrawImage(ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
  1700. DrawImage(_Image, a, x, y)
  1701. End Sub
  1702. Protected Sub DrawImage(ByVal image As Image, ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
  1703. If image Is Nothing Then Return
  1704. DrawImagePoint = Center(image.Size)
  1705.  
  1706. Select Case a
  1707. Case HorizontalAlignment.Left
  1708. G.DrawImage(image, x, DrawImagePoint.Y + y, image.Width, image.Height)
  1709. Case HorizontalAlignment.Center
  1710. G.DrawImage(image, DrawImagePoint.X + x, DrawImagePoint.Y + y, image.Width, image.Height)
  1711. Case HorizontalAlignment.Right
  1712. G.DrawImage(image, Width - image.Width - x, DrawImagePoint.Y + y, image.Width, image.Height)
  1713. End Select
  1714. End Sub
  1715.  
  1716. Protected Sub DrawImage(ByVal p1 As Point)
  1717. DrawImage(_Image, p1.X, p1.Y)
  1718. End Sub
  1719. Protected Sub DrawImage(ByVal x As Integer, ByVal y As Integer)
  1720. DrawImage(_Image, x, y)
  1721. End Sub
  1722.  
  1723. Protected Sub DrawImage(ByVal image As Image, ByVal p1 As Point)
  1724. DrawImage(image, p1.X, p1.Y)
  1725. End Sub
  1726. Protected Sub DrawImage(ByVal image As Image, ByVal x As Integer, ByVal y As Integer)
  1727. If image Is Nothing Then Return
  1728. G.DrawImage(image, x, y, image.Width, image.Height)
  1729. End Sub
  1730.  
  1731. #End Region
  1732.  
  1733. #Region " DrawGradient "
  1734.  
  1735. Private DrawGradientBrush As LinearGradientBrush
  1736. Private DrawGradientRectangle As Rectangle
  1737.  
  1738. Protected Sub DrawGradient(ByVal blend As ColorBlend, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
  1739. DrawGradientRectangle = New Rectangle(x, y, width, height)
  1740. DrawGradient(blend, DrawGradientRectangle)
  1741. End Sub
  1742. Protected Sub DrawGradient(ByVal blend As ColorBlend, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal angle As Single)
  1743. DrawGradientRectangle = New Rectangle(x, y, width, height)
  1744. DrawGradient(blend, DrawGradientRectangle, angle)
  1745. End Sub
  1746.  
  1747. Protected Sub DrawGradient(ByVal blend As ColorBlend, ByVal r As Rectangle)
  1748. DrawGradientBrush = New LinearGradientBrush(r, Color.Empty, Color.Empty, 90.0F)
  1749. DrawGradientBrush.InterpolationColors = blend
  1750. G.FillRectangle(DrawGradientBrush, r)
  1751. End Sub
  1752. Protected Sub DrawGradient(ByVal blend As ColorBlend, ByVal r As Rectangle, ByVal angle As Single)
  1753. DrawGradientBrush = New LinearGradientBrush(r, Color.Empty, Color.Empty, angle)
  1754. DrawGradientBrush.InterpolationColors = blend
  1755. G.FillRectangle(DrawGradientBrush, r)
  1756. End Sub
  1757.  
  1758.  
  1759. 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)
  1760. DrawGradientRectangle = New Rectangle(x, y, width, height)
  1761. DrawGradient(c1, c2, DrawGradientRectangle)
  1762. End Sub
  1763. 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)
  1764. DrawGradientRectangle = New Rectangle(x, y, width, height)
  1765. DrawGradient(c1, c2, DrawGradientRectangle, angle)
  1766. End Sub
  1767.  
  1768. Protected Sub DrawGradient(ByVal c1 As Color, ByVal c2 As Color, ByVal r As Rectangle)
  1769. DrawGradientBrush = New LinearGradientBrush(r, c1, c2, 90.0F)
  1770. G.FillRectangle(DrawGradientBrush, r)
  1771. End Sub
  1772. Protected Sub DrawGradient(ByVal c1 As Color, ByVal c2 As Color, ByVal r As Rectangle, ByVal angle As Single)
  1773. DrawGradientBrush = New LinearGradientBrush(r, c1, c2, angle)
  1774. G.FillRectangle(DrawGradientBrush, r)
  1775. End Sub
  1776.  
  1777. #End Region
  1778.  
  1779. #Region " DrawRadial "
  1780.  
  1781. Private DrawRadialPath As GraphicsPath
  1782. Private DrawRadialBrush1 As PathGradientBrush
  1783. Private DrawRadialBrush2 As LinearGradientBrush
  1784. Private DrawRadialRectangle As Rectangle
  1785.  
  1786. Sub DrawRadial(ByVal blend As ColorBlend, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
  1787. DrawRadialRectangle = New Rectangle(x, y, width, height)
  1788. DrawRadial(blend, DrawRadialRectangle, width \ 2, height \ 2)
  1789. End Sub
  1790. Sub DrawRadial(ByVal blend As ColorBlend, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal center As Point)
  1791. DrawRadialRectangle = New Rectangle(x, y, width, height)
  1792. DrawRadial(blend, DrawRadialRectangle, center.X, center.Y)
  1793. End Sub
  1794. Sub DrawRadial(ByVal blend As ColorBlend, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal cx As Integer, ByVal cy As Integer)
  1795. DrawRadialRectangle = New Rectangle(x, y, width, height)
  1796. DrawRadial(blend, DrawRadialRectangle, cx, cy)
  1797. End Sub
  1798.  
  1799. Sub DrawRadial(ByVal blend As ColorBlend, ByVal r As Rectangle)
  1800. DrawRadial(blend, r, r.Width \ 2, r.Height \ 2)
  1801. End Sub
  1802. Sub DrawRadial(ByVal blend As ColorBlend, ByVal r As Rectangle, ByVal center As Point)
  1803. DrawRadial(blend, r, center.X, center.Y)
  1804. End Sub
  1805. Sub DrawRadial(ByVal blend As ColorBlend, ByVal r As Rectangle, ByVal cx As Integer, ByVal cy As Integer)
  1806. DrawRadialPath.Reset()
  1807. DrawRadialPath.AddEllipse(r.X, r.Y, r.Width - 1, r.Height - 1)
  1808.  
  1809. DrawRadialBrush1 = New PathGradientBrush(DrawRadialPath)
  1810. DrawRadialBrush1.CenterPoint = New Point(r.X + cx, r.Y + cy)
  1811. DrawRadialBrush1.InterpolationColors = blend
  1812.  
  1813. If G.SmoothingMode = SmoothingMode.AntiAlias Then
  1814. G.FillEllipse(DrawRadialBrush1, r.X + 1, r.Y + 1, r.Width - 3, r.Height - 3)
  1815. Else
  1816. G.FillEllipse(DrawRadialBrush1, r)
  1817. End If
  1818. End Sub
  1819.  
  1820.  
  1821. Protected Sub DrawRadial(ByVal c1 As Color, ByVal c2 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
  1822. DrawRadialRectangle = New Rectangle(x, y, width, height)
  1823. DrawRadial(c1, c2, DrawRadialRectangle)
  1824. End Sub
  1825. Protected Sub DrawRadial(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)
  1826. DrawRadialRectangle = New Rectangle(x, y, width, height)
  1827. DrawRadial(c1, c2, DrawRadialRectangle, angle)
  1828. End Sub
  1829.  
  1830. Protected Sub DrawRadial(ByVal c1 As Color, ByVal c2 As Color, ByVal r As Rectangle)
  1831. DrawRadialBrush2 = New LinearGradientBrush(r, c1, c2, 90.0F)
  1832. G.FillEllipse(DrawRadialBrush2, r)
  1833. End Sub
  1834. Protected Sub DrawRadial(ByVal c1 As Color, ByVal c2 As Color, ByVal r As Rectangle, ByVal angle As Single)
  1835. DrawRadialBrush2 = New LinearGradientBrush(r, c1, c2, angle)
  1836. G.FillEllipse(DrawRadialBrush2, r)
  1837. End Sub
  1838.  
  1839. #End Region
  1840.  
  1841. #Region " CreateRound "
  1842.  
  1843. Private CreateRoundPath As GraphicsPath
  1844. Private CreateRoundRectangle As Rectangle
  1845.  
  1846. Function CreateRound(ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal slope As Integer) As GraphicsPath
  1847. CreateRoundRectangle = New Rectangle(x, y, width, height)
  1848. Return CreateRound(CreateRoundRectangle, slope)
  1849. End Function
  1850.  
  1851. Function CreateRound(ByVal r As Rectangle, ByVal slope As Integer) As GraphicsPath
  1852. CreateRoundPath = New GraphicsPath(FillMode.Winding)
  1853. CreateRoundPath.AddArc(r.X, r.Y, slope, slope, 180.0F, 90.0F)
  1854. CreateRoundPath.AddArc(r.Right - slope, r.Y, slope, slope, 270.0F, 90.0F)
  1855. CreateRoundPath.AddArc(r.Right - slope, r.Bottom - slope, slope, slope, 0.0F, 90.0F)
  1856. CreateRoundPath.AddArc(r.X, r.Bottom - slope, slope, slope, 90.0F, 90.0F)
  1857. CreateRoundPath.CloseFigure()
  1858. Return CreateRoundPath
  1859. End Function
  1860.  
  1861. #End Region
  1862.  
  1863. End Class
  1864.  
  1865. Module ThemeShare
  1866.  
  1867. #Region " Animation "
  1868.  
  1869. Private Frames As Integer
  1870. Private Invalidate As Boolean
  1871. Public ThemeTimer As New PrecisionTimer
  1872.  
  1873. Private Const FPS As Integer = 50 '1000 / 50 = 20 FPS
  1874. Private Const Rate As Integer = 10
  1875.  
  1876. Public Delegate Sub AnimationDelegate(ByVal invalidate As Boolean)
  1877.  
  1878. Private Callbacks As New List(Of AnimationDelegate)
  1879.  
  1880. Private Sub HandleCallbacks(ByVal state As IntPtr, ByVal reserve As Boolean)
  1881. Invalidate = (Frames >= FPS)
  1882. If Invalidate Then Frames = 0
  1883.  
  1884. SyncLock Callbacks
  1885. For I As Integer = 0 To Callbacks.Count - 1
  1886. Callbacks(I).Invoke(Invalidate)
  1887. Next
  1888. End SyncLock
  1889.  
  1890. Frames += Rate
  1891. End Sub
  1892.  
  1893. Private Sub InvalidateThemeTimer()
  1894. If Callbacks.Count = 0 Then
  1895. ThemeTimer.Delete()
  1896. Else
  1897. ThemeTimer.Create(0, Rate, AddressOf HandleCallbacks)
  1898. End If
  1899. End Sub
  1900.  
  1901. Sub AddAnimationCallback(ByVal callback As AnimationDelegate)
  1902. SyncLock Callbacks
  1903. If Callbacks.Contains(callback) Then Return
  1904.  
  1905. Callbacks.Add(callback)
  1906. InvalidateThemeTimer()
  1907. End SyncLock
  1908. End Sub
  1909.  
  1910. Sub RemoveAnimationCallback(ByVal callback As AnimationDelegate)
  1911. SyncLock Callbacks
  1912. If Not Callbacks.Contains(callback) Then Return
  1913.  
  1914. Callbacks.Remove(callback)
  1915. InvalidateThemeTimer()
  1916. End SyncLock
  1917. End Sub
  1918.  
  1919. #End Region
  1920.  
  1921. End Module
  1922.  
  1923. Enum MouseState As Byte
  1924. None = 0
  1925. Over = 1
  1926. Down = 2
  1927. Block = 3
  1928. End Enum
  1929.  
  1930. Structure Bloom
  1931.  
  1932. Public _Name As String
  1933. ReadOnly Property Name() As String
  1934. Get
  1935. Return _Name
  1936. End Get
  1937. End Property
  1938.  
  1939. Private _Value As Color
  1940. Property Value() As Color
  1941. Get
  1942. Return _Value
  1943. End Get
  1944. Set(ByVal value As Color)
  1945. _Value = value
  1946. End Set
  1947. End Property
  1948.  
  1949. Property ValueHex() As String
  1950. Get
  1951. Return String.Concat("#", _
  1952. _Value.R.ToString("X2", Nothing), _
  1953. _Value.G.ToString("X2", Nothing), _
  1954. _Value.B.ToString("X2", Nothing))
  1955. End Get
  1956. Set(ByVal value As String)
  1957. Try
  1958. _Value = ColorTranslator.FromHtml(value)
  1959. Catch
  1960. Return
  1961. End Try
  1962. End Set
  1963. End Property
  1964.  
  1965.  
  1966. Sub New(ByVal name As String, ByVal value As Color)
  1967. _Name = name
  1968. _Value = value
  1969. End Sub
  1970. End Structure
  1971.  
  1972. '------------------
  1973. 'Creator: aeonhack
  1974. 'Site: elitevs.net
  1975. 'Created: 11/30/2011
  1976. 'Changed: 11/30/2011
  1977. 'Version: 1.0.0
  1978. '------------------
  1979. Class PrecisionTimer
  1980. Implements IDisposable
  1981.  
  1982. Private _Enabled As Boolean
  1983. ReadOnly Property Enabled() As Boolean
  1984. Get
  1985. Return _Enabled
  1986. End Get
  1987. End Property
  1988.  
  1989. Private Handle As IntPtr
  1990. Private TimerCallback As TimerDelegate
  1991.  
  1992. <DllImport("kernel32.dll", EntryPoint:="CreateTimerQueueTimer")> _
  1993. Private Shared Function CreateTimerQueueTimer( _
  1994. ByRef handle As IntPtr, _
  1995. ByVal queue As IntPtr, _
  1996. ByVal callback As TimerDelegate, _
  1997. ByVal state As IntPtr, _
  1998. ByVal dueTime As UInteger, _
  1999. ByVal period As UInteger, _
  2000. ByVal flags As UInteger) As Boolean
  2001. End Function
  2002.  
  2003. <DllImport("kernel32.dll", EntryPoint:="DeleteTimerQueueTimer")> _
  2004. Private Shared Function DeleteTimerQueueTimer( _
  2005. ByVal queue As IntPtr, _
  2006. ByVal handle As IntPtr, _
  2007. ByVal callback As IntPtr) As Boolean
  2008. End Function
  2009.  
  2010. Delegate Sub TimerDelegate(ByVal r1 As IntPtr, ByVal r2 As Boolean)
  2011.  
  2012. Sub Create(ByVal dueTime As UInteger, ByVal period As UInteger, ByVal callback As TimerDelegate)
  2013. If _Enabled Then Return
  2014.  
  2015. TimerCallback = callback
  2016. Dim Success As Boolean = CreateTimerQueueTimer(Handle, IntPtr.Zero, TimerCallback, IntPtr.Zero, dueTime, period, 0)
  2017.  
  2018. If Not Success Then ThrowNewException("CreateTimerQueueTimer")
  2019. _Enabled = Success
  2020. End Sub
  2021.  
  2022. Sub Delete()
  2023. If Not _Enabled Then Return
  2024. Dim Success As Boolean = DeleteTimerQueueTimer(IntPtr.Zero, Handle, IntPtr.Zero)
  2025.  
  2026. If Not Success AndAlso Not Marshal.GetLastWin32Error = 997 Then
  2027. ThrowNewException("DeleteTimerQueueTimer")
  2028. End If
  2029.  
  2030. _Enabled = Not Success
  2031. End Sub
  2032.  
  2033. Private Sub ThrowNewException(ByVal name As String)
  2034. Throw New Exception(String.Format("{0} failed. Win32Error: {1}", name, Marshal.GetLastWin32Error))
  2035. End Sub
  2036.  
  2037. Public Sub Dispose() Implements IDisposable.Dispose
  2038. Delete()
  2039. End Sub
  2040. End Class
  2041. #End Region
  2042.  
  2043. ' ------------------
  2044. ' Creator: The Elite Noob
  2045. ' Created: 3-12-11
  2046. ' Version: 2.0.0
  2047. ' ThemeBase: 1.5.4 (by Aeonhack)
  2048. '------------------
  2049. Class eliteTheme
  2050. Inherits ThemeContainer154
  2051.  
  2052. Public Sub New()
  2053. MyBase.New()
  2054. BackColor = Color.FromArgb(42, 42, 42)
  2055. ' Background Color
  2056. TransparencyKey = Color.Purple
  2057. ' The Color used for Transparent
  2058. SetColor("Background", 42, 42, 42)
  2059. ' Background Color
  2060. SetColor("DarkGradient", 32, 32, 32)
  2061. ' Used to Make a Gradient
  2062. SetColor("BackgroundGradient", 42, 42, 42)
  2063. ' Used to make a Gradient
  2064. SetColor("Line1", 42, 42, 42)
  2065. ' First Line Color
  2066. SetColor("Line2", 28, 28, 28)
  2067. ' Second Line Color
  2068. SetColor("Text", 254, 254, 254)
  2069. ' Text Color
  2070. SetColor("Border1", 43, 43, 43)
  2071. ' First Border
  2072. SetColor("Border2", 25, 25, 25)
  2073. ' Second Borders
  2074. End Sub
  2075.  
  2076. ' Declare some Variables
  2077. ' The Letter is Variable type, while the number is what color it is
  2078. Private C1 As Color
  2079.  
  2080. Private C2 As Color
  2081.  
  2082. Private C3 As Color
  2083.  
  2084. Private P1 As Pen
  2085.  
  2086. Private P2 As Pen
  2087.  
  2088. Private P3 As Pen
  2089.  
  2090. Private P4 As Pen
  2091.  
  2092. Private B1 As SolidBrush
  2093.  
  2094. Protected Overrides Sub ColorHook()
  2095. ' Function by Aeonhack
  2096. C1 = GetColor("Background")
  2097. ' Get the Background Color
  2098. C2 = GetColor("DarkGradient")
  2099. ' Get the Dark Gradient
  2100. C3 = GetColor("BackgroundGradient")
  2101. ' The Light Gradient
  2102. P1 = New Pen(GetColor("Line1"))
  2103. ' Create a Pen for the Line
  2104. P2 = New Pen(GetColor("Line2"))
  2105. P3 = New Pen(GetColor("Border1"))
  2106. ' Create a Pen for the Border
  2107. P4 = New Pen(GetColor("Border2"))
  2108. B1 = New SolidBrush(GetColor("Text"))
  2109. ' Set up a brush for the Text
  2110. BackColor = C1
  2111. ' Create a Second Variable for The Background Color
  2112. End Sub
  2113.  
  2114. Protected Overrides Sub PaintHook()
  2115. ' Actually Create the Form, by Aeonhack
  2116. G.Clear(C1)
  2117. ' Clear the Form with the Basic Color
  2118. DrawGradient(C3, C2, 0, 0, Width, 25)
  2119. ' Draw the Background Gradient
  2120. G.DrawLine(P1, 0, 25, Width, 25)
  2121. ' Draw the Separtor for the Bar
  2122. G.DrawLine(P2, 0, 25, Width, 25)
  2123. DrawText(B1, HorizontalAlignment.Left, 5, 0)
  2124. ' Draw the Title Text
  2125. DrawBorders(P3, 1)
  2126. ' Creating the Inner Border
  2127. DrawBorders(P4)
  2128. ' Create the Outer Border
  2129. DrawCorners(TransparencyKey)
  2130. ' Create a Corner with the Transparent Key
  2131. End Sub
  2132. End Class
  2133.  
  2134. ' All Code from Here on is 100% Orignial and by The Elite Noob @ Hackforums
  2135.  
  2136. Class eliteButton
  2137. Inherits ThemeControl154
  2138.  
  2139. Public Sub New()
  2140. MyBase.New()
  2141. SetColor("DownGradient1", 42, 42, 42)
  2142. ' Basic Gradients Used to Shade the Button
  2143. SetColor("DownGradient2", 50, 50, 50)
  2144. ' The Gradients are reversed, depending on if Button is Pressed or not
  2145. SetColor("NoneGradient1", 50, 50, 50)
  2146. SetColor("NoneGradient2", 42, 42, 42)
  2147. SetColor("ClickedGradient1", 47, 47, 47)
  2148. SetColor("ClickedGradient2", 39, 39, 39)
  2149. SetColor("Text", 254, 254, 254)
  2150. ' The Color for the Text
  2151. SetColor("Border1", 35, 35, 35)
  2152. ' The Inside Border
  2153. SetColor("Border2", 42, 42, 42)
  2154. ' The Outside Border
  2155. End Sub
  2156.  
  2157. Private C1 As Color
  2158.  
  2159. ' Set up Simple Colors
  2160. Private C2 As Color
  2161.  
  2162. Private C3 As Color
  2163.  
  2164. Private C4 As Color
  2165.  
  2166. Private C5 As Color
  2167.  
  2168. Private C6 As Color
  2169.  
  2170. Private B1 As SolidBrush
  2171.  
  2172. ' A Brush to use text
  2173. Private P1 As Pen
  2174.  
  2175. ' A Pen used to create borders
  2176. Private P2 As Pen
  2177.  
  2178. Protected Overrides Sub ColorHook()
  2179. ' Basic Function by Aeonhack
  2180. C1 = GetColor("DownGradient1")
  2181. ' Get the Colors for the Button Shading
  2182. C2 = GetColor("DownGradient2")
  2183. C3 = GetColor("NoneGradient1")
  2184. C4 = GetColor("NoneGradient2")
  2185. C5 = GetColor("ClickedGradient1")
  2186. C6 = GetColor("ClickedGradient2")
  2187. B1 = New SolidBrush(GetColor("Text"))
  2188. ' Set up Color for the Text
  2189. P1 = New Pen(GetColor("Border1"))
  2190. ' Get and create the borders for the Buttons
  2191. P2 = New Pen(GetColor("Border2"))
  2192. End Sub
  2193.  
  2194. Protected Overrides Sub PaintHook()
  2195. ' Basic Function by Aeonhack
  2196. If (State = MouseState.Over) Then
  2197. ' Used to see if button is Hovered over
  2198. DrawGradient(C1, C2, ClientRectangle, 90.0!)
  2199. ' if button is hovered over
  2200. ElseIf (State = MouseState.Down) Then
  2201. DrawGradient(C6, C5, ClientRectangle, 90.0!)
  2202. Else
  2203. DrawGradient(C3, C4, ClientRectangle, 90.0!)
  2204. ' else change the shading
  2205. End If
  2206. DrawText(B1, HorizontalAlignment.Center, 0, 0)
  2207. ' Draw the Text Smack dab in the middle of the button
  2208. DrawBorders(P1, 1)
  2209. ' Create the Inner Border
  2210. DrawBorders(P2)
  2211. ' Create the Outer Border
  2212. DrawCorners(BackColor)
  2213. ' Draw the Corners
  2214. End Sub
  2215. End Class
  2216.  
  2217. Class eliteLabel
  2218. Inherits ThemeControl154
  2219.  
  2220. Public Sub New()
  2221. MyBase.New()
  2222. ' Create a Label
  2223. SetColor("Text", 254, 254, 254)
  2224. ' Text Color for Label
  2225. SetColor("Background", 42, 42, 42)
  2226. ' Background Color
  2227. End Sub
  2228.  
  2229. Private C1 As Color
  2230.  
  2231. ' used for the Basic Background of the Label
  2232. Private B1 As SolidBrush
  2233.  
  2234. ' The Main Color of the Text, Is painted on with a brush
  2235. Protected Overrides Sub ColorHook()
  2236. ' Assigning the colors to variables
  2237. C1 = GetColor("Background")
  2238. ' Get the Background Color
  2239. B1 = New SolidBrush(GetColor("Text"))
  2240. ' Set up Color for the Text
  2241. End Sub
  2242.  
  2243. Protected Overrides Sub PaintHook()
  2244. G.Clear(C1)
  2245. ' Clear the Color of Background
  2246. DrawText(B1, HorizontalAlignment.Center, 0, 0)
  2247. ' Align Text In Center of Label
  2248. End Sub
  2249. End Class
  2250.  
  2251. Class eliteBorderLabel
  2252. Inherits ThemeControl154
  2253.  
  2254. Public Sub New()
  2255. MyBase.New()
  2256. SetColor("DownGradient1", 42, 42, 42)
  2257. ' Basic Gradients Used to Shade the Button
  2258. SetColor("DownGradient2", 42, 42, 42)
  2259. ' The Gradients are reversed, depending on if Button is Pressed or not
  2260. SetColor("Text", 254, 254, 254)
  2261. ' The Color for the Text
  2262. SetColor("Border1", 35, 35, 35)
  2263. ' The Inside Border
  2264. SetColor("Border2", 42, 42, 42)
  2265. ' The Outside Border
  2266. End Sub
  2267.  
  2268. Private C1 As Color
  2269.  
  2270. ' Set up Simple Colors
  2271. Private C2 As Color
  2272.  
  2273. Private B1 As SolidBrush
  2274.  
  2275. ' A Brush to use text
  2276. Private P1 As Pen
  2277.  
  2278. ' A Pen used to create borders
  2279. Private P2 As Pen
  2280.  
  2281. Protected Overrides Sub ColorHook()
  2282. ' Assign Variables
  2283. C1 = GetColor("DownGradient1")
  2284. ' Get the Colors for the Button Shading
  2285. C2 = GetColor("DownGradient2")
  2286. B1 = New SolidBrush(GetColor("Text"))
  2287. ' Set up Color for the Text
  2288. P1 = New Pen(GetColor("Border1"))
  2289. ' Get and create the borders for the Buttons
  2290. P2 = New Pen(GetColor("Border2"))
  2291. End Sub
  2292.  
  2293. Protected Overrides Sub PaintHook()
  2294. ' Draw Custom Label
  2295. DrawGradient(C1, C2, ClientRectangle, 90.0!)
  2296. ' if button is pressed
  2297. DrawText(B1, HorizontalAlignment.Center, 0, 0)
  2298. ' Draw the Text Smack dab in the middle of the button
  2299. DrawBorders(P1, 1)
  2300. ' Create the Inner Border
  2301. DrawBorders(P2)
  2302. ' Create the Outer Border
  2303. DrawCorners(BackColor)
  2304. ' Draw the Corners
  2305. End Sub
  2306. End Class
  2307.  
  2308. Class eliteHide
  2309. Inherits ThemeControl154
  2310.  
  2311. Public Property WindowState As FormWindowState
  2312.  
  2313. Public Sub New()
  2314. MyBase.New()
  2315. SetColor("DownGradient1", 140, 138, 27)
  2316. ' Basic Gradients Used to Shade the Button
  2317. SetColor("DownGradient2", 180, 196, 114)
  2318. ' The Gradients are reversed, depending on if Button is Pressed or not
  2319. SetColor("NoneGradient1", 50, 50, 50)
  2320. SetColor("NoneGradient2", 42, 42, 42)
  2321. SetColor("ClickedGradient1", 204, 201, 35)
  2322. SetColor("ClickedGradient2", 140, 138, 27)
  2323. SetColor("Text", 254, 254, 254)
  2324. ' The Color for the Text
  2325. SetColor("Border1", 35, 35, 35)
  2326. ' The Inside Border
  2327. SetColor("Border2", 42, 42, 42)
  2328. ' The Outside Border
  2329. End Sub
  2330.  
  2331. Private C1 As Color
  2332.  
  2333. ' Set up Simple Colors
  2334. Private C2 As Color
  2335.  
  2336. Private C3 As Color
  2337.  
  2338. Private C4 As Color
  2339.  
  2340. Private C5 As Color
  2341.  
  2342. Private C6 As Color
  2343.  
  2344. Private B1 As SolidBrush
  2345.  
  2346. ' A Brush to use text
  2347. Private P1 As Pen
  2348.  
  2349. ' A Pen used to create borders
  2350. Private P2 As Pen
  2351.  
  2352. Protected Overrides Sub ColorHook()
  2353. C1 = GetColor("DownGradient1")
  2354. ' Get the Colors for the Button Shading
  2355. C2 = GetColor("DownGradient2")
  2356. C3 = GetColor("NoneGradient1")
  2357. C4 = GetColor("NoneGradient2")
  2358. C5 = GetColor("ClickedGradient1")
  2359. C6 = GetColor("ClickedGradient2")
  2360. B1 = New SolidBrush(GetColor("Text"))
  2361. ' Set up Color for the Text
  2362. P1 = New Pen(GetColor("Border1"))
  2363. ' Get and create the borders for the Buttons
  2364. P2 = New Pen(GetColor("Border2"))
  2365. End Sub
  2366.  
  2367. Protected Overrides Sub PaintHook()
  2368. If (Me.State = MouseState.Over) Then
  2369. ' Used to see if button is Hovered over
  2370. DrawGradient(C1, C2, ClientRectangle, 90.0!)
  2371. ' if button is hovered over
  2372. Me.Text = "_"
  2373. ElseIf (Me.State = MouseState.Down) Then
  2374. DrawGradient(C6, C5, ClientRectangle, 90.0!)
  2375. Me.Text = "_"
  2376. Application.OpenForms(0).WindowState = FormWindowState.Minimized
  2377. Else
  2378. DrawGradient(C3, C4, ClientRectangle, 90.0!)
  2379. ' else change the shading
  2380. End If
  2381. DrawText(B1, HorizontalAlignment.Center, 0, 0)
  2382. ' Draw the Text Smack dab in the middle of the button
  2383. DrawBorders(P1, 1)
  2384. ' Create the Inner Border
  2385. DrawBorders(P2)
  2386. ' Create the Outer Border
  2387. DrawCorners(BackColor)
  2388. ' Draw the Corners
  2389. End Sub
  2390. End Class
  2391.  
  2392. Class eliteHideSecond
  2393. Inherits ThemeControl154
  2394.  
  2395. Public Sub New()
  2396. MyBase.New()
  2397. SetColor("DownGradient1", 140, 138, 27)
  2398. ' Basic Gradients Used to Shade the Button
  2399. SetColor("DownGradient2", 180, 196, 114)
  2400. ' The Gradients are reversed, depending on if Button is Pressed or not
  2401. SetColor("NoneGradient1", 50, 50, 50)
  2402. SetColor("NoneGradient2", 42, 42, 42)
  2403. SetColor("ClickedGradient1", 204, 201, 35)
  2404. SetColor("ClickedGradient2", 140, 138, 27)
  2405. SetColor("Text", 254, 254, 254)
  2406. ' The Color for the Text
  2407. SetColor("Border1", 35, 35, 35)
  2408. ' The Inside Border
  2409. SetColor("Border2", 42, 42, 42)
  2410. ' The Outside Border
  2411. End Sub
  2412.  
  2413. Private C1 As Color
  2414.  
  2415. ' Set up Simple Colors
  2416. Private C2 As Color
  2417.  
  2418. Private C3 As Color
  2419.  
  2420. Private C4 As Color
  2421.  
  2422. Private C5 As Color
  2423.  
  2424. Private C6 As Color
  2425.  
  2426. Private B1 As SolidBrush
  2427.  
  2428. ' A Brush to use text
  2429. Private P1 As Pen
  2430.  
  2431. ' A Pen used to create borders
  2432. Private P2 As Pen
  2433.  
  2434. Protected Overrides Sub ColorHook()
  2435. C1 = GetColor("DownGradient1")
  2436. ' Get the Colors for the Button Shading
  2437. C2 = GetColor("DownGradient2")
  2438. C3 = GetColor("NoneGradient1")
  2439. C4 = GetColor("NoneGradient2")
  2440. C5 = GetColor("ClickedGradient1")
  2441. C6 = GetColor("ClickedGradient2")
  2442. B1 = New SolidBrush(GetColor("Text"))
  2443. ' Set up Color for the Text
  2444. P1 = New Pen(GetColor("Border1"))
  2445. ' Get and create the borders for the Buttons
  2446. P2 = New Pen(GetColor("Border2"))
  2447. End Sub
  2448.  
  2449. Protected Overrides Sub PaintHook()
  2450. If (Me.State = MouseState.Over) Then
  2451. ' Used to see if button is Hovered over
  2452. DrawGradient(C1, C2, ClientRectangle, 90.0!)
  2453. ' if button is hovered over
  2454. Me.Text = "_"
  2455. ElseIf (Me.State = MouseState.Down) Then
  2456. DrawGradient(C6, C5, ClientRectangle, 90.0!)
  2457. Me.Text = "_"
  2458. Application.OpenForms(1).WindowState = FormWindowState.Minimized
  2459. Else
  2460. DrawGradient(C3, C4, ClientRectangle, 90.0!)
  2461. ' else change the shading
  2462. End If
  2463. DrawText(B1, HorizontalAlignment.Center, 0, 0)
  2464. ' Draw the Text Smack dab in the middle of the button
  2465. DrawBorders(P1, 1)
  2466. ' Create the Inner Border
  2467. DrawBorders(P2)
  2468. ' Create the Outer Border
  2469. DrawCorners(BackColor)
  2470. ' Draw the Corners
  2471. End Sub
  2472. End Class
  2473.  
  2474. Class eliteQuestion
  2475. Inherits ThemeControl154
  2476.  
  2477. Public Sub New()
  2478. MyBase.New()
  2479. SetColor("DownGradient1", 140, 138, 27)
  2480. ' Basic Gradients Used to Shade the Button
  2481. SetColor("DownGradient2", 180, 196, 114)
  2482. ' The Gradients are reversed, depending on if Button is Pressed or not
  2483. SetColor("NoneGradient1", 50, 50, 50)
  2484. SetColor("NoneGradient2", 42, 42, 42)
  2485. SetColor("ClickedGradient1", 204, 201, 35)
  2486. SetColor("ClickedGradient2", 140, 138, 27)
  2487. SetColor("Text", 254, 254, 254)
  2488. ' The Color for the Text
  2489. SetColor("Border1", 35, 35, 35)
  2490. ' The Inside Border
  2491. SetColor("Border2", 42, 42, 42)
  2492. ' The Outside Border
  2493. End Sub
  2494.  
  2495. Private C1 As Color
  2496.  
  2497. ' Set up Simple Colors
  2498. Private C2 As Color
  2499.  
  2500. Private C3 As Color
  2501.  
  2502. Private C4 As Color
  2503.  
  2504. Private C5 As Color
  2505.  
  2506. Private C6 As Color
  2507.  
  2508. Private B1 As SolidBrush
  2509.  
  2510. ' A Brush to use text
  2511. Private P1 As Pen
  2512.  
  2513. ' A Pen used to create borders
  2514. Private P2 As Pen
  2515.  
  2516. Protected Overrides Sub ColorHook()
  2517. C1 = GetColor("DownGradient1")
  2518. ' Get the Colors for the Button Shading
  2519. C2 = GetColor("DownGradient2")
  2520. C3 = GetColor("NoneGradient1")
  2521. C4 = GetColor("NoneGradient2")
  2522. C5 = GetColor("ClickedGradient1")
  2523. C6 = GetColor("ClickedGradient2")
  2524. B1 = New SolidBrush(GetColor("Text"))
  2525. ' Set up Color for the Text
  2526. P1 = New Pen(GetColor("Border1"))
  2527. ' Get and create the borders for the Buttons
  2528. P2 = New Pen(GetColor("Border2"))
  2529. End Sub
  2530.  
  2531. Protected Overrides Sub PaintHook()
  2532. If (Me.State = MouseState.Over) Then
  2533. ' Used to see if button is Hovered over
  2534. DrawGradient(C1, C2, ClientRectangle, 90.0!)
  2535. ' if button is hovered over
  2536. Me.Text = "?"
  2537. ElseIf (Me.State = MouseState.Down) Then
  2538. DrawGradient(C6, C5, ClientRectangle, 90.0!)
  2539. Me.Text = "?"
  2540. Else
  2541. DrawGradient(C3, C4, ClientRectangle, 90.0!)
  2542. ' else change the shading
  2543. End If
  2544. DrawText(B1, HorizontalAlignment.Center, 0, 0)
  2545. ' Draw the Text Smack dab in the middle of the button
  2546. DrawBorders(P1, 1)
  2547. ' Create the Inner Border
  2548. DrawBorders(P2)
  2549. ' Create the Outer Border
  2550. DrawCorners(BackColor)
  2551. ' Draw the Corners
  2552. End Sub
  2553. End Class
  2554.  
  2555. Class eliteClose
  2556. Inherits ThemeControl154
  2557.  
  2558. Public Sub New()
  2559. MyBase.New()
  2560. SetColor("DownGradient1", 210, 15, 13)
  2561. ' Basic Gradients Used to Shade the Button
  2562. SetColor("DownGradient2", 243, 97, 24)
  2563. ' The Gradients are reversed, depending on if Button is Pressed or not
  2564. SetColor("NoneGradient1", 50, 50, 50)
  2565. SetColor("NoneGradient2", 42, 42, 42)
  2566. SetColor("ClickedGradient1", 247, 127, 30)
  2567. SetColor("ClickedGradient2", 210, 15, 13)
  2568. SetColor("Text", 254, 254, 254)
  2569. ' The Color for the Text
  2570. SetColor("Border1", 35, 35, 35)
  2571. ' The Inside Border
  2572. SetColor("Border2", 42, 42, 42)
  2573. ' The Outside Border
  2574. End Sub
  2575.  
  2576. Private C1 As Color
  2577.  
  2578. ' Set up Simple Colors
  2579. Private C2 As Color
  2580.  
  2581. Private C3 As Color
  2582.  
  2583. Private C4 As Color
  2584.  
  2585. Private C5 As Color
  2586.  
  2587. Private C6 As Color
  2588.  
  2589. Private B1 As SolidBrush
  2590.  
  2591. ' A Brush to use text
  2592. Private P1 As Pen
  2593.  
  2594. ' A Pen used to create borders
  2595. Private P2 As Pen
  2596.  
  2597. Protected Overrides Sub ColorHook()
  2598. C1 = GetColor("DownGradient1")
  2599. ' Get the Colors for the Button Shading
  2600. C2 = GetColor("DownGradient2")
  2601. C3 = GetColor("NoneGradient1")
  2602. C4 = GetColor("NoneGradient2")
  2603. C5 = GetColor("ClickedGradient1")
  2604. C6 = GetColor("ClickedGradient2")
  2605. B1 = New SolidBrush(GetColor("Text"))
  2606. ' Set up Color for the Text
  2607. P1 = New Pen(GetColor("Border1"))
  2608. ' Get and create the borders for the Buttons
  2609. P2 = New Pen(GetColor("Border2"))
  2610. End Sub
  2611.  
  2612. Protected Overrides Sub PaintHook()
  2613. If (Me.State = MouseState.Over) Then
  2614. ' Used to see if button is Hovered over
  2615. DrawGradient(C1, C2, ClientRectangle, 90.0!)
  2616. ' if button is hovered over
  2617. Me.Text = "x"
  2618. ElseIf (Me.State = MouseState.Down) Then
  2619. DrawGradient(C6, C5, ClientRectangle, 90.0!)
  2620. Me.Text = "x"
  2621. Application.Exit()
  2622. Else
  2623. DrawGradient(C3, C4, ClientRectangle, 90.0!)
  2624. ' else change the shading
  2625. End If
  2626. DrawText(B1, HorizontalAlignment.Center, 0, 0)
  2627. ' Draw the Text Smack dab in the middle of the button
  2628. DrawBorders(P1, 1)
  2629. ' Create the Inner Border
  2630. DrawBorders(P2)
  2631. ' Create the Outer Border
  2632. DrawCorners(BackColor)
  2633. ' Draw the Corners
  2634. End Sub
  2635. End Class
  2636.  
  2637. Class eliteCloseSecond
  2638. Inherits ThemeControl154
  2639.  
  2640. Public Sub New()
  2641. MyBase.New()
  2642. SetColor("DownGradient1", 210, 15, 13)
  2643. ' Basic Gradients Used to Shade the Button
  2644. SetColor("DownGradient2", 243, 97, 24)
  2645. ' The Gradients are reversed, depending on if Button is Pressed or not
  2646. SetColor("NoneGradient1", 50, 50, 50)
  2647. SetColor("NoneGradient2", 42, 42, 42)
  2648. SetColor("ClickedGradient1", 247, 127, 30)
  2649. SetColor("ClickedGradient2", 210, 15, 13)
  2650. SetColor("Text", 254, 254, 254)
  2651. ' The Color for the Text
  2652. SetColor("Border1", 35, 35, 35)
  2653. ' The Inside Border
  2654. SetColor("Border2", 42, 42, 42)
  2655. ' The Outside Border
  2656. End Sub
  2657.  
  2658. Private C1 As Color
  2659.  
  2660. ' Set up Simple Colors
  2661. Private C2 As Color
  2662.  
  2663. Private C3 As Color
  2664.  
  2665. Private C4 As Color
  2666.  
  2667. Private C5 As Color
  2668.  
  2669. Private C6 As Color
  2670.  
  2671. Private B1 As SolidBrush
  2672.  
  2673. ' A Brush to use text
  2674. Private P1 As Pen
  2675.  
  2676. ' A Pen used to create borders
  2677. Private P2 As Pen
  2678.  
  2679. Protected Overrides Sub ColorHook()
  2680. C1 = GetColor("DownGradient1")
  2681. ' Get the Colors for the Button Shading
  2682. C2 = GetColor("DownGradient2")
  2683. C3 = GetColor("NoneGradient1")
  2684. C4 = GetColor("NoneGradient2")
  2685. C5 = GetColor("ClickedGradient1")
  2686. C6 = GetColor("ClickedGradient2")
  2687. B1 = New SolidBrush(GetColor("Text"))
  2688. ' Set up Color for the Text
  2689. P1 = New Pen(GetColor("Border1"))
  2690. ' Get and create the borders for the Buttons
  2691. P2 = New Pen(GetColor("Border2"))
  2692. End Sub
  2693.  
  2694. Protected Overrides Sub PaintHook()
  2695. If (Me.State = MouseState.Over) Then
  2696. ' Used to see if button is Hovered over
  2697. DrawGradient(C1, C2, ClientRectangle, 90.0!)
  2698. ' if button is hovered over
  2699. Me.Text = "x"
  2700. ElseIf (Me.State = MouseState.Down) Then
  2701. DrawGradient(C6, C5, ClientRectangle, 90.0!)
  2702. Me.Text = "x"
  2703. Else
  2704. DrawGradient(C3, C4, ClientRectangle, 90.0!)
  2705. ' else change the shading
  2706. End If
  2707. DrawText(B1, HorizontalAlignment.Center, 0, 0)
  2708. ' Draw the Text Smack dab in the middle of the button
  2709. DrawBorders(P1, 1)
  2710. ' Create the Inner Border
  2711. DrawBorders(P2)
  2712. ' Create the Outer Border
  2713. DrawCorners(BackColor)
  2714. ' Draw the Corners
  2715. End Sub
  2716. End Class
  2717.  
  2718. Class eliteMaximize
  2719. Inherits ThemeControl154
  2720.  
  2721. Public Property WindowState As FormWindowState
  2722.  
  2723. Public Sub New()
  2724. MyBase.New()
  2725. SetColor("DownGradient1", 140, 138, 27)
  2726. ' Basic Gradients Used to Shade the Button
  2727. SetColor("DownGradient2", 180, 196, 114)
  2728. ' The Gradients are reversed, depending on if Button is Pressed or not
  2729. SetColor("NoneGradient1", 50, 50, 50)
  2730. SetColor("NoneGradient2", 42, 42, 42)
  2731. SetColor("ClickedGradient1", 204, 201, 35)
  2732. SetColor("ClickedGradient2", 140, 138, 27)
  2733. SetColor("Text", 254, 254, 254)
  2734. ' The Color for the Text
  2735. SetColor("Border1", 35, 35, 35)
  2736. ' The Inside Border
  2737. SetColor("Border2", 42, 42, 42)
  2738. ' The Outside Border
  2739. End Sub
  2740.  
  2741. Private C1 As Color
  2742.  
  2743. ' Set up Simple Colors
  2744. Private C2 As Color
  2745.  
  2746. Private C3 As Color
  2747.  
  2748. Private C4 As Color
  2749.  
  2750. Private C5 As Color
  2751.  
  2752. Private C6 As Color
  2753.  
  2754. Private B1 As SolidBrush
  2755.  
  2756. ' A Brush to use text
  2757. Private P1 As Pen
  2758.  
  2759. ' A Pen used to create borders
  2760. Private P2 As Pen
  2761.  
  2762. Protected Overrides Sub ColorHook()
  2763. C1 = GetColor("DownGradient1")
  2764. ' Get the Colors for the Button Shading
  2765. C2 = GetColor("DownGradient2")
  2766. C3 = GetColor("NoneGradient1")
  2767. C4 = GetColor("NoneGradient2")
  2768. C5 = GetColor("ClickedGradient1")
  2769. C6 = GetColor("ClickedGradient2")
  2770. B1 = New SolidBrush(GetColor("Text"))
  2771. ' Set up Color for the Text
  2772. P1 = New Pen(GetColor("Border1"))
  2773. ' Get and create the borders for the Buttons
  2774. P2 = New Pen(GetColor("Border2"))
  2775. End Sub
  2776.  
  2777. Protected Overrides Sub PaintHook()
  2778. If (Me.State = MouseState.Over) Then
  2779. ' Used to see if button is Hovered over
  2780. DrawGradient(C1, C2, ClientRectangle, 90.0!)
  2781. ' if button is hovered over
  2782. If (Application.OpenForms(0).WindowState = FormWindowState.Normal) Then
  2783. Me.Text = "+"
  2784. ElseIf (Application.OpenForms(0).WindowState = FormWindowState.Maximized) Then
  2785. Me.Text = "-"
  2786. End If
  2787. ElseIf (Me.State = MouseState.Down) Then
  2788. DrawGradient(C6, C5, ClientRectangle, 90.0!)
  2789. If (Application.OpenForms(0).WindowState = FormWindowState.Normal) Then
  2790. Me.Text = "+"
  2791. System.Threading.Thread.Sleep(100)
  2792. Application.OpenForms(0).WindowState = FormWindowState.Maximized
  2793. Me.Text = "-"
  2794. ElseIf (Application.OpenForms(0).WindowState = FormWindowState.Maximized) Then
  2795. Me.Text = "-"
  2796. System.Threading.Thread.Sleep(100)
  2797. Application.OpenForms(0).WindowState = FormWindowState.Normal
  2798. Me.Text = "+"
  2799. End If
  2800. Else
  2801. DrawGradient(C3, C4, ClientRectangle, 90.0!)
  2802. ' else change the shading
  2803. End If
  2804. DrawText(B1, HorizontalAlignment.Center, 0, 0)
  2805. ' Draw the Text Smack dab in the middle of the button
  2806. DrawBorders(P1, 1)
  2807. ' Create the Inner Border
  2808. DrawBorders(P2)
  2809. ' Create the Outer Border
  2810. DrawCorners(BackColor)
  2811. ' Draw the Corners
  2812. End Sub
  2813. End Class
  2814.  
  2815. Class eliteSeparatorHorizontal
  2816. Inherits ThemeControl154
  2817.  
  2818. Public Sub New()
  2819. MyBase.New()
  2820. SetColor("DownGradient1", 42, 42, 42)
  2821. ' Basic Gradients Used to Shade the Button
  2822. SetColor("DownGradient2", 42, 42, 42)
  2823. ' The Gradients are reversed, depending on if Button is Pressed or not
  2824. SetColor("Border1", 35, 35, 35)
  2825. ' The Inside Border
  2826. SetColor("Border2", 42, 42, 42)
  2827. ' The Outside Border
  2828. End Sub
  2829.  
  2830. Private C1 As Color
  2831.  
  2832. ' Set up Simple Colors
  2833. Private C2 As Color
  2834.  
  2835. Private P1 As Pen
  2836.  
  2837. ' A Pen used to create borders
  2838. Private P2 As Pen
  2839.  
  2840. Protected Overrides Sub ColorHook()
  2841. ' Assign Variables
  2842. C1 = GetColor("DownGradient1")
  2843. ' Get the Colors for the Button Shading
  2844. C2 = GetColor("DownGradient2")
  2845. P1 = New Pen(GetColor("Border1"))
  2846. ' Get and create the borders for the Buttons
  2847. P2 = New Pen(GetColor("Border2"))
  2848. End Sub
  2849.  
  2850. Protected Overrides Sub PaintHook()
  2851. ' Draw Custom Label
  2852. DrawGradient(C1, C2, ClientRectangle, 90.0!)
  2853. ' if button is pressed
  2854. DrawBorders(P1, 1)
  2855. ' Create the Inner Border
  2856. DrawBorders(P2)
  2857. ' Create the Outer Border
  2858. DrawCorners(BackColor)
  2859. ' Draw the Corners
  2860. End Sub
  2861.  
  2862. Protected Overrides Sub SetBoundsCore(ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal specified As BoundsSpecified)
  2863. ' EDIT: ADD AN EXTRA HEIGHT VALIDATION TO AVOID INITIALIZATION PROBLEMS
  2864. ' BITWISE 'AND' OPERATION: IF ZERO THEN HEIGHT IS NOT INVOLVED IN THIS OPERATION
  2865. If (((specified And BoundsSpecified.Height) _
  2866. = 0) _
  2867. OrElse (height = 4)) Then
  2868. MyBase.SetBoundsCore(x, y, width, 4, specified)
  2869. Else
  2870. Return
  2871. ' RETURN WITHOUT DOING ANY RESIZING
  2872. End If
  2873. End Sub
  2874. End Class
  2875.  
  2876. Class eliteSeparatorVertical
  2877. Inherits ThemeControl154
  2878.  
  2879. Public Sub New()
  2880. MyBase.New()
  2881. SetColor("DownGradient1", 42, 42, 42)
  2882. ' Basic Gradients Used to Shade the Button
  2883. SetColor("DownGradient2", 42, 42, 42)
  2884. ' The Gradients are reversed, depending on if Button is Pressed or not
  2885. SetColor("Border1", 35, 35, 35)
  2886. ' The Inside Border
  2887. SetColor("Border2", 42, 42, 42)
  2888. ' The Outside Border
  2889. End Sub
  2890.  
  2891. Private C1 As Color
  2892.  
  2893. ' Set up Simple Colors
  2894. Private C2 As Color
  2895.  
  2896. Private P1 As Pen
  2897.  
  2898. ' A Pen used to create borders
  2899. Private P2 As Pen
  2900.  
  2901. Protected Overrides Sub ColorHook()
  2902. ' Assign Variables
  2903. C1 = GetColor("DownGradient1")
  2904. ' Get the Colors for the Button Shading
  2905. C2 = GetColor("DownGradient2")
  2906. P1 = New Pen(GetColor("Border1"))
  2907. ' Get and create the borders for the Buttons
  2908. P2 = New Pen(GetColor("Border2"))
  2909. End Sub
  2910.  
  2911. Protected Overrides Sub PaintHook()
  2912. ' Draw Custom Label
  2913. DrawGradient(C1, C2, ClientRectangle, 90.0!)
  2914. ' if button is pressed
  2915. DrawBorders(P1, 1)
  2916. ' Create the Inner Border
  2917. DrawBorders(P2)
  2918. ' Create the Outer Border
  2919. DrawCorners(BackColor)
  2920. ' Draw the Corners
  2921. End Sub
  2922.  
  2923. Protected Overrides Sub SetBoundsCore(ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal specified As BoundsSpecified)
  2924. ' EDIT: ADD AN EXTRA HEIGHT VALIDATION TO AVOID INITIALIZATION PROBLEMS
  2925. ' BITWISE 'AND' OPERATION: IF ZERO THEN HEIGHT IS NOT INVOLVED IN THIS OPERATION
  2926. If (((specified And BoundsSpecified.Width) _
  2927. = 0) _
  2928. OrElse (width = 4)) Then
  2929. MyBase.SetBoundsCore(x, y, 4, height, specified)
  2930. Else
  2931. Return
  2932. ' RETURN WITHOUT DOING ANY RESIZING
  2933. End If
  2934. End Sub
  2935. End Class
  2936.  
  2937. 'This is used to see if it is a checkbox and so on.
  2938. <DefaultEvent("CheckedChanged")> _
  2939. Class eliteCheckBox
  2940. Inherits ThemeControl154
  2941.  
  2942. Public Sub New()
  2943. MyBase.New()
  2944. Transparent = True
  2945. ' it is infact transpernt
  2946. BackColor = Color.Transparent
  2947. ' no lockheight since that way they can choose how they want it.
  2948. ' no text since i want the user to choose wether or not they want check, also, that way the border doesn't go around it.
  2949. SetColor("Background", 249, 249, 249)
  2950. ' Background is Dark
  2951. SetColor("ClickedGradient1", 204, 201, 35)
  2952. ' the green graident on the inside.
  2953. SetColor("ClickedGradient2", 140, 138, 27)
  2954. SetColor("Border1", 235, 235, 235)
  2955. ' The Inside Border
  2956. SetColor("Border2", 249, 249, 249)
  2957. ' The Outside Border
  2958. End Sub
  2959.  
  2960. ' set up the variables
  2961. Private C1 As Color
  2962.  
  2963. ' Set up Simple Colors
  2964. Private C2 As Color
  2965.  
  2966. Private C3 As Color
  2967.  
  2968. Private P1 As Pen
  2969.  
  2970. ' A Pen used to create borders
  2971. Private P2 As Pen
  2972.  
  2973. Protected Overrides Sub ColorHook()
  2974. C1 = GetColor("Background")
  2975. ' Get the Colors for the Button Shading
  2976. C2 = GetColor("ClickedGradient1")
  2977. C3 = GetColor("ClickedGradient2")
  2978. P1 = New Pen(GetColor("Border1"))
  2979. ' Get and create the borders for the Buttons
  2980. P2 = New Pen(GetColor("Border2"))
  2981. End Sub
  2982.  
  2983. Protected Overrides Sub PaintHook()
  2984. G.Clear(BackColor)
  2985. Select Case (_Checked)
  2986. Case True
  2987. 'Put your checked state here
  2988. DrawGradient(C1, C1, ClientRectangle, 90.0!)
  2989. ' checked background
  2990. DrawGradient(C2, C3, 3, 3, (Me.Width - 6), (Me.Height - 6), 90.0!)
  2991. ' checked background
  2992. DrawBorders(P1, 1)
  2993. ' Create the Inner Border
  2994. Me.Height = Me.Width
  2995. DrawBorders(P2)
  2996. ' Create the Outer Border
  2997. DrawCorners(BackColor)
  2998. ' Draw the Corners
  2999. Case False
  3000. 'Put your unchecked state here
  3001. DrawGradient(C1, C1, ClientRectangle, 90.0!)
  3002. ' unchecked background
  3003. DrawBorders(P1, 1)
  3004. ' Create the Inner Border
  3005. Me.Height = Me.Width
  3006. DrawBorders(P2)
  3007. ' Create the Outer Border
  3008. DrawCorners(BackColor)
  3009. ' Draw the Corners
  3010. End Select
  3011. End Sub
  3012.  
  3013. Private Property _Checked As Boolean
  3014.  
  3015. Public Property Checked As Boolean
  3016. Get
  3017. Return _Checked
  3018. End Get
  3019. Set(value As Boolean)
  3020. _Checked = value
  3021. End Set
  3022. End Property
  3023.  
  3024. Protected Overrides Sub OnClick(ByVal e As System.EventArgs)
  3025. _Checked = Not _Checked
  3026. RaiseEvent CheckedChanged(Me)
  3027. MyBase.OnClick(e)
  3028. End Sub
  3029.  
  3030. Public Event CheckedChanged As CheckedChangedEventHandler
  3031.  
  3032. Public Delegate Sub CheckedChangedEventHandler(ByVal sender As Object)
  3033. End Class
  3034.  
  3035. Class elitePanelBacking
  3036. Inherits UserControl
  3037.  
  3038. Private panelMain As Panel
  3039.  
  3040. Public Sub New()
  3041. MyBase.New()
  3042. InitializeComponent()
  3043. End Sub
  3044.  
  3045. Private Sub InitializeComponent()
  3046. Me.panelMain = New System.Windows.Forms.Panel
  3047. Me.SuspendLayout()
  3048. Dim Background As Color = Color.FromArgb(249, 249, 249)
  3049. '
  3050. ' panelMain
  3051. '
  3052. Me.panelMain.BackColor = Background
  3053. Me.panelMain.Dock = System.Windows.Forms.DockStyle.Fill
  3054. Me.panelMain.Location = New System.Drawing.Point(0, 0)
  3055. Me.panelMain.Name = "elitePanelMainBacking"
  3056. Me.panelMain.Size = New System.Drawing.Size(150, 150)
  3057. Me.panelMain.TabIndex = 0
  3058. '
  3059. ' myPanel
  3060. '
  3061. Me.Controls.Add(Me.panelMain)
  3062. Me.Name = "elitePanelBacking"
  3063. Me.ResumeLayout(False)
  3064. End Sub
  3065. End Class
  3066.  
  3067. Public Class eliteGroupBox
  3068. Inherits UserControl
  3069.  
  3070. Private panelMain As GroupBox
  3071.  
  3072. Public Sub New()
  3073. MyBase.New()
  3074. InitializeComponent()
  3075. End Sub
  3076.  
  3077. Private Sub InitializeComponent()
  3078. Me.panelMain = New System.Windows.Forms.GroupBox
  3079. Me.SuspendLayout()
  3080. Dim Background As Color = Color.FromArgb(42, 42, 42)
  3081. '
  3082. ' panelMain
  3083. '
  3084. Me.panelMain.BackColor = Background
  3085. Me.panelMain.Dock = System.Windows.Forms.DockStyle.Fill
  3086. Me.panelMain.Location = New System.Drawing.Point(0, 0)
  3087. Me.panelMain.Name = "eliteGroupBoxMain"
  3088. Me.panelMain.Size = New System.Drawing.Size(140, 140)
  3089. Me.panelMain.TabIndex = 0
  3090. '
  3091. ' myPanel
  3092. '
  3093. Me.Controls.Add(Me.panelMain)
  3094. Me.Name = "eliteGroupBox"
  3095. Me.ResumeLayout(False)
  3096. End Sub
  3097. End Class
Advertisement
Add Comment
Please, Sign In to add comment