Guest User

Untitled

a guest
Jul 11th, 2012
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 167.10 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
  3098.  
  3099. '###genesisTheme###
  3100.  
  3101. #Region "Enums for Options"
  3102. Public Enum MultiColor
  3103. Black = 0
  3104. Green = 1
  3105. Blue = 2
  3106. Pink = 3
  3107. End Enum
  3108.  
  3109. Public Enum HoverOptions
  3110. Green = 0
  3111. Blue = 1
  3112. Pink = 2
  3113. End Enum
  3114.  
  3115. Public Enum HatchColors
  3116. White = 0
  3117. Green = 1
  3118. Blue = 2
  3119. Pink = 3
  3120. End Enum
  3121.  
  3122. Public Enum IsHatched
  3123. Yes = 0
  3124. No = 1
  3125. End Enum
  3126. #End Region
  3127.  
  3128. #Region "Theme"
  3129. Class genesisTheme
  3130. Inherits ThemeContainer154
  3131. ' White hatch color
  3132. #Region "Text Location"
  3133. Public Enum TextLocation
  3134. Left = 0
  3135. 'if there isn't an icon
  3136. LeftIcon = 1
  3137. 'if there is an icon
  3138. Center = 2
  3139. CenterIcon = 3
  3140. End Enum
  3141.  
  3142. Private _location As TextLocation
  3143.  
  3144. Public Property TextPlacement() As TextLocation
  3145. Get
  3146. Return Me._location
  3147. End Get
  3148. Set(value As TextLocation)
  3149. Me._location = value
  3150. Invalidate()
  3151. End Set
  3152. End Property
  3153.  
  3154. Private _textcolor As MultiColor
  3155.  
  3156. Public Property TextColor() As MultiColor
  3157. Get
  3158. Return Me._textcolor
  3159. End Get
  3160. Set(value As MultiColor)
  3161. Me._textcolor = value
  3162. Invalidate()
  3163. End Set
  3164. End Property
  3165.  
  3166. #End Region
  3167.  
  3168. #Region "Hatch Options"
  3169. Private _color As HatchColors
  3170.  
  3171. Public Property CurrentColor() As HatchColors
  3172. Get
  3173. Return Me._color
  3174. End Get
  3175. Set(value As HatchColors)
  3176. Me._color = value
  3177. Invalidate()
  3178. End Set
  3179. End Property
  3180.  
  3181. Private _yesno As IsHatched
  3182.  
  3183. Public Property HatchONOff() As IsHatched
  3184. Get
  3185. Return Me._yesno
  3186. End Get
  3187. Set(value As IsHatched)
  3188. Me._yesno = value
  3189. Invalidate()
  3190. End Set
  3191. End Property
  3192. #End Region
  3193.  
  3194. #Region "IconSettings"
  3195. Private IconLocation As Icon
  3196. Public Property CustomIcon() As Icon
  3197. Get
  3198. Return IconLocation
  3199. End Get
  3200. Set(value As Icon)
  3201. IconLocation = value
  3202. End Set
  3203. End Property
  3204.  
  3205. Public Enum UseIcon
  3206. No = 0
  3207. Yes = 1
  3208. End Enum
  3209.  
  3210. Private _iconyesno As UseIcon
  3211.  
  3212. Public Property UseAnIcon() As UseIcon
  3213. Get
  3214. Return Me._iconyesno
  3215. End Get
  3216. Set(value As UseIcon)
  3217. Me._iconyesno = value
  3218. Invalidate()
  3219. End Set
  3220. End Property
  3221. #End Region
  3222.  
  3223. Public Sub New()
  3224. BackColor = Color.FromArgb(250, 250, 250)
  3225. SetColor("Back", 250, 250, 250)
  3226. SetColor("Gradient1", 254, 254, 254)
  3227. SetColor("Gradient2", 243, 243, 243)
  3228. SetColor("Border1", 240, 240, 240)
  3229. SetColor("Border2", 254, 254, 254)
  3230. SetColor("Border3", 200, 200, 200)
  3231. SetColor("Line1", 250, 250, 250)
  3232. SetColor("Line2", 240, 240, 240)
  3233. SetColor("Shade1", 70, Color.White)
  3234. SetColor("Shade2", Color.Transparent)
  3235. End Sub
  3236.  
  3237. Private C1 As Color
  3238. Private C2 As Color
  3239. Private C3 As Color
  3240. Private C4 As Color
  3241. Private C5 As Color
  3242. Private P1 As Pen
  3243. Private P2 As Pen
  3244. Private P3 As Pen
  3245. Private P4 As Pen
  3246. Private P5 As Pen
  3247. Private B1 As HatchBrush
  3248. Private B2 As SolidBrush
  3249.  
  3250. Protected Overrides Sub ColorHook()
  3251. C1 = GetColor("Back")
  3252. C2 = GetColor("Gradient1")
  3253. C3 = GetColor("Gradient2")
  3254. C4 = GetColor("Shade1")
  3255. C5 = GetColor("Shade2")
  3256. P1 = New Pen(GetColor("Border1"))
  3257. P2 = New Pen(GetColor("Line1"))
  3258. P3 = New Pen(GetColor("Line2"))
  3259. P4 = New Pen(GetColor("Border2"))
  3260. P5 = New Pen(GetColor("Border3"))
  3261. BackColor = C1
  3262. End Sub
  3263.  
  3264. Private RT1 As Rectangle
  3265. Protected Overrides Sub PaintHook()
  3266. G.Clear(C1)
  3267. RT1 = New Rectangle(1, 1, Width - 2, 22)
  3268. DrawGradient(C2, C3, RT1, 90.0F)
  3269. DrawBorders(P1, RT1)
  3270. G.DrawLine(P2, 0, 23, Width, 23)
  3271. Select Case _yesno
  3272. Case IsHatched.Yes
  3273. Select Case _color
  3274. Case HatchColors.White
  3275. SetColor("Hatch1", 254, 254, 254)
  3276. SetColor("Hatch2", 248, 248, 248)
  3277. B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch2"))
  3278. Exit Select
  3279. Case HatchColors.Blue
  3280. SetColor("Hatch1", 78, 205, 196)
  3281. SetColor("Hatch2", 72, 199, 190)
  3282. B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch2"))
  3283. Exit Select
  3284. Case HatchColors.Green
  3285. SetColor("Hatch1", 199, 244, 100)
  3286. SetColor("Hatch2", 193, 238, 94)
  3287. B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch2"))
  3288. Exit Select
  3289. Case HatchColors.Pink
  3290. SetColor("Hatch1", 255, 107, 107)
  3291. SetColor("Hatch2", 249, 101, 101)
  3292. B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch2"))
  3293. Exit Select
  3294. End Select
  3295. Exit Select
  3296. Case IsHatched.No
  3297. Select Case _color
  3298. Case HatchColors.White
  3299. SetColor("Hatch1", 254, 254, 254)
  3300. B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch1"))
  3301. Exit Select
  3302. Case HatchColors.Blue
  3303. SetColor("Hatch1", 78, 205, 196)
  3304. B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch1"))
  3305. Exit Select
  3306. Case HatchColors.Green
  3307. SetColor("Hatch1", 199, 244, 100)
  3308. B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch1"))
  3309. Exit Select
  3310. Case HatchColors.Pink
  3311. SetColor("Hatch1", 255, 107, 107)
  3312. SetColor("Hatch2", 249, 101, 101)
  3313. B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch1"))
  3314. Exit Select
  3315. End Select
  3316. Exit Select
  3317. End Select
  3318. Select Case _textcolor
  3319. Case MultiColor.Black
  3320. SetColor("Text", 24, 24, 24)
  3321. B2 = New SolidBrush(GetColor("Text"))
  3322. Exit Select
  3323. Case MultiColor.Blue
  3324. SetColor("Text", 78, 205, 196)
  3325. B2 = New SolidBrush(GetColor("Text"))
  3326. Exit Select
  3327. Case MultiColor.Green
  3328. SetColor("Text", 199, 244, 100)
  3329. B2 = New SolidBrush(GetColor("Text"))
  3330. Exit Select
  3331. Case MultiColor.Pink
  3332. SetColor("Text", 255, 107, 107)
  3333. B2 = New SolidBrush(GetColor("Text"))
  3334. Exit Select
  3335. End Select
  3336. G.FillRectangle(B1, 0, 24, Width, 13)
  3337. DrawGradient(C4, C5, 0, 24, Width, 6)
  3338. G.DrawLine(P3, 0, 37, Width, 37)
  3339. DrawBorders(P4, 1, 38, Width - 2, Height - 39)
  3340. Select Case _iconyesno
  3341. Case UseIcon.Yes
  3342. Dim ico As New Icon(IconLocation, New Size(16, 16))
  3343. Select Case _location
  3344. Case TextLocation.Left
  3345. DrawText(B2, HorizontalAlignment.Left, 1, -2)
  3346. Exit Select
  3347. Case TextLocation.LeftIcon
  3348. G.DrawIconUnstretched(DirectCast(ico, System.Drawing.Icon), RT1)
  3349. DrawText(B2, HorizontalAlignment.Left, 18, -2)
  3350. Exit Select
  3351. Case TextLocation.Center
  3352. DrawText(B2, HorizontalAlignment.Center, 0, -2)
  3353. Exit Select
  3354. Case TextLocation.CenterIcon
  3355. G.DrawIconUnstretched(DirectCast(ico, System.Drawing.Icon), RT1)
  3356. DrawText(B2, HorizontalAlignment.Center, 0, -2)
  3357. Exit Select
  3358. End Select
  3359. Exit Select
  3360. Case UseIcon.No
  3361. Select Case _location
  3362. Case TextLocation.Left
  3363. DrawText(B2, HorizontalAlignment.Left, 1, -2)
  3364. Exit Select
  3365. Case TextLocation.LeftIcon
  3366. DrawText(B2, HorizontalAlignment.Left, 1, -2)
  3367. Exit Select
  3368. Case TextLocation.Center
  3369. DrawText(B2, HorizontalAlignment.Center, 0, -2)
  3370. Exit Select
  3371. Case TextLocation.CenterIcon
  3372. DrawText(B2, HorizontalAlignment.Center, 0, -2)
  3373. Exit Select
  3374. End Select
  3375. Exit Select
  3376. End Select
  3377. DrawBorders(P5)
  3378. End Sub
  3379. End Class
  3380. #End Region
  3381.  
  3382. #Region "Button"
  3383. Class genesisButton
  3384. Inherits ThemeControl154
  3385.  
  3386. Private _color As MultiColor
  3387.  
  3388. Public Property CurrentColor() As MultiColor
  3389. Get
  3390. Return Me._color
  3391. End Get
  3392. Set(value As MultiColor)
  3393. Me._color = value
  3394. Invalidate()
  3395. End Set
  3396. End Property
  3397.  
  3398. Public Sub New()
  3399. SetColor("DownGradient1", 252, 252, 252)
  3400. SetColor("DownGradient2", 238, 238, 238)
  3401. SetColor("NoneGradient1", 240, 240, 240)
  3402. SetColor("NoneGradient2", 254, 254, 254)
  3403. SetColor("HoverGradient1", 238, 238, 238)
  3404. SetColor("HoverGradient2", 252, 252, 252)
  3405. SetColor("TextShade", 30, 35, 35, 35)
  3406. SetColor("Border1", 225, 225, 225)
  3407. SetColor("Border2", 235, 235, 235)
  3408. End Sub
  3409.  
  3410. Private C1 As Color
  3411. Private C2 As Color
  3412. Private C3 As Color
  3413. Private C4 As Color
  3414. Private C5 As Color
  3415. Private C6 As Color
  3416. Private B1 As SolidBrush
  3417. Private B2 As SolidBrush
  3418. Private P1 As Pen
  3419. Private P2 As Pen
  3420.  
  3421. Protected Overrides Sub ColorHook()
  3422. C1 = GetColor("DownGradient1")
  3423. C2 = GetColor("DownGradient2")
  3424. C3 = GetColor("NoneGradient1")
  3425. C4 = GetColor("NoneGradient2")
  3426. C5 = GetColor("HoverGradient1")
  3427. C6 = GetColor("HoverGradient2")
  3428. B1 = New SolidBrush(GetColor("TextShade"))
  3429. P1 = New Pen(GetColor("Border1"))
  3430. P2 = New Pen(GetColor("Border2"))
  3431. End Sub
  3432.  
  3433.  
  3434. Protected Overrides Sub PaintHook()
  3435. If State = MouseState.Down Then
  3436. DrawGradient(C2, C1, ClientRectangle, 90.0F)
  3437. ElseIf State = MouseState.Over Then
  3438. DrawGradient(C6, C5, ClientRectangle, 90.0F)
  3439. Else
  3440. DrawGradient(C4, C3, ClientRectangle, 90.0F)
  3441. End If
  3442. DrawBorders(P1, 1)
  3443. DrawBorders(P2)
  3444. DrawCorners(BackColor)
  3445. Select Case _color
  3446. Case MultiColor.Black
  3447. SetColor("Text", 24, 24, 24)
  3448. B2 = New SolidBrush(GetColor("Text"))
  3449. Exit Select
  3450. Case MultiColor.Blue
  3451. SetColor("Text", 78, 205, 196)
  3452. B2 = New SolidBrush(GetColor("Text"))
  3453. Exit Select
  3454. Case MultiColor.Green
  3455. SetColor("Text", 199, 244, 100)
  3456. B2 = New SolidBrush(GetColor("Text"))
  3457. Exit Select
  3458. Case MultiColor.Pink
  3459. SetColor("Text", 255, 107, 107)
  3460. B2 = New SolidBrush(GetColor("Text"))
  3461. Exit Select
  3462. End Select
  3463. DrawText(B1, HorizontalAlignment.Center, 1, 1)
  3464. DrawText(B2, HorizontalAlignment.Center, 0, 0)
  3465. End Sub
  3466.  
  3467. End Class
  3468. #End Region
  3469.  
  3470. #Region "Label"
  3471. Partial Public Class genesisLabel
  3472. Inherits Label
  3473.  
  3474. #Region "Public Constructors"
  3475.  
  3476. Private _color As MultiColor
  3477.  
  3478. Public Property CurrentColor() As MultiColor
  3479. Get
  3480. Return Me._color
  3481. End Get
  3482. Set(value As MultiColor)
  3483. Me._color = value
  3484. Invalidate()
  3485. End Set
  3486. End Property
  3487.  
  3488. Public Sub New()
  3489. Me.AutoSize = False
  3490. End Sub
  3491.  
  3492. #End Region
  3493.  
  3494. #Region "Protected Overridden Methods"
  3495.  
  3496. Protected Overrides Sub OnPaint(e As PaintEventArgs)
  3497. MyBase.OnPaint(e)
  3498. Select Case _color
  3499. Case MultiColor.Black
  3500. Me.ForeColor = Color.FromArgb(24, 24, 24)
  3501. Exit Select
  3502. Case MultiColor.Blue
  3503. Me.ForeColor = Color.FromArgb(78, 205, 196)
  3504. Exit Select
  3505. Case MultiColor.Green
  3506. Me.ForeColor = Color.FromArgb(199, 244, 100)
  3507. Exit Select
  3508. Case MultiColor.Pink
  3509. Me.ForeColor = Color.FromArgb(255, 107, 107)
  3510. Exit Select
  3511. End Select
  3512. End Sub
  3513.  
  3514. Protected Overrides Sub OnResize(e As EventArgs)
  3515. MyBase.OnResize(e)
  3516.  
  3517. Me.FitToContents()
  3518. End Sub
  3519.  
  3520. Protected Overrides Sub OnTextChanged(e As EventArgs)
  3521. MyBase.OnTextChanged(e)
  3522.  
  3523. Me.FitToContents()
  3524. End Sub
  3525.  
  3526. #End Region
  3527.  
  3528. #Region "Protected Virtual Methods"
  3529.  
  3530. Protected Overridable Sub FitToContents()
  3531. Dim size As Size
  3532.  
  3533. size = Me.GetPreferredSize(New Size(Me.Width, 0))
  3534.  
  3535. Me.Height = size.Height
  3536. End Sub
  3537.  
  3538. #End Region
  3539.  
  3540. #Region "Public Properties"
  3541.  
  3542. <DefaultValue(False), Browsable(False), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
  3543. Public Overrides Property AutoSize() As Boolean
  3544. Get
  3545. Return MyBase.AutoSize
  3546. End Get
  3547. Set(value As Boolean)
  3548. MyBase.AutoSize = value
  3549. End Set
  3550. End Property
  3551.  
  3552. #End Region
  3553. End Class
  3554. #End Region
  3555.  
  3556. #Region "Draw Class"
  3557. Public Class Draw
  3558. Public Shared Sub Gradient(g As Graphics, c1 As Color, c2 As Color, x As Integer, y As Integer, width As Integer, _
  3559. height As Integer)
  3560. Dim R As New Rectangle(x, y, width, height)
  3561. Using T As New LinearGradientBrush(R, c1, c2, LinearGradientMode.Vertical)
  3562. g.FillRectangle(T, R)
  3563. End Using
  3564. End Sub
  3565. Public Shared Sub Blend(g As Graphics, c1 As Color, c2 As Color, c3 As Color, c As Single, d As Integer, _
  3566. x As Integer, y As Integer, width As Integer, height As Integer)
  3567. Dim V As New ColorBlend(3)
  3568. V.Colors = New Color() {c1, c2, c3}
  3569. V.Positions = New Single() {0.0F, c, 1.0F}
  3570. Dim R As New Rectangle(x, y, width, height)
  3571. Using T As New LinearGradientBrush(R, c1, c1, DirectCast(d, LinearGradientMode))
  3572. T.InterpolationColors = V
  3573. g.FillRectangle(T, R)
  3574. End Using
  3575. End Sub
  3576. End Class
  3577. #End Region
  3578.  
  3579. #Region "Seperator"
  3580. Friend Class genesisSeperator
  3581. Inherits Control
  3582.  
  3583. Private _Orientation As Orientation
  3584. Public Property Orientation() As Orientation
  3585. Get
  3586. Return _Orientation
  3587. End Get
  3588. Set(value As Orientation)
  3589. _Orientation = value
  3590. UpdateOffset()
  3591. Invalidate()
  3592. End Set
  3593. End Property
  3594.  
  3595. Private G As Graphics
  3596. Private B As Bitmap
  3597. Private I As Integer
  3598. Private C1 As Color
  3599. Private P1 As Pen
  3600. Private P2 As Pen
  3601. Public Sub New()
  3602. SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint, True)
  3603. C1 = Color.FromArgb(250, 250, 250)
  3604. 'Background
  3605. P1 = New Pen(Color.FromArgb(230, 230, 230))
  3606. 'Shadow
  3607. 'Highlight
  3608. P2 = New Pen(Color.FromArgb(255, 255, 255))
  3609. End Sub
  3610.  
  3611. Protected Overrides Sub OnSizeChanged(e As EventArgs)
  3612. UpdateOffset()
  3613. MyBase.OnSizeChanged(e)
  3614. End Sub
  3615.  
  3616. Public Sub UpdateOffset()
  3617. I = Convert.ToInt32((If((_Orientation = 0), Height / 2 - 1, Width / 2 - 1)))
  3618. End Sub
  3619.  
  3620. Protected Overrides Sub OnPaint(e As PaintEventArgs)
  3621. B = New Bitmap(Width, Height)
  3622. G = Graphics.FromImage(B)
  3623.  
  3624. G.Clear(C1)
  3625.  
  3626. If _Orientation = 0 Then
  3627. G.DrawLine(P1, 0, I, Width, I)
  3628. G.DrawLine(P2, 0, I + 1, Width, I + 1)
  3629. Else
  3630. G.DrawLine(P2, I, 0, I, Height)
  3631. G.DrawLine(P1, I + 1, 0, I + 1, Height)
  3632. End If
  3633.  
  3634. e.Graphics.DrawImage(B, 0, 0)
  3635. G.Dispose()
  3636. B.Dispose()
  3637. End Sub
  3638.  
  3639. Protected Overrides Sub OnPaintBackground(pevent As PaintEventArgs)
  3640. End Sub
  3641.  
  3642. End Class
  3643. #End Region
  3644.  
  3645. #Region "Pigment"
  3646. Class Pigment
  3647. Public Property Name() As String
  3648. Get
  3649. Return m_Name
  3650. End Get
  3651. Set(value As String)
  3652. m_Name = Value
  3653. End Set
  3654. End Property
  3655. Private m_Name As String
  3656. Public Property Value() As Color
  3657. Get
  3658. Return m_Value
  3659. End Get
  3660. Set(value As Color)
  3661. m_Value = Value
  3662. End Set
  3663. End Property
  3664. Private m_Value As Color
  3665.  
  3666. Public Sub New()
  3667. End Sub
  3668.  
  3669. Public Sub New(n As String, v As Color)
  3670. Name = n
  3671. Value = v
  3672. End Sub
  3673.  
  3674. Public Sub New(n As String, a As Byte, r As Byte, g As Byte, b As Byte)
  3675. Name = n
  3676. Value = Color.FromArgb(a, r, g, b)
  3677. End Sub
  3678.  
  3679. Public Sub New(n As String, r As Byte, g As Byte, b As Byte)
  3680. Name = n
  3681. Value = Color.FromArgb(r, g, b)
  3682. End Sub
  3683. End Class
  3684. #End Region
  3685.  
  3686. #Region "Progress Bar"
  3687. Class genesisProgressBar
  3688. Inherits ThemeControl154
  3689. #Region "Properties"
  3690. Private _Maximum As Integer = 100
  3691. Public Property Maximum() As Integer
  3692. Get
  3693. Return _Maximum
  3694. End Get
  3695. Set(value As Integer)
  3696. If value < 1 Then
  3697. value = 1
  3698. End If
  3699.  
  3700. If value < _Value Then
  3701. _Value = value
  3702. End If
  3703.  
  3704. If _Maximum < _Minimum Then
  3705. _Minimum = value
  3706. End If
  3707.  
  3708. _Maximum = value
  3709. Invalidate()
  3710. End Set
  3711. End Property
  3712.  
  3713. Private _Minimum As Integer = 0
  3714. Public Property Minimum() As Integer
  3715. Get
  3716. Return _Minimum
  3717. End Get
  3718. Set(value As Integer)
  3719. If _Minimum > _Maximum Then
  3720. _Maximum = _Minimum
  3721. End If
  3722.  
  3723. If _Minimum > _Value Then
  3724. _Value = _Minimum
  3725. End If
  3726.  
  3727. _Minimum = value
  3728. Invalidate()
  3729. End Set
  3730. End Property
  3731.  
  3732. Private _Value As Integer = 0
  3733. Public Property Value() As Integer
  3734. Get
  3735. Return _Value
  3736. End Get
  3737. Set(value As Integer)
  3738. If value > _Maximum Then
  3739. value = _Maximum
  3740. End If
  3741.  
  3742. If value < _Minimum Then
  3743. value = _Minimum
  3744. End If
  3745.  
  3746. _Value = value
  3747. Invalidate()
  3748. End Set
  3749. End Property
  3750. #End Region
  3751. #Region "Hatch Options"
  3752. Private _color As HatchColors
  3753.  
  3754. Public Property CurrentColor() As HatchColors
  3755. Get
  3756. Return Me._color
  3757. End Get
  3758. Set(value As HatchColors)
  3759. Me._color = value
  3760. Invalidate()
  3761. End Set
  3762. End Property
  3763.  
  3764. Private _yesno As IsHatched
  3765.  
  3766. Public Property HatchONOff() As IsHatched
  3767. Get
  3768. Return Me._yesno
  3769. End Get
  3770. Set(value As IsHatched)
  3771. Me._yesno = value
  3772. Invalidate()
  3773. End Set
  3774. End Property
  3775. #End Region
  3776.  
  3777. Public Sub New()
  3778. SetColor("Background", Color.FromArgb(245, 245, 245))
  3779. SetColor("Border1", 235, 235, 235)
  3780. SetColor("Border2", 245, 245, 245)
  3781. End Sub
  3782.  
  3783. Private ProgressBarColor As Color
  3784. Private B1 As HatchBrush
  3785. Private P1 As Pen
  3786. Private P2 As Pen
  3787.  
  3788. Protected Overrides Sub ColorHook()
  3789. ProgressBarColor = GetColor("Background")
  3790. P1 = New Pen(GetColor("Border1"))
  3791. P2 = New Pen(GetColor("Border2"))
  3792. End Sub
  3793.  
  3794. Protected Overrides Sub PaintHook()
  3795. G.Clear(ProgressBarColor)
  3796. DrawGradient(ProgressBarColor, ProgressBarColor, ClientRectangle, 90.0F)
  3797. Select Case _yesno
  3798. Case IsHatched.Yes
  3799. Select Case _color
  3800. Case HatchColors.White
  3801. SetColor("Hatch1", 245, 245, 245)
  3802. SetColor("Hatch2", 235, 235, 235)
  3803. B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch2"))
  3804. Exit Select
  3805. Case HatchColors.Blue
  3806. SetColor("Hatch1", 78, 205, 196)
  3807. SetColor("Hatch2", 72, 199, 190)
  3808. B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch2"))
  3809. Exit Select
  3810. Case HatchColors.Green
  3811. SetColor("Hatch1", 199, 244, 100)
  3812. SetColor("Hatch2", 193, 238, 94)
  3813. B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch2"))
  3814. Exit Select
  3815. Case HatchColors.Pink
  3816. SetColor("Hatch1", 255, 107, 107)
  3817. SetColor("Hatch2", 249, 101, 101)
  3818. B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch2"))
  3819. Exit Select
  3820. End Select
  3821. Exit Select
  3822. Case IsHatched.No
  3823. Select Case _color
  3824. Case HatchColors.White
  3825. SetColor("Hatch1", 245, 245, 245)
  3826. B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch1"))
  3827. Exit Select
  3828. Case HatchColors.Blue
  3829. SetColor("Hatch1", 78, 205, 196)
  3830. B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch1"))
  3831. Exit Select
  3832. Case HatchColors.Green
  3833. SetColor("Hatch1", 199, 244, 100)
  3834. B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch1"))
  3835. Exit Select
  3836. Case HatchColors.Pink
  3837. SetColor("Hatch1", 255, 107, 107)
  3838. SetColor("Hatch2", 249, 101, 101)
  3839. B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch1"))
  3840. Exit Select
  3841. End Select
  3842. Exit Select
  3843. End Select
  3844. G.FillRectangle(B1, 2, 2, (Width * _Value) \ (_Maximum - _Minimum), Height)
  3845. DrawBorders(P1, 1)
  3846. DrawBorders(P2)
  3847. DrawCorners(BackColor)
  3848. End Sub
  3849. Public Sub Increment(num As Integer)
  3850. Me._Value += num
  3851. Invalidate()
  3852. End Sub
  3853. Public Sub Deincrement(num As Integer)
  3854. Me._Value -= num
  3855. Invalidate()
  3856. End Sub
  3857. End Class
  3858. #End Region
  3859.  
  3860. #Region "Checkbox"
  3861. ' This is used to see if it is a checkbox and so on.
  3862. <DefaultEvent("CheckedChanged")> _
  3863. Class genesisCheckBox
  3864. Inherits ThemeControl154
  3865. ' This Checkbox uses a green middle
  3866. #Region "Text Options"
  3867. Private _text As MultiColor
  3868.  
  3869. Public Property TextColor() As MultiColor
  3870. Get
  3871. Return Me._text
  3872. End Get
  3873. Set(value As MultiColor)
  3874. Me._text = value
  3875. Invalidate()
  3876. End Set
  3877. End Property
  3878. #End Region
  3879.  
  3880. #Region "Hatch Options"
  3881. Private _color As HatchColors
  3882.  
  3883. Public Property CurrentColor() As HatchColors
  3884. Get
  3885. Return Me._color
  3886. End Get
  3887. Set(value As HatchColors)
  3888. Me._color = value
  3889. Invalidate()
  3890. End Set
  3891. End Property
  3892.  
  3893. Private _yesno As IsHatched
  3894.  
  3895. Public Property HatchONOff() As IsHatched
  3896. Get
  3897. Return Me._yesno
  3898. End Get
  3899. Set(value As IsHatched)
  3900. Me._yesno = value
  3901. Invalidate()
  3902. End Set
  3903. End Property
  3904. #End Region
  3905.  
  3906. Public Sub New()
  3907. Transparent = True
  3908. ' it is infact transpernt
  3909. BackColor = Color.Transparent
  3910. ' no lockheight since that way they can choose how they want it.
  3911. ' 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.
  3912. SetColor("Background", 249, 249, 249)
  3913. ' Background is Dark
  3914. SetColor("Border1", 235, 235, 235)
  3915. ' The Inside Border
  3916. ' The Outside Border
  3917. SetColor("Border2", 249, 249, 249)
  3918. End Sub
  3919.  
  3920. ' set up the variables
  3921. Private C1 As Color
  3922. ' Set up Simple Colors
  3923. Private P1 As Pen
  3924. ' A Pen used to create borders
  3925. Private P2 As Pen
  3926. Private B1 As HatchBrush
  3927.  
  3928. Protected Overrides Sub ColorHook()
  3929. C1 = GetColor("Background")
  3930. ' Get the Colors for the Button Shading
  3931. P1 = New Pen(GetColor("Border1"))
  3932. ' Get and create the borders for the Buttons
  3933. P2 = New Pen(GetColor("Border2"))
  3934. End Sub
  3935.  
  3936. Protected Overrides Sub PaintHook()
  3937. G.Clear(BackColor)
  3938. Select Case _Checked
  3939. Case True
  3940. 'Put your checked state here
  3941. Select Case _yesno
  3942. Case IsHatched.Yes
  3943. Select Case _color
  3944. Case HatchColors.White
  3945. SetColor("Hatch1", 250, 250, 250)
  3946. SetColor("Hatch2", 244, 244, 244)
  3947. B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch2"))
  3948. Exit Select
  3949. Case HatchColors.Blue
  3950. SetColor("Hatch1", 78, 205, 196)
  3951. SetColor("Hatch2", 72, 199, 190)
  3952. B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch2"))
  3953. Exit Select
  3954. Case HatchColors.Green
  3955. SetColor("Hatch1", 199, 244, 100)
  3956. SetColor("Hatch2", 193, 238, 94)
  3957. B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch2"))
  3958. Exit Select
  3959. Case HatchColors.Pink
  3960. SetColor("Hatch1", 255, 107, 107)
  3961. SetColor("Hatch2", 249, 101, 101)
  3962. B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch2"))
  3963. Exit Select
  3964. End Select
  3965. Exit Select
  3966. Case IsHatched.No
  3967. Select Case _color
  3968. Case HatchColors.White
  3969. SetColor("Hatch1", 250, 250, 250)
  3970. B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch1"))
  3971. Exit Select
  3972. Case HatchColors.Blue
  3973. SetColor("Hatch1", 78, 205, 196)
  3974. B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch1"))
  3975. Exit Select
  3976. Case HatchColors.Green
  3977. SetColor("Hatch1", 199, 244, 100)
  3978. B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch1"))
  3979. Exit Select
  3980. Case HatchColors.Pink
  3981. SetColor("Hatch1", 255, 107, 107)
  3982. SetColor("Hatch2", 249, 101, 101)
  3983. B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch1"))
  3984. Exit Select
  3985. End Select
  3986. Exit Select
  3987. End Select
  3988.  
  3989. DrawGradient(C1, C1, ClientRectangle, 90.0F)
  3990. ' checked background
  3991. G.FillRectangle(B1, 3, 3, Me.Width - 6, Me.Height - 6)
  3992. DrawBorders(P1, 1)
  3993. ' Create the Inner Border
  3994. Me.Height = Me.Width
  3995. DrawBorders(P2)
  3996. ' Create the Outer Border
  3997. DrawCorners(BackColor)
  3998. ' Draw the Corners
  3999. Exit Select
  4000. Case False
  4001. 'Put your unchecked state here
  4002. DrawGradient(C1, C1, ClientRectangle, 90.0F)
  4003. ' unchecked background
  4004. DrawBorders(P1, 1)
  4005. ' Create the Inner Border
  4006. Me.Height = Me.Width
  4007. DrawBorders(P2)
  4008. ' Create the Outer Border
  4009. DrawCorners(BackColor)
  4010. ' Draw the Corners
  4011. Exit Select
  4012. End Select
  4013. End Sub
  4014.  
  4015. Private Property _Checked() As Boolean
  4016. Get
  4017. Return m__Checked
  4018. End Get
  4019. Set(value As Boolean)
  4020. m__Checked = Value
  4021. End Set
  4022. End Property
  4023. Private m__Checked As Boolean
  4024. Public Property Checked() As Boolean
  4025. Get
  4026. Return _Checked
  4027. End Get
  4028. Set(value As Boolean)
  4029. _Checked = value
  4030. End Set
  4031. End Property
  4032. Protected Overrides Sub OnClick(e As System.EventArgs)
  4033. _Checked = Not _Checked
  4034. RaiseEvent CheckedChanged(Me)
  4035. MyBase.OnClick(e)
  4036. End Sub
  4037. Public Event CheckedChanged As CheckedChangedEventHandler
  4038. Public Delegate Sub CheckedChangedEventHandler(sender As Object)
  4039. End Class
  4040. #End Region
  4041.  
  4042. #Region "MaximizeButton"
  4043. Class genesisMaximize
  4044. Inherits ThemeControl154
  4045. ' A Hide Button
  4046. Private _color As HoverOptions
  4047.  
  4048. Public Property HoverColor() As HoverOptions
  4049. Get
  4050. Return Me._color
  4051. End Get
  4052. Set(value As HoverOptions)
  4053. Me._color = value
  4054. Invalidate()
  4055. End Set
  4056. End Property
  4057.  
  4058. Public Property WindowState() As FormWindowState
  4059. Get
  4060. Return m_WindowState
  4061. End Get
  4062. Set(value As FormWindowState)
  4063. m_WindowState = Value
  4064. End Set
  4065. End Property
  4066. Private m_WindowState As FormWindowState
  4067. Public Sub New()
  4068. SetColor("NoneGradient1", 235, 235, 235)
  4069. SetColor("NoneGradient2", 245, 245, 245)
  4070. SetColor("Text", 24, 24, 24)
  4071. ' The Color for the Text
  4072. SetColor("Texthover", 254, 254, 254)
  4073. ' The Color for the Text
  4074. SetColor("Border1", 225, 225, 225)
  4075. ' The Inside Border
  4076. ' The Outside Border
  4077. SetColor("Border2", 235, 235, 235)
  4078. End Sub
  4079.  
  4080. Private C1 As Color
  4081. ' Set up Simple Colors
  4082. Private C2 As Color
  4083. Private C3 As Color
  4084. Private C4 As Color
  4085. Private C5 As Color
  4086. Private C6 As Color
  4087. Private B1 As SolidBrush
  4088. ' A Brush to use text
  4089. Private B2 As SolidBrush
  4090. ' A Brush to use text
  4091. Private P1 As Pen
  4092. ' A Pen used to create borders
  4093. Private P2 As Pen
  4094.  
  4095. Protected Overrides Sub ColorHook()
  4096. C3 = GetColor("NoneGradient1")
  4097. C4 = GetColor("NoneGradient2")
  4098. B1 = New SolidBrush(GetColor("Text"))
  4099. ' Set up Color for the Text
  4100. B2 = New SolidBrush(GetColor("Texthover"))
  4101. P1 = New Pen(GetColor("Border1"))
  4102. ' Get and create the borders for the Buttons
  4103. P2 = New Pen(GetColor("Border2"))
  4104. End Sub
  4105.  
  4106. Protected Overrides Sub PaintHook()
  4107. Select Case _color
  4108. Case HoverOptions.Blue
  4109. SetColor("DownGradient1", 72, 199, 190)
  4110. ' Basic Gradients Used to Shade the Button
  4111. SetColor("DownGradient2", 78, 205, 196)
  4112. ' The Gradients are reversed, depending on if Button is Pressed or not
  4113. SetColor("ClickedGradient1", 72, 199, 190)
  4114. SetColor("ClickedGradient2", 78, 205, 196)
  4115. C1 = GetColor("DownGradient1")
  4116. ' Get the Colors for the Button Shading
  4117. C2 = GetColor("DownGradient2")
  4118. C5 = GetColor("ClickedGradient1")
  4119. C6 = GetColor("ClickedGradient2")
  4120. Exit Select
  4121. Case HoverOptions.Green
  4122. SetColor("DownGradient1", 193, 238, 94)
  4123. ' Basic Gradients Used to Shade the Button
  4124. SetColor("DownGradient2", 199, 244, 100)
  4125. ' The Gradients are reversed, depending on if Button is Pressed or not
  4126. SetColor("ClickedGradient1", 193, 238, 94)
  4127. SetColor("ClickedGradient2", 199, 244, 100)
  4128. C1 = GetColor("DownGradient1")
  4129. ' Get the Colors for the Button Shading
  4130. C2 = GetColor("DownGradient2")
  4131. C5 = GetColor("ClickedGradient1")
  4132. C6 = GetColor("ClickedGradient2")
  4133. Exit Select
  4134. Case HoverOptions.Pink
  4135. SetColor("DownGradient1", 249, 101, 101)
  4136. ' Basic Gradients Used to Shade the Button
  4137. SetColor("DownGradient2", 255, 107, 107)
  4138. ' The Gradients are reversed, depending on if Button is Pressed or not
  4139. SetColor("ClickedGradient1", 249, 101, 101)
  4140. SetColor("ClickedGradient2", 255, 107, 107)
  4141. C1 = GetColor("DownGradient1")
  4142. ' Get the Colors for the Button Shading
  4143. C2 = GetColor("DownGradient2")
  4144. C5 = GetColor("ClickedGradient1")
  4145. C6 = GetColor("ClickedGradient2")
  4146. Exit Select
  4147. End Select
  4148. If Me.State = MouseState.Over Then
  4149. ' Used to see if button is Hovered over
  4150. DrawGradient(C1, C2, ClientRectangle, 90.0F)
  4151. ' if button is hovered over
  4152. If Application.OpenForms(0).WindowState = FormWindowState.Normal Then
  4153. Me.Text = "+"
  4154. ' Draw the Text Smack dab in the middle of the button
  4155. DrawText(B2, HorizontalAlignment.Center, 0, 0)
  4156. ElseIf Application.OpenForms(0).WindowState = FormWindowState.Maximized Then
  4157. Me.Text = "-" & ChrW(127) & ChrW(127)
  4158. ' Draw the Text Smack dab in the middle of the button
  4159. DrawText(B2, HorizontalAlignment.Center, 0, 0)
  4160. End If
  4161. ElseIf Me.State = MouseState.Down Then
  4162. DrawGradient(C6, C5, ClientRectangle, 90.0F)
  4163. If Application.OpenForms(0).WindowState = FormWindowState.Normal Then
  4164. Me.Text = "+"
  4165. System.Threading.Thread.Sleep(100)
  4166. DrawText(B2, HorizontalAlignment.Center, 0, 0)
  4167. ' Draw the Text Smack dab in the middle of the button
  4168. Application.OpenForms(0).WindowState = FormWindowState.Maximized
  4169. Me.Text = "-"
  4170. ElseIf Application.OpenForms(0).WindowState = FormWindowState.Maximized Then
  4171. Me.Text = "-"
  4172. System.Threading.Thread.Sleep(100)
  4173. DrawText(B2, HorizontalAlignment.Center, 0, 0)
  4174. ' Draw the Text Smack dab in the middle of the button
  4175. Application.OpenForms(0).WindowState = FormWindowState.Normal
  4176. Me.Text = "+"
  4177. End If
  4178. Else
  4179. DrawGradient(C3, C4, ClientRectangle, 90.0F)
  4180. ' else change the shading
  4181. ' Draw the Text Smack dab in the middle of the button
  4182. DrawText(B1, HorizontalAlignment.Center, 0, 0)
  4183. End If
  4184. Me.Width = 17
  4185. Me.Height = 17
  4186. DrawBorders(P1, 1)
  4187. ' Create the Inner Border
  4188. DrawBorders(P2)
  4189. ' Create the Outer Border
  4190. DrawCorners(BackColor)
  4191. ' Draw the Corners
  4192. End Sub
  4193.  
  4194. End Class
  4195. #End Region
  4196.  
  4197. #Region "HideButton"
  4198. Class genesisHide
  4199. Inherits ThemeControl154
  4200. ' A Hide Button
  4201. Private _color As HoverOptions
  4202.  
  4203. Public Property HoverColor() As HoverOptions
  4204. Get
  4205. Return Me._color
  4206. End Get
  4207. Set(value As HoverOptions)
  4208. Me._color = value
  4209. Invalidate()
  4210. End Set
  4211. End Property
  4212.  
  4213. Public Property WindowState() As FormWindowState
  4214. Get
  4215. Return m_WindowState
  4216. End Get
  4217. Set(value As FormWindowState)
  4218. m_WindowState = Value
  4219. End Set
  4220. End Property
  4221. Private m_WindowState As FormWindowState
  4222. Public Sub New()
  4223. SetColor("NoneGradient1", 235, 235, 235)
  4224. SetColor("NoneGradient2", 245, 245, 245)
  4225. SetColor("Text", 24, 24, 24)
  4226. ' The Color for the Text
  4227. SetColor("Texthover", 254, 254, 254)
  4228. ' The Color for the Text
  4229. SetColor("Border1", 225, 225, 225)
  4230. ' The Inside Border
  4231. ' The Outside Border
  4232. SetColor("Border2", 235, 235, 235)
  4233. End Sub
  4234.  
  4235. Private C1 As Color
  4236. ' Set up Simple Colors
  4237. Private C2 As Color
  4238. Private C3 As Color
  4239. Private C4 As Color
  4240. Private C5 As Color
  4241. Private C6 As Color
  4242. Private B1 As SolidBrush
  4243. ' A Brush to use text
  4244. Private B2 As SolidBrush
  4245. ' A Brush to use text
  4246. Private P1 As Pen
  4247. ' A Pen used to create borders
  4248. Private P2 As Pen
  4249.  
  4250. Protected Overrides Sub ColorHook()
  4251. C3 = GetColor("NoneGradient1")
  4252. C4 = GetColor("NoneGradient2")
  4253. B1 = New SolidBrush(GetColor("Text"))
  4254. ' Set up Color for the Text
  4255. B2 = New SolidBrush(GetColor("Texthover"))
  4256. P1 = New Pen(GetColor("Border1"))
  4257. ' Get and create the borders for the Buttons
  4258. P2 = New Pen(GetColor("Border2"))
  4259. End Sub
  4260.  
  4261. Protected Overrides Sub PaintHook()
  4262. Select Case _color
  4263. Case HoverOptions.Blue
  4264. SetColor("DownGradient1", 72, 199, 190)
  4265. ' Basic Gradients Used to Shade the Button
  4266. SetColor("DownGradient2", 78, 205, 196)
  4267. ' The Gradients are reversed, depending on if Button is Pressed or not
  4268. SetColor("ClickedGradient1", 72, 199, 190)
  4269. SetColor("ClickedGradient2", 78, 205, 196)
  4270. C1 = GetColor("DownGradient1")
  4271. ' Get the Colors for the Button Shading
  4272. C2 = GetColor("DownGradient2")
  4273. C5 = GetColor("ClickedGradient1")
  4274. C6 = GetColor("ClickedGradient2")
  4275. Exit Select
  4276. Case HoverOptions.Green
  4277. SetColor("DownGradient1", 193, 238, 94)
  4278. ' Basic Gradients Used to Shade the Button
  4279. SetColor("DownGradient2", 199, 244, 100)
  4280. ' The Gradients are reversed, depending on if Button is Pressed or not
  4281. SetColor("ClickedGradient1", 193, 238, 94)
  4282. SetColor("ClickedGradient2", 199, 244, 100)
  4283. C1 = GetColor("DownGradient1")
  4284. ' Get the Colors for the Button Shading
  4285. C2 = GetColor("DownGradient2")
  4286. C5 = GetColor("ClickedGradient1")
  4287. C6 = GetColor("ClickedGradient2")
  4288. Exit Select
  4289. Case HoverOptions.Pink
  4290. SetColor("DownGradient1", 249, 101, 101)
  4291. ' Basic Gradients Used to Shade the Button
  4292. SetColor("DownGradient2", 255, 107, 107)
  4293. ' The Gradients are reversed, depending on if Button is Pressed or not
  4294. SetColor("ClickedGradient1", 249, 101, 101)
  4295. SetColor("ClickedGradient2", 255, 107, 107)
  4296. C1 = GetColor("DownGradient1")
  4297. ' Get the Colors for the Button Shading
  4298. C2 = GetColor("DownGradient2")
  4299. C5 = GetColor("ClickedGradient1")
  4300. C6 = GetColor("ClickedGradient2")
  4301. Exit Select
  4302. End Select
  4303. If Me.State = MouseState.Over Then
  4304. ' Used to see if button is Hovered over
  4305. DrawGradient(C1, C2, ClientRectangle, 90.0F)
  4306. ' if button is hovered over
  4307. DrawText(B2, HorizontalAlignment.Center, 0, 0)
  4308. ' Draw the Text Smack dab in the middle of the button
  4309. Me.Text = "_"
  4310. ElseIf Me.State = MouseState.Down Then
  4311. DrawGradient(C6, C5, ClientRectangle, 90.0F)
  4312. Me.Text = "_"
  4313. DrawText(B2, HorizontalAlignment.Center, 0, 0)
  4314. ' Draw the Text Smack dab in the middle of the button
  4315. Application.OpenForms(0).WindowState = FormWindowState.Minimized
  4316. Else
  4317. DrawGradient(C3, C4, ClientRectangle, 90.0F)
  4318. ' else change the shading
  4319. ' Draw the Text Smack dab in the middle of the button
  4320. DrawText(B1, HorizontalAlignment.Center, 0, 0)
  4321. End If
  4322. Me.Width = 17
  4323. Me.Height = 17
  4324. DrawBorders(P1, 1)
  4325. ' Create the Inner Border
  4326. DrawBorders(P2)
  4327. ' Create the Outer Border
  4328. DrawCorners(BackColor)
  4329. ' Draw the Corners
  4330. End Sub
  4331.  
  4332. End Class
  4333. #End Region
  4334.  
  4335. #Region "CloseButton"
  4336. Class genesisClose
  4337. Inherits ThemeControl154
  4338. ' A Hide Button
  4339. Private _color As HoverOptions
  4340.  
  4341. Public Property HoverColor() As HoverOptions
  4342. Get
  4343. Return Me._color
  4344. End Get
  4345. Set(value As HoverOptions)
  4346. Me._color = value
  4347. Invalidate()
  4348. End Set
  4349. End Property
  4350.  
  4351. Public Property WindowState() As FormWindowState
  4352. Get
  4353. Return m_WindowState
  4354. End Get
  4355. Set(value As FormWindowState)
  4356. m_WindowState = Value
  4357. End Set
  4358. End Property
  4359. Private m_WindowState As FormWindowState
  4360. Public Sub New()
  4361. SetColor("NoneGradient1", 235, 235, 235)
  4362. SetColor("NoneGradient2", 245, 245, 245)
  4363. SetColor("Text", 24, 24, 24)
  4364. ' The Color for the Text
  4365. SetColor("Texthover", 254, 254, 254)
  4366. ' The Color for the Text
  4367. SetColor("Border1", 225, 225, 225)
  4368. ' The Inside Border
  4369. ' The Outside Border
  4370. SetColor("Border2", 235, 235, 235)
  4371. End Sub
  4372.  
  4373. Private C1 As Color
  4374. ' Set up Simple Colors
  4375. Private C2 As Color
  4376. Private C3 As Color
  4377. Private C4 As Color
  4378. Private C5 As Color
  4379. Private C6 As Color
  4380. Private B1 As SolidBrush
  4381. ' A Brush to use text
  4382. Private B2 As SolidBrush
  4383. ' A Brush to use text
  4384. Private P1 As Pen
  4385. ' A Pen used to create borders
  4386. Private P2 As Pen
  4387.  
  4388. Protected Overrides Sub ColorHook()
  4389. C3 = GetColor("NoneGradient1")
  4390. C4 = GetColor("NoneGradient2")
  4391. B1 = New SolidBrush(GetColor("Text"))
  4392. ' Set up Color for the Text
  4393. B2 = New SolidBrush(GetColor("Texthover"))
  4394. P1 = New Pen(GetColor("Border1"))
  4395. ' Get and create the borders for the Buttons
  4396. P2 = New Pen(GetColor("Border2"))
  4397. End Sub
  4398.  
  4399. Protected Overrides Sub PaintHook()
  4400. Select Case _color
  4401. Case HoverOptions.Blue
  4402. SetColor("DownGradient1", 72, 199, 190)
  4403. ' Basic Gradients Used to Shade the Button
  4404. SetColor("DownGradient2", 78, 205, 196)
  4405. ' The Gradients are reversed, depending on if Button is Pressed or not
  4406. SetColor("ClickedGradient1", 72, 199, 190)
  4407. SetColor("ClickedGradient2", 78, 205, 196)
  4408. C1 = GetColor("DownGradient1")
  4409. ' Get the Colors for the Button Shading
  4410. C2 = GetColor("DownGradient2")
  4411. C5 = GetColor("ClickedGradient1")
  4412. C6 = GetColor("ClickedGradient2")
  4413. Exit Select
  4414. Case HoverOptions.Green
  4415. SetColor("DownGradient1", 193, 238, 94)
  4416. ' Basic Gradients Used to Shade the Button
  4417. SetColor("DownGradient2", 199, 244, 100)
  4418. ' The Gradients are reversed, depending on if Button is Pressed or not
  4419. SetColor("ClickedGradient1", 193, 238, 94)
  4420. SetColor("ClickedGradient2", 199, 244, 100)
  4421. C1 = GetColor("DownGradient1")
  4422. ' Get the Colors for the Button Shading
  4423. C2 = GetColor("DownGradient2")
  4424. C5 = GetColor("ClickedGradient1")
  4425. C6 = GetColor("ClickedGradient2")
  4426. Exit Select
  4427. Case HoverOptions.Pink
  4428. SetColor("DownGradient1", 249, 101, 101)
  4429. ' Basic Gradients Used to Shade the Button
  4430. SetColor("DownGradient2", 255, 107, 107)
  4431. ' The Gradients are reversed, depending on if Button is Pressed or not
  4432. SetColor("ClickedGradient1", 249, 101, 101)
  4433. SetColor("ClickedGradient2", 255, 107, 107)
  4434. C1 = GetColor("DownGradient1")
  4435. ' Get the Colors for the Button Shading
  4436. C2 = GetColor("DownGradient2")
  4437. C5 = GetColor("ClickedGradient1")
  4438. C6 = GetColor("ClickedGradient2")
  4439. Exit Select
  4440. End Select
  4441. If Me.State = MouseState.Over Then
  4442. ' Used to see if button is Hovered over
  4443. DrawGradient(C1, C2, ClientRectangle, 90.0F)
  4444. ' if button is hovered over
  4445. DrawText(B2, HorizontalAlignment.Center, 0, 0)
  4446. ' Draw the Text Smack dab in the middle of the button
  4447. Me.Text = "x"
  4448. ElseIf Me.State = MouseState.Down Then
  4449. DrawGradient(C6, C5, ClientRectangle, 90.0F)
  4450. Me.Text = "x"
  4451. Application.[Exit]()
  4452. ' Draw the Text Smack dab in the middle of the button
  4453. DrawText(B2, HorizontalAlignment.Center, 0, 0)
  4454. Else
  4455. DrawGradient(C3, C4, ClientRectangle, 90.0F)
  4456. ' else change the shading
  4457. ' Draw the Text Smack dab in the middle of the button
  4458. DrawText(B1, HorizontalAlignment.Center, 0, 0)
  4459. End If
  4460. Me.Width = 17
  4461. Me.Height = 17
  4462. DrawBorders(P1, 1)
  4463. ' Create the Inner Border
  4464. DrawBorders(P2)
  4465. ' Create the Outer Border
  4466. DrawCorners(BackColor)
  4467. ' Draw the Corners
  4468. End Sub
  4469.  
  4470. End Class
  4471. #End Region
  4472.  
  4473. #Region "TopButton"
  4474. Class genesisTopButton
  4475. Inherits ThemeControl154
  4476. ' A Hide Button
  4477. Private _color As HoverOptions
  4478.  
  4479. Public Property HoverColor() As HoverOptions
  4480. Get
  4481. Return Me._color
  4482. End Get
  4483. Set(value As HoverOptions)
  4484. Me._color = value
  4485. Invalidate()
  4486. End Set
  4487. End Property
  4488.  
  4489. Public Property WindowState() As FormWindowState
  4490. Get
  4491. Return m_WindowState
  4492. End Get
  4493. Set(value As FormWindowState)
  4494. m_WindowState = Value
  4495. End Set
  4496. End Property
  4497. Private m_WindowState As FormWindowState
  4498. Public Sub New()
  4499. SetColor("NoneGradient1", 235, 235, 235)
  4500. SetColor("NoneGradient2", 245, 245, 245)
  4501. SetColor("Text", 24, 24, 24)
  4502. ' The Color for the Text
  4503. SetColor("Texthover", 254, 254, 254)
  4504. ' The Color for the Text
  4505. SetColor("Border1", 225, 225, 225)
  4506. ' The Inside Border
  4507. ' The Outside Border
  4508. SetColor("Border2", 235, 235, 235)
  4509. End Sub
  4510.  
  4511. Private C1 As Color
  4512. ' Set up Simple Colors
  4513. Private C2 As Color
  4514. Private C3 As Color
  4515. Private C4 As Color
  4516. Private C5 As Color
  4517. Private C6 As Color
  4518. Private B1 As SolidBrush
  4519. ' A Brush to use text
  4520. Private B2 As SolidBrush
  4521. ' A Brush to use text
  4522. Private P1 As Pen
  4523. ' A Pen used to create borders
  4524. Private P2 As Pen
  4525.  
  4526. Protected Overrides Sub ColorHook()
  4527. C3 = GetColor("NoneGradient1")
  4528. C4 = GetColor("NoneGradient2")
  4529. B1 = New SolidBrush(GetColor("Text"))
  4530. ' Set up Color for the Text
  4531. B2 = New SolidBrush(GetColor("Texthover"))
  4532. P1 = New Pen(GetColor("Border1"))
  4533. ' Get and create the borders for the Buttons
  4534. P2 = New Pen(GetColor("Border2"))
  4535. End Sub
  4536.  
  4537. Protected Overrides Sub PaintHook()
  4538. Select Case _color
  4539. Case HoverOptions.Blue
  4540. SetColor("DownGradient1", 72, 199, 190)
  4541. ' Basic Gradients Used to Shade the Button
  4542. SetColor("DownGradient2", 78, 205, 196)
  4543. ' The Gradients are reversed, depending on if Button is Pressed or not
  4544. SetColor("ClickedGradient1", 72, 199, 190)
  4545. SetColor("ClickedGradient2", 78, 205, 196)
  4546. C1 = GetColor("DownGradient1")
  4547. ' Get the Colors for the Button Shading
  4548. C2 = GetColor("DownGradient2")
  4549. C5 = GetColor("ClickedGradient1")
  4550. C6 = GetColor("ClickedGradient2")
  4551. Exit Select
  4552. Case HoverOptions.Green
  4553. SetColor("DownGradient1", 193, 238, 94)
  4554. ' Basic Gradients Used to Shade the Button
  4555. SetColor("DownGradient2", 199, 244, 100)
  4556. ' The Gradients are reversed, depending on if Button is Pressed or not
  4557. SetColor("ClickedGradient1", 193, 238, 94)
  4558. SetColor("ClickedGradient2", 199, 244, 100)
  4559. C1 = GetColor("DownGradient1")
  4560. ' Get the Colors for the Button Shading
  4561. C2 = GetColor("DownGradient2")
  4562. C5 = GetColor("ClickedGradient1")
  4563. C6 = GetColor("ClickedGradient2")
  4564. Exit Select
  4565. Case HoverOptions.Pink
  4566. SetColor("DownGradient1", 249, 101, 101)
  4567. ' Basic Gradients Used to Shade the Button
  4568. SetColor("DownGradient2", 255, 107, 107)
  4569. ' The Gradients are reversed, depending on if Button is Pressed or not
  4570. SetColor("ClickedGradient1", 249, 101, 101)
  4571. SetColor("ClickedGradient2", 255, 107, 107)
  4572. C1 = GetColor("DownGradient1")
  4573. ' Get the Colors for the Button Shading
  4574. C2 = GetColor("DownGradient2")
  4575. C5 = GetColor("ClickedGradient1")
  4576. C6 = GetColor("ClickedGradient2")
  4577. Exit Select
  4578. End Select
  4579. If Me.State = MouseState.Over Then
  4580. ' Used to see if button is Hovered over
  4581. DrawGradient(C1, C2, ClientRectangle, 90.0F)
  4582. ' if button is hovered over
  4583. ' Draw the Text Smack dab in the middle of the button
  4584. DrawText(B2, HorizontalAlignment.Center, 0, 0)
  4585. ElseIf Me.State = MouseState.Down Then
  4586. DrawGradient(C6, C5, ClientRectangle, 90.0F)
  4587. ' Draw the Text Smack dab in the middle of the button
  4588. DrawText(B2, HorizontalAlignment.Center, 0, 0)
  4589. Else
  4590. DrawGradient(C3, C4, ClientRectangle, 90.0F)
  4591. ' else change the shading
  4592. ' Draw the Text Smack dab in the middle of the button
  4593. DrawText(B1, HorizontalAlignment.Center, 0, 0)
  4594. End If
  4595. Me.Width = 17
  4596. Me.Height = 17
  4597. DrawBorders(P1, 1)
  4598. ' Create the Inner Border
  4599. DrawBorders(P2)
  4600. ' Create the Outer Border
  4601. DrawCorners(BackColor)
  4602. ' Draw the Corners
  4603. End Sub
  4604.  
  4605. End Class
  4606. #End Region
  4607.  
  4608. #Region "Groupbox"
  4609. Class genesisGroupBox
  4610. Inherits ThemeContainer154
  4611. #Region "Text Location"
  4612. Public Enum TextLocation
  4613. Left = 0
  4614. Center = 1
  4615. Right = 2
  4616. End Enum
  4617.  
  4618. Private _location As TextLocation
  4619.  
  4620. Public Property TextPlacement() As TextLocation
  4621. Get
  4622. Return Me._location
  4623. End Get
  4624. Set(value As TextLocation)
  4625. Me._location = value
  4626. Invalidate()
  4627. End Set
  4628. End Property
  4629. #End Region
  4630. #Region "TextColor"
  4631. Public Enum MultiColor
  4632. Black = 0
  4633. White = 1
  4634. Green = 2
  4635. Blue = 3
  4636. Pink = 4
  4637. End Enum
  4638. Private _color As MultiColor
  4639.  
  4640. Public Property TextColor() As MultiColor
  4641. Get
  4642. Return Me._color
  4643. End Get
  4644. Set(value As MultiColor)
  4645. Me._color = value
  4646. Invalidate()
  4647. End Set
  4648. End Property
  4649. #End Region
  4650. #Region "Hatch Options"
  4651. Private _hatchcolor As HatchColors
  4652.  
  4653. Public Property HatchColor() As HatchColors
  4654. Get
  4655. Return Me._hatchcolor
  4656. End Get
  4657. Set(value As HatchColors)
  4658. Me._hatchcolor = value
  4659. Invalidate()
  4660. End Set
  4661. End Property
  4662.  
  4663. Private _yesno As IsHatched
  4664.  
  4665. Public Property HatchONOff() As IsHatched
  4666. Get
  4667. Return Me._yesno
  4668. End Get
  4669. Set(value As IsHatched)
  4670. Me._yesno = value
  4671. Invalidate()
  4672. End Set
  4673. End Property
  4674. #End Region
  4675.  
  4676. Public Sub New()
  4677. ControlMode = True
  4678. Header = 26
  4679. End Sub
  4680.  
  4681. Private B1 As HatchBrush
  4682. Private B2 As SolidBrush
  4683.  
  4684. Protected Overrides Sub ColorHook()
  4685.  
  4686. End Sub
  4687.  
  4688. Protected Overrides Sub PaintHook()
  4689. Select Case _yesno
  4690. Case IsHatched.Yes
  4691. Select Case _hatchcolor
  4692. Case HatchColors.White
  4693. SetColor("Hatch1", 254, 254, 254)
  4694. SetColor("Hatch2", 248, 248, 248)
  4695. B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch2"))
  4696. Exit Select
  4697. Case HatchColors.Blue
  4698. SetColor("Hatch1", 78, 205, 196)
  4699. SetColor("Hatch2", 72, 199, 190)
  4700. B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch2"))
  4701. Exit Select
  4702. Case HatchColors.Green
  4703. SetColor("Hatch1", 199, 244, 100)
  4704. SetColor("Hatch2", 193, 238, 94)
  4705. B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch2"))
  4706. Exit Select
  4707. Case HatchColors.Pink
  4708. SetColor("Hatch1", 255, 107, 107)
  4709. SetColor("Hatch2", 249, 101, 101)
  4710. B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch2"))
  4711. Exit Select
  4712. End Select
  4713. Exit Select
  4714. Case IsHatched.No
  4715. Select Case _hatchcolor
  4716. Case HatchColors.White
  4717. SetColor("Hatch1", 254, 254, 254)
  4718. B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch1"))
  4719. Exit Select
  4720. Case HatchColors.Blue
  4721. SetColor("Hatch1", 78, 205, 196)
  4722. B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch1"))
  4723. Exit Select
  4724. Case HatchColors.Green
  4725. SetColor("Hatch1", 199, 244, 100)
  4726. B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch1"))
  4727. Exit Select
  4728. Case HatchColors.Pink
  4729. SetColor("Hatch1", 255, 107, 107)
  4730. SetColor("Hatch2", 249, 101, 101)
  4731. B1 = New HatchBrush(HatchStyle.DarkUpwardDiagonal, GetColor("Hatch1"), GetColor("Hatch1"))
  4732. Exit Select
  4733. End Select
  4734. Exit Select
  4735. End Select
  4736. G.Clear(Color.FromArgb(249, 249, 249))
  4737. G.FillRectangle(B1, 5, 5, Width - 10, 26)
  4738. G.DrawLine(New Pen(Color.FromArgb(20, Color.White)), 7, 7, Width - 8, 7)
  4739. DrawBorders(New Pen(Color.FromArgb(220, 220, 220)), 5, 5, Width - 10, 26, 1)
  4740. DrawBorders(New Pen(Color.FromArgb(236, 236, 236)), 5, 5, Width - 10, 26)
  4741. DrawBorders(New Pen(Color.FromArgb(60, 208, 208, 208)), 5, 34, Width - 10, Height - 39, 1)
  4742. DrawBorders(New Pen(Color.FromArgb(236, 236, 236)), 5, 34, Width - 10, Height - 39)
  4743. DrawBorders(New Pen(Color.FromArgb(236, 236, 236)), 1)
  4744. DrawBorders(New Pen(Color.FromArgb(236, 236, 236)))
  4745. G.DrawLine(New Pen(Color.FromArgb(248, 248, 248)), 1, 1, Width - 2, 1)
  4746. Select Case _color
  4747. Case MultiColor.White
  4748. SetColor("Text", 254, 254, 254)
  4749. B2 = New SolidBrush(GetColor("Text"))
  4750. Exit Select
  4751. Case MultiColor.Black
  4752. SetColor("Text", 24, 24, 24)
  4753. B2 = New SolidBrush(GetColor("Text"))
  4754. Exit Select
  4755. Case MultiColor.Blue
  4756. SetColor("Text", 78, 205, 196)
  4757. B2 = New SolidBrush(GetColor("Text"))
  4758. Exit Select
  4759. Case MultiColor.Green
  4760. SetColor("Text", 199, 244, 100)
  4761. B2 = New SolidBrush(GetColor("Text"))
  4762. Exit Select
  4763. Case MultiColor.Pink
  4764. SetColor("Text", 255, 107, 107)
  4765. B2 = New SolidBrush(GetColor("Text"))
  4766. Exit Select
  4767. End Select
  4768. Select Case _location
  4769. Case TextLocation.Left
  4770. DrawText(B2, HorizontalAlignment.Left, 9, 5)
  4771. Exit Select
  4772. Case TextLocation.Center
  4773. DrawText(B2, HorizontalAlignment.Center, 0, 5)
  4774. Exit Select
  4775. Case TextLocation.Right
  4776. DrawText(B2, HorizontalAlignment.Right, 10, 5)
  4777. Exit Select
  4778. End Select
  4779.  
  4780. End Sub
  4781. End Class
  4782. #End Region
  4783.  
  4784. #Region "Panel"
  4785. Class genesisPanel
  4786. Inherits ThemeContainer154
  4787. Public Sub New()
  4788. ControlMode = True
  4789. Header = 26
  4790. End Sub
  4791.  
  4792. Protected Overrides Sub ColorHook()
  4793.  
  4794. End Sub
  4795.  
  4796. Protected Overrides Sub PaintHook()
  4797. G.Clear(Color.FromArgb(250, 250, 250))
  4798. DrawBorders(New Pen(Color.FromArgb(236, 236, 236)), 1)
  4799. DrawBorders(New Pen(Color.FromArgb(236, 236, 236)))
  4800. G.DrawLine(New Pen(Color.FromArgb(248, 248, 248)), 1, 1, Width - 2, 1)
  4801. End Sub
  4802. End Class
  4803. #End Region
  4804.  
  4805. #Region "Textbox"
  4806. <DefaultEvent("TextChanged")> _
  4807. Class genesisTextBox
  4808. Inherits ThemeControl154
  4809.  
  4810. Private _TextAlign As HorizontalAlignment = HorizontalAlignment.Left
  4811. Public Property TextAlign() As HorizontalAlignment
  4812. Get
  4813. Return _TextAlign
  4814. End Get
  4815. Set(value As HorizontalAlignment)
  4816. _TextAlign = value
  4817. If Base IsNot Nothing Then
  4818. Base.TextAlign = value
  4819. End If
  4820. End Set
  4821. End Property
  4822. Private _MaxLength As Integer = 32767
  4823. Public Property MaxLength() As Integer
  4824. Get
  4825. Return _MaxLength
  4826. End Get
  4827. Set(value As Integer)
  4828. _MaxLength = value
  4829. If Base IsNot Nothing Then
  4830. Base.MaxLength = value
  4831. End If
  4832. End Set
  4833. End Property
  4834. Private _ReadOnly As Boolean
  4835. Public Property [ReadOnly]() As Boolean
  4836. Get
  4837. Return _ReadOnly
  4838. End Get
  4839. Set(value As Boolean)
  4840. _ReadOnly = value
  4841. If Base IsNot Nothing Then
  4842. Base.[ReadOnly] = value
  4843. End If
  4844. End Set
  4845. End Property
  4846. Private _UseSystemPasswordChar As Boolean
  4847. Public Property UseSystemPasswordChar() As Boolean
  4848. Get
  4849. Return _UseSystemPasswordChar
  4850. End Get
  4851. Set(value As Boolean)
  4852. _UseSystemPasswordChar = value
  4853. If Base IsNot Nothing Then
  4854. Base.UseSystemPasswordChar = value
  4855. End If
  4856. End Set
  4857. End Property
  4858. Private _Multiline As Boolean
  4859. Public Property Multiline() As Boolean
  4860. Get
  4861. Return _Multiline
  4862. End Get
  4863. Set(value As Boolean)
  4864. _Multiline = value
  4865. If Base IsNot Nothing Then
  4866. Base.Multiline = value
  4867.  
  4868. If value Then
  4869. LockHeight = 0
  4870. Base.Height = Height - 11
  4871. Else
  4872. LockHeight = Base.Height + 11
  4873. End If
  4874. End If
  4875. End Set
  4876. End Property
  4877. Public Overrides Property Text() As String
  4878. Get
  4879. Return MyBase.Text
  4880. End Get
  4881. Set(value As String)
  4882. MyBase.Text = value
  4883. If Base IsNot Nothing Then
  4884. Base.Text = value
  4885. End If
  4886. End Set
  4887. End Property
  4888. Public Overrides Property Font() As Font
  4889. Get
  4890. Return MyBase.Font
  4891. End Get
  4892. Set(value As Font)
  4893. MyBase.Font = value
  4894. If Base IsNot Nothing Then
  4895. Base.Font = value
  4896. Base.Location = New Point(3, 5)
  4897. Base.Width = Width - 6
  4898.  
  4899. If Not _Multiline Then
  4900. LockHeight = Base.Height + 11
  4901. End If
  4902. End If
  4903. End Set
  4904. End Property
  4905.  
  4906. Protected Overrides Sub OnCreation()
  4907. If Not Controls.Contains(Base) Then
  4908. Controls.Add(Base)
  4909. End If
  4910. End Sub
  4911.  
  4912. Private Base As TextBox
  4913. Public Sub New()
  4914. Base = New TextBox()
  4915.  
  4916. Base.Font = Font
  4917. Base.Text = Text
  4918. Base.MaxLength = _MaxLength
  4919. Base.Multiline = _Multiline
  4920. Base.[ReadOnly] = _ReadOnly
  4921. Base.UseSystemPasswordChar = _UseSystemPasswordChar
  4922.  
  4923. Base.BorderStyle = BorderStyle.None
  4924.  
  4925. Base.Location = New Point(4, 4)
  4926. Base.Width = Width - 10
  4927.  
  4928. If _Multiline Then
  4929. Base.Height = Height - 11
  4930. Else
  4931. LockHeight = Base.Height + 11
  4932. End If
  4933.  
  4934. AddHandler Base.TextChanged, AddressOf OnBaseTextChanged
  4935. AddHandler Base.KeyDown, AddressOf OnBaseKeyDown
  4936.  
  4937.  
  4938. SetColor("Text", Color.Black)
  4939. SetColor("Backcolor", 245, 245, 245)
  4940. SetColor("Border", 220, 220, 220)
  4941. End Sub
  4942.  
  4943. Private BG As Color
  4944.  
  4945. Private P1 As Pen
  4946. Protected Overrides Sub ColorHook()
  4947. BG = GetColor("Backcolor")
  4948.  
  4949. P1 = GetPen("Border")
  4950.  
  4951. Base.ForeColor = GetColor("Text")
  4952. Base.BackColor = GetColor("Backcolor")
  4953. End Sub
  4954.  
  4955. Protected Overrides Sub PaintHook()
  4956. G.Clear(BG)
  4957. DrawBorders(P1)
  4958. End Sub
  4959. Private Sub OnBaseTextChanged(s As Object, e As EventArgs)
  4960. Text = Base.Text
  4961. End Sub
  4962. Private Sub OnBaseKeyDown(s As Object, e As KeyEventArgs)
  4963. If e.Control AndAlso e.KeyCode = Keys.A Then
  4964. Base.SelectAll()
  4965. e.SuppressKeyPress = True
  4966. End If
  4967. End Sub
  4968. Protected Overrides Sub OnResize(e As EventArgs)
  4969. Base.Location = New Point(4, 5)
  4970. Base.Width = Width - 8
  4971.  
  4972. If _Multiline Then
  4973. Base.Height = Height - 5
  4974. End If
  4975.  
  4976.  
  4977. MyBase.OnResize(e)
  4978. End Sub
  4979.  
  4980. End Class
  4981. #End Region
  4982.  
  4983. #Region "Listbox"
  4984. Class genesisListbox
  4985. Inherits ListBox
  4986.  
  4987. Public Sub New()
  4988. SetStyle(ControlStyles.DoubleBuffer, True)
  4989. Font = New Font("Microsoft Sans Serif", 9)
  4990. BorderStyle = System.Windows.Forms.BorderStyle.None
  4991. DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed
  4992. ItemHeight = 21
  4993. ForeColor = Color.Black
  4994. BackColor = Color.FromArgb(250, 250, 250)
  4995. IntegralHeight = False
  4996. End Sub
  4997.  
  4998. Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
  4999. MyBase.WndProc(m)
  5000. If m.Msg = 15 Then
  5001. CustomPaint()
  5002. End If
  5003. End Sub
  5004.  
  5005. Private _Image As Image
  5006. Public Property ItemImage() As Image
  5007. Get
  5008. Return _Image
  5009. End Get
  5010. Set(value As Image)
  5011. _Image = value
  5012. End Set
  5013. End Property
  5014.  
  5015. Protected Overrides Sub OnDrawItem(e As System.Windows.Forms.DrawItemEventArgs)
  5016. Try
  5017. If e.Index < 0 Then
  5018. Return
  5019. End If
  5020. e.DrawBackground()
  5021. Dim rect As New Rectangle(New Point(e.Bounds.Left, e.Bounds.Top + 2), New Size(Bounds.Width, 16))
  5022. e.DrawFocusRectangle()
  5023. If Strings.InStr(e.State.ToString(), "Selected,") > 0 Then
  5024. Dim x2 As Rectangle = e.Bounds
  5025. Dim x3 As New Rectangle(x2.Location, New Size(x2.Width, (x2.Height / 2)))
  5026. Dim G1 As New LinearGradientBrush(New Point(x2.X, x2.Y), New Point(x2.X, x2.Y + x2.Height), Color.FromArgb(250, 250, 250), Color.FromArgb(210, 210, 210))
  5027. Dim H As New HatchBrush(HatchStyle.LightDownwardDiagonal, Color.FromArgb(10, Color.Black), Color.Transparent)
  5028. e.Graphics.FillRectangle(G1, x2)
  5029. G1.Dispose()
  5030. e.Graphics.FillRectangle(New SolidBrush(Color.FromArgb(250, 250, 250)), x3)
  5031. e.Graphics.FillRectangle(H, x2)
  5032. G1.Dispose()
  5033. e.Graphics.DrawString(" " & Items(e.Index).ToString(), Font, Brushes.Black, 5, e.Bounds.Y + (e.Bounds.Height \ 2) - 9)
  5034. e.Graphics.DrawRectangle(New Pen(Color.FromArgb(220, 220, 220)), New Rectangle(New Point(x2.Location.X, x2.Location.Y), New Size(x2.Width, x2.Height)))
  5035. Else
  5036. Dim x2 As Rectangle = e.Bounds
  5037. e.Graphics.DrawString(" " & Items(e.Index).ToString(), Font, Brushes.Black, 5, e.Bounds.Y + (e.Bounds.Height \ 2) - 9)
  5038. e.Graphics.DrawRectangle(New Pen(Color.FromArgb(240, 240, 240)), New Rectangle(New Point(x2.Location.X, x2.Location.Y), New Size(x2.Width, x2.Height)))
  5039. End If
  5040. e.Graphics.DrawRectangle(New Pen(Color.FromArgb(220, 220, 220)), New Rectangle(0, 0, Width - 1, Height - 1))
  5041. MyBase.OnDrawItem(e)
  5042. Catch ex As Exception
  5043. End Try
  5044. End Sub
  5045.  
  5046. Public Sub CustomPaint()
  5047. CreateGraphics().DrawRectangle(New Pen(Color.FromArgb(220, 220, 220)), New Rectangle(0, 0, Width - 1, Height - 1))
  5048. End Sub
  5049. End Class
  5050. #End Region
Advertisement
Add Comment
Please, Sign In to add comment