Advertisement
ThePrinCe

AurumTheme

Dec 19th, 2011
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 81.94 KB | None | 0 0
  1. #Region "imports"
  2. Imports System, System.IO, System.Collections.Generic
  3. Imports System.Drawing, System.Drawing.Drawing2D
  4. Imports System.ComponentModel, System.Windows.Forms
  5. Imports System.Runtime.InteropServices
  6. Imports System.Drawing.Imaging
  7.  
  8. #End Region
  9. #Region " Theme Bases"
  10.  
  11.  
  12. MustInherit Class ThemeContainer153
  13. Inherits ContainerControl
  14.  
  15. #Region " Initialization "
  16.  
  17. Protected G As Graphics, B As Bitmap
  18.  
  19. Sub New()
  20. SetStyle(DirectCast(139270, ControlStyles), True)
  21.  
  22. _ImageSize = Size.Empty
  23. Font = New Font("Verdana", 8S)
  24.  
  25. MeasureBitmap = New Bitmap(1, 1)
  26. MeasureGraphics = Graphics.FromImage(MeasureBitmap)
  27.  
  28. DrawRadialPath = New GraphicsPath
  29.  
  30. InvalidateCustimization() 'Remove?
  31. End Sub
  32.  
  33. Protected NotOverridable Overrides Sub OnHandleCreated(ByVal e As EventArgs)
  34. InvalidateCustimization()
  35. ColorHook()
  36.  
  37. If Not _LockWidth = 0 Then Width = _LockWidth
  38. If Not _LockHeight = 0 Then Height = _LockHeight
  39. If Not _ControlMode Then MyBase.Dock = DockStyle.Fill
  40.  
  41. Transparent = _Transparent
  42. If _Transparent AndAlso _BackColor Then BackColor = Color.Transparent
  43.  
  44. MyBase.OnHandleCreated(e)
  45. End Sub
  46.  
  47. Protected NotOverridable Overrides Sub OnParentChanged(ByVal e As EventArgs)
  48. MyBase.OnParentChanged(e)
  49.  
  50. If Parent Is Nothing Then Return
  51. _IsParentForm = TypeOf Parent Is Form
  52.  
  53. If Not _ControlMode Then
  54. InitializeMessages()
  55.  
  56. If _IsParentForm Then
  57. ParentForm.FormBorderStyle = _BorderStyle
  58. ParentForm.TransparencyKey = _TransparencyKey
  59. End If
  60.  
  61. Parent.BackColor = BackColor
  62. End If
  63.  
  64. OnCreation()
  65. End Sub
  66.  
  67. #End Region
  68.  
  69.  
  70. Protected NotOverridable Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  71. If Width = 0 OrElse Height = 0 Then Return
  72.  
  73. If _Transparent AndAlso _ControlMode Then
  74. PaintHook()
  75. e.Graphics.DrawImage(B, 0, 0)
  76. Else
  77. G = e.Graphics
  78. PaintHook()
  79. End If
  80. End Sub
  81.  
  82.  
  83. #Region " Size Handling "
  84.  
  85. Private Frame As Rectangle
  86. Protected NotOverridable Overrides Sub OnSizeChanged(ByVal e As EventArgs)
  87. If _Movable AndAlso Not _ControlMode Then
  88. Frame = New Rectangle(7, 7, Width - 14, _Header - 7)
  89. End If
  90.  
  91. InvalidateBitmap()
  92. Invalidate()
  93.  
  94. MyBase.OnSizeChanged(e)
  95. End Sub
  96.  
  97. Protected Overrides Sub SetBoundsCore(ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal specified As BoundsSpecified)
  98. If Not _LockWidth = 0 Then width = _LockWidth
  99. If Not _LockHeight = 0 Then height = _LockHeight
  100. MyBase.SetBoundsCore(x, y, width, height, specified)
  101. End Sub
  102.  
  103. #End Region
  104.  
  105. #Region " State Handling "
  106.  
  107. Protected State As MouseState
  108. Private Sub SetState(ByVal current As MouseState)
  109. State = current
  110. Invalidate()
  111. End Sub
  112.  
  113. Protected Overrides Sub OnMouseMove(ByVal e As MouseEventArgs)
  114. If Not (_IsParentForm AndAlso ParentForm.WindowState = FormWindowState.Maximized) Then
  115. If _Sizable AndAlso Not _ControlMode Then InvalidateMouse()
  116. End If
  117.  
  118. MyBase.OnMouseMove(e)
  119. End Sub
  120.  
  121. Protected Overrides Sub OnEnabledChanged(ByVal e As EventArgs)
  122. If Enabled Then SetState(MouseState.None) Else SetState(MouseState.Block)
  123. MyBase.OnEnabledChanged(e)
  124. End Sub
  125.  
  126. Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
  127. SetState(MouseState.Over)
  128. MyBase.OnMouseEnter(e)
  129. End Sub
  130.  
  131. Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  132. SetState(MouseState.Over)
  133. MyBase.OnMouseUp(e)
  134. End Sub
  135.  
  136. Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
  137. SetState(MouseState.None)
  138.  
  139. If GetChildAtPoint(PointToClient(MousePosition)) IsNot Nothing Then
  140. If _Sizable AndAlso Not _ControlMode Then
  141. Cursor = Cursors.Default
  142. Previous = 0
  143. End If
  144. End If
  145.  
  146. MyBase.OnMouseLeave(e)
  147. End Sub
  148.  
  149. Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  150. If e.Button = Windows.Forms.MouseButtons.Left Then SetState(MouseState.Down)
  151.  
  152. If Not (_IsParentForm AndAlso ParentForm.WindowState = FormWindowState.Maximized OrElse _ControlMode) Then
  153. If _Movable AndAlso Frame.Contains(e.Location) Then
  154. Capture = False
  155. WM_LMBUTTONDOWN = True
  156. DefWndProc(Messages(0))
  157. ElseIf _Sizable AndAlso Not Previous = 0 Then
  158. Capture = False
  159. WM_LMBUTTONDOWN = True
  160. DefWndProc(Messages(Previous))
  161. End If
  162. End If
  163.  
  164. MyBase.OnMouseDown(e)
  165. End Sub
  166.  
  167. Private WM_LMBUTTONDOWN As Boolean
  168. Protected Overrides Sub WndProc(ByRef m As Message)
  169. MyBase.WndProc(m)
  170.  
  171. If WM_LMBUTTONDOWN AndAlso m.Msg = 513 Then
  172. WM_LMBUTTONDOWN = False
  173.  
  174. SetState(MouseState.Over)
  175. If Not _SmartBounds Then Return
  176.  
  177. If IsParentMdi Then
  178. CorrectBounds(New Rectangle(Point.Empty, Parent.Parent.Size))
  179. Else
  180. CorrectBounds(Screen.FromControl(Parent).WorkingArea)
  181. End If
  182. End If
  183. End Sub
  184.  
  185. Private GetIndexPoint As Point
  186. Private B1, B2, B3, B4 As Boolean
  187. Private Function GetIndex() As Integer
  188. GetIndexPoint = PointToClient(MousePosition)
  189. B1 = GetIndexPoint.X < 7
  190. B2 = GetIndexPoint.X > Width - 7
  191. B3 = GetIndexPoint.Y < 7
  192. B4 = GetIndexPoint.Y > Height - 7
  193.  
  194. If B1 AndAlso B3 Then Return 4
  195. If B1 AndAlso B4 Then Return 7
  196. If B2 AndAlso B3 Then Return 5
  197. If B2 AndAlso B4 Then Return 8
  198. If B1 Then Return 1
  199. If B2 Then Return 2
  200. If B3 Then Return 3
  201. If B4 Then Return 6
  202. Return 0
  203. End Function
  204.  
  205. Private Current, Previous As Integer
  206. Private Sub InvalidateMouse()
  207. Current = GetIndex()
  208. If Current = Previous Then Return
  209.  
  210. Previous = Current
  211. Select Case Previous
  212. Case 0
  213. Cursor = Cursors.Default
  214. Case 1, 2
  215. Cursor = Cursors.SizeWE
  216. Case 3, 6
  217. Cursor = Cursors.SizeNS
  218. Case 4, 8
  219. Cursor = Cursors.SizeNWSE
  220. Case 5, 7
  221. Cursor = Cursors.SizeNESW
  222. End Select
  223. End Sub
  224.  
  225. Private Messages(8) As Message
  226. Private Sub InitializeMessages()
  227. Messages(0) = Message.Create(Parent.Handle, 161, New IntPtr(2), IntPtr.Zero)
  228. For I As Integer = 1 To 8
  229. Messages(I) = Message.Create(Parent.Handle, 161, New IntPtr(I + 9), IntPtr.Zero)
  230. Next
  231. End Sub
  232.  
  233. Private Sub CorrectBounds(ByVal bounds As Rectangle)
  234. If Parent.Width > bounds.Width Then Parent.Width = bounds.Width
  235. If Parent.Height > bounds.Height Then Parent.Height = bounds.Height
  236.  
  237. Dim X As Integer = Parent.Location.X
  238. Dim Y As Integer = Parent.Location.Y
  239.  
  240. If X < bounds.X Then X = bounds.X
  241. If Y < bounds.Y Then Y = bounds.Y
  242.  
  243. Dim Width As Integer = bounds.X + bounds.Width
  244. Dim Height As Integer = bounds.Y + bounds.Height
  245.  
  246. If X + Parent.Width > Width Then X = Width - Parent.Width
  247. If Y + Parent.Height > Height Then Y = Height - Parent.Height
  248.  
  249. Parent.Location = New Point(X, Y)
  250. End Sub
  251.  
  252. #End Region
  253.  
  254.  
  255. #Region " Base Properties "
  256.  
  257. Overrides Property Dock As DockStyle
  258. Get
  259. Return MyBase.Dock
  260. End Get
  261. Set(ByVal value As DockStyle)
  262. If Not _ControlMode Then Return
  263. MyBase.Dock = value
  264. End Set
  265. End Property
  266.  
  267. Private _BackColor As Boolean
  268. <Category("Misc")> _
  269. Overrides Property BackColor() As Color
  270. Get
  271. Return MyBase.BackColor
  272. End Get
  273. Set(ByVal value As Color)
  274. If value = MyBase.BackColor Then Return
  275.  
  276. If Not IsHandleCreated AndAlso _ControlMode AndAlso value = Color.Transparent Then
  277. _BackColor = True
  278. Return
  279. End If
  280.  
  281. MyBase.BackColor = value
  282. If Parent IsNot Nothing Then
  283. If Not _ControlMode Then Parent.BackColor = value
  284. ColorHook()
  285. End If
  286. End Set
  287. End Property
  288.  
  289. Overrides Property MinimumSize As Size
  290. Get
  291. Return MyBase.MinimumSize
  292. End Get
  293. Set(ByVal value As Size)
  294. MyBase.MinimumSize = value
  295. If Parent IsNot Nothing Then Parent.MinimumSize = value
  296. End Set
  297. End Property
  298.  
  299. Overrides Property MaximumSize As Size
  300. Get
  301. Return MyBase.MaximumSize
  302. End Get
  303. Set(ByVal value As Size)
  304. MyBase.MaximumSize = value
  305. If Parent IsNot Nothing Then Parent.MaximumSize = value
  306. End Set
  307. End Property
  308.  
  309. Overrides Property Text() As String
  310. Get
  311. Return MyBase.Text
  312. End Get
  313. Set(ByVal value As String)
  314. MyBase.Text = value
  315. Invalidate()
  316. End Set
  317. End Property
  318.  
  319. Overrides Property Font() As Font
  320. Get
  321. Return MyBase.Font
  322. End Get
  323. Set(ByVal value As Font)
  324. MyBase.Font = value
  325. Invalidate()
  326. End Set
  327. End Property
  328.  
  329. <Browsable(False), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
  330. Overrides Property ForeColor() As Color
  331. Get
  332. Return Color.Empty
  333. End Get
  334. Set(ByVal value As Color)
  335. End Set
  336. End Property
  337. <Browsable(False), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
  338. Overrides Property BackgroundImage() As Image
  339. Get
  340. Return Nothing
  341. End Get
  342. Set(ByVal value As Image)
  343. End Set
  344. End Property
  345. <Browsable(False), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
  346. Overrides Property BackgroundImageLayout() As ImageLayout
  347. Get
  348. Return ImageLayout.None
  349. End Get
  350. Set(ByVal value As ImageLayout)
  351. End Set
  352. End Property
  353.  
  354. #End Region
  355.  
  356. #Region " Public Properties "
  357.  
  358. Private _SmartBounds As Boolean = True
  359. Property SmartBounds() As Boolean
  360. Get
  361. Return _SmartBounds
  362. End Get
  363. Set(ByVal value As Boolean)
  364. _SmartBounds = value
  365. End Set
  366. End Property
  367.  
  368. Private _Movable As Boolean = True
  369. Property Movable() As Boolean
  370. Get
  371. Return _Movable
  372. End Get
  373. Set(ByVal value As Boolean)
  374. _Movable = value
  375. End Set
  376. End Property
  377.  
  378. Private _Sizable As Boolean = True
  379. Property Sizable() As Boolean
  380. Get
  381. Return _Sizable
  382. End Get
  383. Set(ByVal value As Boolean)
  384. _Sizable = value
  385. End Set
  386. End Property
  387.  
  388. Private _TransparencyKey As Color
  389. Property TransparencyKey() As Color
  390. Get
  391. If _IsParentForm AndAlso Not _ControlMode Then Return ParentForm.TransparencyKey Else Return _TransparencyKey
  392. End Get
  393. Set(ByVal value As Color)
  394. If value = _TransparencyKey Then Return
  395. _TransparencyKey = value
  396.  
  397. If _IsParentForm AndAlso Not _ControlMode Then
  398. ParentForm.TransparencyKey = value
  399. ColorHook()
  400. End If
  401. End Set
  402. End Property
  403.  
  404. Private _BorderStyle As FormBorderStyle
  405. Property BorderStyle() As FormBorderStyle
  406. Get
  407. If _IsParentForm AndAlso Not _ControlMode Then Return ParentForm.FormBorderStyle Else Return _BorderStyle
  408. End Get
  409. Set(ByVal value As FormBorderStyle)
  410. _BorderStyle = value
  411.  
  412. If _IsParentForm AndAlso Not _ControlMode Then
  413. ParentForm.FormBorderStyle = value
  414.  
  415. If Not value = FormBorderStyle.None Then
  416. Movable = False
  417. Sizable = False
  418. End If
  419. End If
  420. End Set
  421. End Property
  422.  
  423. Private _NoRounding As Boolean
  424. Property NoRounding() As Boolean
  425. Get
  426. Return _NoRounding
  427. End Get
  428. Set(ByVal v As Boolean)
  429. _NoRounding = v
  430. Invalidate()
  431. End Set
  432. End Property
  433.  
  434. Private _Image As Image
  435. Property Image() As Image
  436. Get
  437. Return _Image
  438. End Get
  439. Set(ByVal value As Image)
  440. If value Is Nothing Then _ImageSize = Size.Empty Else _ImageSize = value.Size
  441.  
  442. _Image = value
  443. Invalidate()
  444. End Set
  445. End Property
  446.  
  447. Private Items As New Dictionary(Of String, Color)
  448. Property Colors() As Bloom()
  449. Get
  450. Dim T As New List(Of Bloom)
  451. Dim E As Dictionary(Of String, Color).Enumerator = Items.GetEnumerator
  452.  
  453. While E.MoveNext
  454. T.Add(New Bloom(E.Current.Key, E.Current.Value))
  455. End While
  456.  
  457. Return T.ToArray
  458. End Get
  459. Set(ByVal value As Bloom())
  460. For Each B As Bloom In value
  461. If Items.ContainsKey(B.Name) Then Items(B.Name) = B.Value
  462. Next
  463.  
  464. InvalidateCustimization()
  465. ColorHook()
  466. Invalidate()
  467. End Set
  468. End Property
  469.  
  470. Private _Customization As String
  471. Property Customization() As String
  472. Get
  473. Return _Customization
  474. End Get
  475. Set(ByVal value As String)
  476. If value = _Customization Then Return
  477.  
  478. Dim Data As Byte()
  479. Dim Items As Bloom() = Colors
  480.  
  481. Try
  482. Data = Convert.FromBase64String(value)
  483. For I As Integer = 0 To Items.Length - 1
  484. Items(I).Value = Color.FromArgb(BitConverter.ToInt32(Data, I * 4))
  485. Next
  486. Catch
  487. Return
  488. End Try
  489.  
  490. _Customization = value
  491.  
  492. Colors = Items
  493. ColorHook()
  494. Invalidate()
  495. End Set
  496. End Property
  497.  
  498. Private _Transparent As Boolean
  499. Property Transparent() As Boolean
  500. Get
  501. Return _Transparent
  502. End Get
  503. Set(ByVal value As Boolean)
  504. _Transparent = value
  505. If Not (IsHandleCreated OrElse _ControlMode) Then Return
  506.  
  507. If Not value AndAlso Not BackColor.A = 255 Then
  508. Throw New Exception("Unable to change value to false while a transparent BackColor is in use.")
  509. End If
  510.  
  511. SetStyle(ControlStyles.Opaque, Not value)
  512. SetStyle(ControlStyles.SupportsTransparentBackColor, value)
  513.  
  514. InvalidateBitmap()
  515. Invalidate()
  516. End Set
  517. End Property
  518.  
  519. #End Region
  520.  
  521. #Region " Private Properties "
  522.  
  523. Private _ImageSize As Size
  524. Protected ReadOnly Property ImageSize() As Size
  525. Get
  526. Return _ImageSize
  527. End Get
  528. End Property
  529.  
  530. Private _IsParentForm As Boolean
  531. Protected ReadOnly Property IsParentForm As Boolean
  532. Get
  533. Return _IsParentForm
  534. End Get
  535. End Property
  536.  
  537. Protected ReadOnly Property IsParentMdi As Boolean
  538. Get
  539. If Parent Is Nothing Then Return False
  540. Return Parent.Parent IsNot Nothing
  541. End Get
  542. End Property
  543.  
  544. Private _LockWidth As Integer
  545. Protected Property LockWidth() As Integer
  546. Get
  547. Return _LockWidth
  548. End Get
  549. Set(ByVal value As Integer)
  550. _LockWidth = value
  551. If Not LockWidth = 0 AndAlso IsHandleCreated Then Width = LockWidth
  552. End Set
  553. End Property
  554.  
  555. Private _LockHeight As Integer
  556. Protected Property LockHeight() As Integer
  557. Get
  558. Return _LockHeight
  559. End Get
  560. Set(ByVal value As Integer)
  561. _LockHeight = value
  562. If Not LockHeight = 0 AndAlso IsHandleCreated Then Height = LockHeight
  563. End Set
  564. End Property
  565.  
  566. Private _Header As Integer = 24
  567. Protected Property Header() As Integer
  568. Get
  569. Return _Header
  570. End Get
  571. Set(ByVal v As Integer)
  572. _Header = v
  573.  
  574. If Not _ControlMode Then
  575. Frame = New Rectangle(7, 7, Width - 14, v - 7)
  576. Invalidate()
  577. End If
  578. End Set
  579. End Property
  580.  
  581. Private _ControlMode As Boolean
  582. Protected Property ControlMode() As Boolean
  583. Get
  584. Return _ControlMode
  585. End Get
  586. Set(ByVal v As Boolean)
  587. _ControlMode = v
  588.  
  589. Transparent = _Transparent
  590. If _Transparent AndAlso _BackColor Then BackColor = Color.Transparent
  591.  
  592. InvalidateBitmap()
  593. Invalidate()
  594. End Set
  595. End Property
  596.  
  597. #End Region
  598.  
  599.  
  600. #Region " Property Helpers "
  601.  
  602. Protected Function GetPen(ByVal name As String) As Pen
  603. Return New Pen(Items(name))
  604. End Function
  605. Protected Function GetPen(ByVal name As String, ByVal width As Single) As Pen
  606. Return New Pen(Items(name), width)
  607. End Function
  608.  
  609. Protected Function GetBrush(ByVal name As String) As SolidBrush
  610. Return New SolidBrush(Items(name))
  611. End Function
  612.  
  613. Protected Function GetColor(ByVal name As String) As Color
  614. Return Items(name)
  615. End Function
  616.  
  617. Protected Sub SetColor(ByVal name As String, ByVal value As Color)
  618. If Items.ContainsKey(name) Then Items(name) = value Else Items.Add(name, value)
  619. End Sub
  620. Protected Sub SetColor(ByVal name As String, ByVal r As Byte, ByVal g As Byte, ByVal b As Byte)
  621. SetColor(name, Color.FromArgb(r, g, b))
  622. End Sub
  623. Protected Sub SetColor(ByVal name As String, ByVal a As Byte, ByVal r As Byte, ByVal g As Byte, ByVal b As Byte)
  624. SetColor(name, Color.FromArgb(a, r, g, b))
  625. End Sub
  626. Protected Sub SetColor(ByVal name As String, ByVal a As Byte, ByVal value As Color)
  627. SetColor(name, Color.FromArgb(a, value))
  628. End Sub
  629.  
  630. Private Sub InvalidateBitmap()
  631. If _Transparent AndAlso _ControlMode Then
  632. If Width = 0 OrElse Height = 0 Then Return
  633. B = New Bitmap(Width, Height, PixelFormat.Format32bppPArgb)
  634. G = Graphics.FromImage(B)
  635. Else
  636. G = Nothing
  637. B = Nothing
  638. End If
  639. End Sub
  640.  
  641. Private Sub InvalidateCustimization()
  642. Dim M As New MemoryStream(Items.Count * 4)
  643.  
  644. For Each B As Bloom In Colors
  645. M.Write(BitConverter.GetBytes(B.Value.ToArgb), 0, 4)
  646. Next
  647.  
  648. M.Close()
  649. _Customization = Convert.ToBase64String(M.ToArray)
  650. End Sub
  651.  
  652. #End Region
  653.  
  654.  
  655. #Region " User Hooks "
  656.  
  657. Protected MustOverride Sub ColorHook()
  658. Protected MustOverride Sub PaintHook()
  659.  
  660. Protected Overridable Sub OnCreation()
  661. End Sub
  662.  
  663. #End Region
  664.  
  665.  
  666. #Region " Offset "
  667.  
  668. Private OffsetReturnRectangle As Rectangle
  669. Protected Function Offset(ByVal r As Rectangle, ByVal amount As Integer) As Rectangle
  670. OffsetReturnRectangle = New Rectangle(r.X + amount, r.Y + amount, r.Width - (amount * 2), r.Height - (amount * 2))
  671. Return OffsetReturnRectangle
  672. End Function
  673.  
  674. Private OffsetReturnSize As Size
  675. Protected Function Offset(ByVal s As Size, ByVal amount As Integer) As Size
  676. OffsetReturnSize = New Size(s.Width + amount, s.Height + amount)
  677. Return OffsetReturnSize
  678. End Function
  679.  
  680. Private OffsetReturnPoint As Point
  681. Protected Function Offset(ByVal p As Point, ByVal amount As Integer) As Point
  682. OffsetReturnPoint = New Point(p.X + amount, p.Y + amount)
  683. Return OffsetReturnPoint
  684. End Function
  685.  
  686. #End Region
  687.  
  688. #Region " Center "
  689.  
  690. Private CenterReturn As Point
  691.  
  692. Protected Function Center(ByVal p As Rectangle, ByVal c As Rectangle) As Point
  693. CenterReturn = New Point((p.Width \ 2 - c.Width \ 2) + p.X + c.X, (p.Height \ 2 - c.Height \ 2) + p.Y + c.Y)
  694. Return CenterReturn
  695. End Function
  696. Protected Function Center(ByVal p As Rectangle, ByVal c As Size) As Point
  697. CenterReturn = New Point((p.Width \ 2 - c.Width \ 2) + p.X, (p.Height \ 2 - c.Height \ 2) + p.Y)
  698. Return CenterReturn
  699. End Function
  700.  
  701. Protected Function Center(ByVal child As Rectangle) As Point
  702. Return Center(Width, Height, child.Width, child.Height)
  703. End Function
  704. Protected Function Center(ByVal child As Size) As Point
  705. Return Center(Width, Height, child.Width, child.Height)
  706. End Function
  707. Protected Function Center(ByVal childWidth As Integer, ByVal childHeight As Integer) As Point
  708. Return Center(Width, Height, childWidth, childHeight)
  709. End Function
  710.  
  711. Protected Function Center(ByVal p As Size, ByVal c As Size) As Point
  712. Return Center(p.Width, p.Height, c.Width, c.Height)
  713. End Function
  714.  
  715. Protected Function Center(ByVal pWidth As Integer, ByVal pHeight As Integer, ByVal cWidth As Integer, ByVal cHeight As Integer) As Point
  716. CenterReturn = New Point(pWidth \ 2 - cWidth \ 2, pHeight \ 2 - cHeight \ 2)
  717. Return CenterReturn
  718. End Function
  719.  
  720. #End Region
  721.  
  722. #Region " Measure "
  723.  
  724. Private MeasureBitmap As Bitmap
  725. Private MeasureGraphics As Graphics 'TODO: Potential issues during multi-threading.
  726.  
  727. Protected Function Measure() As Size
  728. Return MeasureGraphics.MeasureString(Text, Font, Width).ToSize
  729. End Function
  730. Protected Function Measure(ByVal text As String) As Size
  731. Return MeasureGraphics.MeasureString(text, Font, Width).ToSize
  732. End Function
  733.  
  734. #End Region
  735.  
  736.  
  737. #Region " DrawPixel "
  738.  
  739. Private DrawPixelBrush As SolidBrush
  740.  
  741. Protected Sub DrawPixel(ByVal c1 As Color, ByVal x As Integer, ByVal y As Integer)
  742. If _Transparent Then
  743. B.SetPixel(x, y, c1)
  744. Else
  745. DrawPixelBrush = New SolidBrush(c1)
  746. G.FillRectangle(DrawPixelBrush, x, y, 1, 1)
  747. End If
  748. End Sub
  749.  
  750. #End Region
  751.  
  752. #Region " DrawCorners "
  753.  
  754. Private DrawCornersBrush As SolidBrush
  755.  
  756. Protected Sub DrawCorners(ByVal c1 As Color, ByVal offset As Integer)
  757. DrawCorners(c1, 0, 0, Width, Height, offset)
  758. End Sub
  759. Protected Sub DrawCorners(ByVal c1 As Color, ByVal r1 As Rectangle, ByVal offset As Integer)
  760. DrawCorners(c1, r1.X, r1.Y, r1.Width, r1.Height, offset)
  761. End Sub
  762. 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)
  763. DrawCorners(c1, x + offset, y + offset, width - (offset * 2), height - (offset * 2))
  764. End Sub
  765.  
  766. Protected Sub DrawCorners(ByVal c1 As Color)
  767. DrawCorners(c1, 0, 0, Width, Height)
  768. End Sub
  769. Protected Sub DrawCorners(ByVal c1 As Color, ByVal r1 As Rectangle)
  770. DrawCorners(c1, r1.X, r1.Y, r1.Width, r1.Height)
  771. End Sub
  772. Protected Sub DrawCorners(ByVal c1 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
  773. If _NoRounding Then Return
  774.  
  775. If _Transparent Then
  776. B.SetPixel(x, y, c1)
  777. B.SetPixel(x + (width - 1), y, c1)
  778. B.SetPixel(x, y + (height - 1), c1)
  779. B.SetPixel(x + (width - 1), y + (height - 1), c1)
  780. Else
  781. DrawCornersBrush = New SolidBrush(c1)
  782. G.FillRectangle(DrawCornersBrush, x, y, 1, 1)
  783. G.FillRectangle(DrawCornersBrush, x + (width - 1), y, 1, 1)
  784. G.FillRectangle(DrawCornersBrush, x, y + (height - 1), 1, 1)
  785. G.FillRectangle(DrawCornersBrush, x + (width - 1), y + (height - 1), 1, 1)
  786. End If
  787. End Sub
  788.  
  789. #End Region
  790.  
  791. #Region " DrawBorders "
  792.  
  793. Protected Sub DrawBorders(ByVal p1 As Pen, ByVal offset As Integer)
  794. DrawBorders(p1, 0, 0, Width, Height, offset)
  795. End Sub
  796. Protected Sub DrawBorders(ByVal p1 As Pen, ByVal r As Rectangle, ByVal offset As Integer)
  797. DrawBorders(p1, r.X, r.Y, r.Width, r.Height, offset)
  798. End Sub
  799. 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)
  800. DrawBorders(p1, x + offset, y + offset, width - (offset * 2), height - (offset * 2))
  801. End Sub
  802.  
  803. Protected Sub DrawBorders(ByVal p1 As Pen)
  804. DrawBorders(p1, 0, 0, Width, Height)
  805. End Sub
  806. Protected Sub DrawBorders(ByVal p1 As Pen, ByVal r As Rectangle)
  807. DrawBorders(p1, r.X, r.Y, r.Width, r.Height)
  808. End Sub
  809. Protected Sub DrawBorders(ByVal p1 As Pen, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
  810. G.DrawRectangle(p1, x, y, width - 1, height - 1)
  811. End Sub
  812.  
  813. #End Region
  814.  
  815. #Region " DrawText "
  816.  
  817. Private DrawTextPoint As Point
  818. Private DrawTextSize As Size
  819.  
  820. Protected Sub DrawText(ByVal b1 As Brush, ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
  821. DrawText(b1, Text, a, x, y)
  822. End Sub
  823. Protected Sub DrawText(ByVal b1 As Brush, ByVal text As String, ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
  824. If text.Length = 0 Then Return
  825.  
  826. DrawTextSize = Measure(text)
  827. DrawTextPoint = New Point(Width \ 2 - DrawTextSize.Width \ 2, Header \ 2 - DrawTextSize.Height \ 2)
  828.  
  829. Select Case a
  830. Case HorizontalAlignment.Left
  831. G.DrawString(text, Font, b1, x, DrawTextPoint.Y + y)
  832. Case HorizontalAlignment.Center
  833. G.DrawString(text, Font, b1, DrawTextPoint.X + x, DrawTextPoint.Y + y)
  834. Case HorizontalAlignment.Right
  835. G.DrawString(text, Font, b1, Width - DrawTextSize.Width - x, DrawTextPoint.Y + y)
  836. End Select
  837. End Sub
  838.  
  839. Protected Sub DrawText(ByVal b1 As Brush, ByVal p1 As Point)
  840. If Text.Length = 0 Then Return
  841. G.DrawString(Text, Font, b1, p1)
  842. End Sub
  843. Protected Sub DrawText(ByVal b1 As Brush, ByVal x As Integer, ByVal y As Integer)
  844. If Text.Length = 0 Then Return
  845. G.DrawString(Text, Font, b1, x, y)
  846. End Sub
  847.  
  848. #End Region
  849.  
  850. #Region " DrawImage "
  851.  
  852. Private DrawImagePoint As Point
  853.  
  854. Protected Sub DrawImage(ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
  855. DrawImage(_Image, a, x, y)
  856. End Sub
  857. Protected Sub DrawImage(ByVal image As Image, ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
  858. If image Is Nothing Then Return
  859. DrawImagePoint = New Point(Width \ 2 - image.Width \ 2, Header \ 2 - image.Height \ 2)
  860.  
  861. Select Case a
  862. Case HorizontalAlignment.Left
  863. G.DrawImage(image, x, DrawImagePoint.Y + y, image.Width, image.Height)
  864. Case HorizontalAlignment.Center
  865. G.DrawImage(image, DrawImagePoint.X + x, DrawImagePoint.Y + y, image.Width, image.Height)
  866. Case HorizontalAlignment.Right
  867. G.DrawImage(image, Width - image.Width - x, DrawImagePoint.Y + y, image.Width, image.Height)
  868. End Select
  869. End Sub
  870.  
  871. Protected Sub DrawImage(ByVal p1 As Point)
  872. DrawImage(_Image, p1.X, p1.Y)
  873. End Sub
  874. Protected Sub DrawImage(ByVal x As Integer, ByVal y As Integer)
  875. DrawImage(_Image, x, y)
  876. End Sub
  877.  
  878. Protected Sub DrawImage(ByVal image As Image, ByVal p1 As Point)
  879. DrawImage(image, p1.X, p1.Y)
  880. End Sub
  881. Protected Sub DrawImage(ByVal image As Image, ByVal x As Integer, ByVal y As Integer)
  882. If image Is Nothing Then Return
  883. G.DrawImage(image, x, y, image.Width, image.Height)
  884. End Sub
  885.  
  886. #End Region
  887.  
  888. #Region " DrawGradient "
  889.  
  890. Private DrawGradientBrush As LinearGradientBrush
  891. Private DrawGradientRectangle As Rectangle
  892.  
  893. Protected Sub DrawGradient(ByVal blend As ColorBlend, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
  894. DrawGradientRectangle = New Rectangle(x, y, width, height)
  895. DrawGradient(blend, DrawGradientRectangle)
  896. End Sub
  897. 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)
  898. DrawGradientRectangle = New Rectangle(x, y, width, height)
  899. DrawGradient(blend, DrawGradientRectangle, angle)
  900. End Sub
  901.  
  902. Protected Sub DrawGradient(ByVal blend As ColorBlend, ByVal r As Rectangle)
  903. DrawGradientBrush = New LinearGradientBrush(r, Color.Empty, Color.Empty, 90.0F)
  904. DrawGradientBrush.InterpolationColors = blend
  905. G.FillRectangle(DrawGradientBrush, r)
  906. End Sub
  907. Protected Sub DrawGradient(ByVal blend As ColorBlend, ByVal r As Rectangle, ByVal angle As Single)
  908. DrawGradientBrush = New LinearGradientBrush(r, Color.Empty, Color.Empty, angle)
  909. DrawGradientBrush.InterpolationColors = blend
  910. G.FillRectangle(DrawGradientBrush, r)
  911. End Sub
  912.  
  913.  
  914. 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)
  915. DrawGradientRectangle = New Rectangle(x, y, width, height)
  916. DrawGradient(c1, c2, DrawGradientRectangle)
  917. End Sub
  918. 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)
  919. DrawGradientRectangle = New Rectangle(x, y, width, height)
  920. DrawGradient(c1, c2, DrawGradientRectangle, angle)
  921. End Sub
  922.  
  923. Protected Sub DrawGradient(ByVal c1 As Color, ByVal c2 As Color, ByVal r As Rectangle)
  924. DrawGradientBrush = New LinearGradientBrush(r, c1, c2, 90.0F)
  925. G.FillRectangle(DrawGradientBrush, r)
  926. End Sub
  927. Protected Sub DrawGradient(ByVal c1 As Color, ByVal c2 As Color, ByVal r As Rectangle, ByVal angle As Single)
  928. DrawGradientBrush = New LinearGradientBrush(r, c1, c2, angle)
  929. G.FillRectangle(DrawGradientBrush, r)
  930. End Sub
  931.  
  932. #End Region
  933.  
  934. #Region " DrawRadial "
  935.  
  936. Private DrawRadialPath As GraphicsPath
  937. Private DrawRadialBrush1 As PathGradientBrush
  938. Private DrawRadialBrush2 As LinearGradientBrush
  939. Private DrawRadialRectangle As Rectangle
  940.  
  941. Sub DrawRadial(ByVal blend As ColorBlend, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
  942. DrawRadialRectangle = New Rectangle(x, y, width, height)
  943. DrawRadial(blend, DrawRadialRectangle, width \ 2, height \ 2)
  944. End Sub
  945. 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)
  946. DrawRadialRectangle = New Rectangle(x, y, width, height)
  947. DrawRadial(blend, DrawRadialRectangle, center.X, center.Y)
  948. End Sub
  949. 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)
  950. DrawRadialRectangle = New Rectangle(x, y, width, height)
  951. DrawRadial(blend, DrawRadialRectangle, cx, cy)
  952. End Sub
  953.  
  954. Sub DrawRadial(ByVal blend As ColorBlend, ByVal r As Rectangle)
  955. DrawRadial(blend, r, r.Width \ 2, r.Height \ 2)
  956. End Sub
  957. Sub DrawRadial(ByVal blend As ColorBlend, ByVal r As Rectangle, ByVal center As Point)
  958. DrawRadial(blend, r, center.X, center.Y)
  959. End Sub
  960. Sub DrawRadial(ByVal blend As ColorBlend, ByVal r As Rectangle, ByVal cx As Integer, ByVal cy As Integer)
  961. DrawRadialPath.Reset()
  962. DrawRadialPath.AddEllipse(r.X, r.Y, r.Width - 1, r.Height - 1)
  963.  
  964. DrawRadialBrush1 = New PathGradientBrush(DrawRadialPath)
  965. DrawRadialBrush1.CenterPoint = New Point(r.X + cx, r.Y + cy)
  966. DrawRadialBrush1.InterpolationColors = blend
  967.  
  968. If G.SmoothingMode = SmoothingMode.AntiAlias Then
  969. G.FillEllipse(DrawRadialBrush1, r.X + 1, r.Y + 1, r.Width - 3, r.Height - 3)
  970. Else
  971. G.FillEllipse(DrawRadialBrush1, r)
  972. End If
  973. End Sub
  974.  
  975.  
  976. 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)
  977. DrawRadialRectangle = New Rectangle(x, y, width, height)
  978. DrawRadial(c1, c2, DrawGradientRectangle)
  979. End Sub
  980. 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)
  981. DrawRadialRectangle = New Rectangle(x, y, width, height)
  982. DrawRadial(c1, c2, DrawGradientRectangle, angle)
  983. End Sub
  984.  
  985. Protected Sub DrawRadial(ByVal c1 As Color, ByVal c2 As Color, ByVal r As Rectangle)
  986. DrawRadialBrush2 = New LinearGradientBrush(r, c1, c2, 90.0F)
  987. G.FillRectangle(DrawGradientBrush, r)
  988. End Sub
  989. Protected Sub DrawRadial(ByVal c1 As Color, ByVal c2 As Color, ByVal r As Rectangle, ByVal angle As Single)
  990. DrawRadialBrush2 = New LinearGradientBrush(r, c1, c2, angle)
  991. G.FillEllipse(DrawGradientBrush, r)
  992. End Sub
  993.  
  994. #End Region
  995.  
  996. End Class
  997. MustInherit Class ThemeControl153
  998. Inherits Control
  999.  
  1000.  
  1001. #Region " Initialization "
  1002.  
  1003. Protected G As Graphics, B As Bitmap
  1004.  
  1005. Sub New()
  1006. SetStyle(DirectCast(139270, ControlStyles), True)
  1007.  
  1008. _ImageSize = Size.Empty
  1009. Font = New Font("Verdana", 8S)
  1010.  
  1011. MeasureBitmap = New Bitmap(1, 1)
  1012. MeasureGraphics = Graphics.FromImage(MeasureBitmap)
  1013.  
  1014. DrawRadialPath = New GraphicsPath
  1015.  
  1016. InvalidateCustimization() 'Remove?
  1017. End Sub
  1018.  
  1019. Protected NotOverridable Overrides Sub OnHandleCreated(ByVal e As EventArgs)
  1020. InvalidateCustimization()
  1021. ColorHook()
  1022.  
  1023. If Not _LockWidth = 0 Then Width = _LockWidth
  1024. If Not _LockHeight = 0 Then Height = _LockHeight
  1025.  
  1026. Transparent = _Transparent
  1027. If _Transparent AndAlso _BackColor Then BackColor = Color.Transparent
  1028.  
  1029. MyBase.OnHandleCreated(e)
  1030. End Sub
  1031.  
  1032. Protected NotOverridable Overrides Sub OnParentChanged(ByVal e As EventArgs)
  1033. If Parent IsNot Nothing Then OnCreation()
  1034. MyBase.OnParentChanged(e)
  1035. End Sub
  1036.  
  1037. #End Region
  1038.  
  1039.  
  1040. Protected NotOverridable Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  1041. If Width = 0 OrElse Height = 0 Then Return
  1042.  
  1043. If _Transparent Then
  1044. PaintHook()
  1045. e.Graphics.DrawImage(B, 0, 0)
  1046. Else
  1047. G = e.Graphics
  1048. PaintHook()
  1049. End If
  1050. End Sub
  1051.  
  1052.  
  1053. #Region " Size Handling "
  1054.  
  1055. Protected NotOverridable Overrides Sub OnSizeChanged(ByVal e As EventArgs)
  1056. If _Transparent Then
  1057. InvalidateBitmap()
  1058. End If
  1059.  
  1060. Invalidate()
  1061. MyBase.OnSizeChanged(e)
  1062. End Sub
  1063.  
  1064. Protected Overrides Sub SetBoundsCore(ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal specified As BoundsSpecified)
  1065. If Not _LockWidth = 0 Then width = _LockWidth
  1066. If Not _LockHeight = 0 Then height = _LockHeight
  1067. MyBase.SetBoundsCore(x, y, width, height, specified)
  1068. End Sub
  1069.  
  1070. #End Region
  1071.  
  1072. #Region " State Handling "
  1073.  
  1074. Private InPosition As Boolean
  1075. Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
  1076. InPosition = True
  1077. SetState(MouseState.Over)
  1078. MyBase.OnMouseEnter(e)
  1079. End Sub
  1080.  
  1081. Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  1082. If InPosition Then SetState(MouseState.Over)
  1083. MyBase.OnMouseUp(e)
  1084. End Sub
  1085.  
  1086. Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  1087. If e.Button = Windows.Forms.MouseButtons.Left Then SetState(MouseState.Down)
  1088. MyBase.OnMouseDown(e)
  1089. End Sub
  1090.  
  1091. Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
  1092. InPosition = False
  1093. SetState(MouseState.None)
  1094. MyBase.OnMouseLeave(e)
  1095. End Sub
  1096.  
  1097. Protected Overrides Sub OnEnabledChanged(ByVal e As EventArgs)
  1098. If Enabled Then SetState(MouseState.None) Else SetState(MouseState.Block)
  1099. MyBase.OnEnabledChanged(e)
  1100. End Sub
  1101.  
  1102. Protected State As MouseState
  1103. Private Sub SetState(ByVal current As MouseState)
  1104. State = current
  1105. Invalidate()
  1106. End Sub
  1107.  
  1108. #End Region
  1109.  
  1110.  
  1111. #Region " Base Properties "
  1112.  
  1113. <Browsable(False), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
  1114. Overrides Property ForeColor() As Color
  1115. Get
  1116. Return Color.Empty
  1117. End Get
  1118. Set(ByVal value As Color)
  1119. End Set
  1120. End Property
  1121. <Browsable(False), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
  1122. Overrides Property BackgroundImage() As Image
  1123. Get
  1124. Return Nothing
  1125. End Get
  1126. Set(ByVal value As Image)
  1127. End Set
  1128. End Property
  1129. <Browsable(False), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
  1130. Overrides Property BackgroundImageLayout() As ImageLayout
  1131. Get
  1132. Return ImageLayout.None
  1133. End Get
  1134. Set(ByVal value As ImageLayout)
  1135. End Set
  1136. End Property
  1137.  
  1138. Overrides Property Text() As String
  1139. Get
  1140. Return MyBase.Text
  1141. End Get
  1142. Set(ByVal value As String)
  1143. MyBase.Text = value
  1144. Invalidate()
  1145. End Set
  1146. End Property
  1147. Overrides Property Font() As Font
  1148. Get
  1149. Return MyBase.Font
  1150. End Get
  1151. Set(ByVal value As Font)
  1152. MyBase.Font = value
  1153. Invalidate()
  1154. End Set
  1155. End Property
  1156.  
  1157. Private _BackColor As Boolean
  1158. <Category("Misc")> _
  1159. Overrides Property BackColor() As Color
  1160. Get
  1161. Return MyBase.BackColor
  1162. End Get
  1163. Set(ByVal value As Color)
  1164. If Not IsHandleCreated AndAlso value = Color.Transparent Then
  1165. _BackColor = True
  1166. Return
  1167. End If
  1168.  
  1169. MyBase.BackColor = value
  1170. If Parent IsNot Nothing Then ColorHook()
  1171. End Set
  1172. End Property
  1173.  
  1174. #End Region
  1175.  
  1176. #Region " Public Properties "
  1177.  
  1178. Private _NoRounding As Boolean
  1179. Property NoRounding() As Boolean
  1180. Get
  1181. Return _NoRounding
  1182. End Get
  1183. Set(ByVal v As Boolean)
  1184. _NoRounding = v
  1185. Invalidate()
  1186. End Set
  1187. End Property
  1188.  
  1189. Private _Image As Image
  1190. Property Image() As Image
  1191. Get
  1192. Return _Image
  1193. End Get
  1194. Set(ByVal value As Image)
  1195. If value Is Nothing Then
  1196. _ImageSize = Size.Empty
  1197. Else
  1198. _ImageSize = value.Size
  1199. End If
  1200.  
  1201. _Image = value
  1202. Invalidate()
  1203. End Set
  1204. End Property
  1205.  
  1206. Private _Transparent As Boolean
  1207. Property Transparent() As Boolean
  1208. Get
  1209. Return _Transparent
  1210. End Get
  1211. Set(ByVal value As Boolean)
  1212. _Transparent = value
  1213. If Not IsHandleCreated Then Return
  1214.  
  1215. If Not value AndAlso Not BackColor.A = 255 Then
  1216. Throw New Exception("Unable to change value to false while a transparent BackColor is in use.")
  1217. End If
  1218.  
  1219. SetStyle(ControlStyles.Opaque, Not value)
  1220. SetStyle(ControlStyles.SupportsTransparentBackColor, value)
  1221.  
  1222. If value Then InvalidateBitmap() Else B = Nothing
  1223. Invalidate()
  1224. End Set
  1225. End Property
  1226.  
  1227. Private Items As New Dictionary(Of String, Color)
  1228. Property Colors() As Bloom()
  1229. Get
  1230. Dim T As New List(Of Bloom)
  1231. Dim E As Dictionary(Of String, Color).Enumerator = Items.GetEnumerator
  1232.  
  1233. While E.MoveNext
  1234. T.Add(New Bloom(E.Current.Key, E.Current.Value))
  1235. End While
  1236.  
  1237. Return T.ToArray
  1238. End Get
  1239. Set(ByVal value As Bloom())
  1240. For Each B As Bloom In value
  1241. If Items.ContainsKey(B.Name) Then Items(B.Name) = B.Value
  1242. Next
  1243.  
  1244. InvalidateCustimization()
  1245. ColorHook()
  1246. Invalidate()
  1247. End Set
  1248. End Property
  1249.  
  1250. Private _Customization As String
  1251. Property Customization() As String
  1252. Get
  1253. Return _Customization
  1254. End Get
  1255. Set(ByVal value As String)
  1256. If value = _Customization Then Return
  1257.  
  1258. Dim Data As Byte()
  1259. Dim Items As Bloom() = Colors
  1260.  
  1261. Try
  1262. Data = Convert.FromBase64String(value)
  1263. For I As Integer = 0 To Items.Length - 1
  1264. Items(I).Value = Color.FromArgb(BitConverter.ToInt32(Data, I * 4))
  1265. Next
  1266. Catch
  1267. Return
  1268. End Try
  1269.  
  1270. _Customization = value
  1271.  
  1272. Colors = Items
  1273. ColorHook()
  1274. Invalidate()
  1275. End Set
  1276. End Property
  1277.  
  1278. #End Region
  1279.  
  1280. #Region " Private Properties "
  1281.  
  1282. Private _ImageSize As Size
  1283. Protected ReadOnly Property ImageSize() As Size
  1284. Get
  1285. Return _ImageSize
  1286. End Get
  1287. End Property
  1288.  
  1289. Private _LockWidth As Integer
  1290. Protected Property LockWidth() As Integer
  1291. Get
  1292. Return _LockWidth
  1293. End Get
  1294. Set(ByVal value As Integer)
  1295. _LockWidth = value
  1296. If Not LockWidth = 0 AndAlso IsHandleCreated Then Width = LockWidth
  1297. End Set
  1298. End Property
  1299.  
  1300. Private _LockHeight As Integer
  1301. Protected Property LockHeight() As Integer
  1302. Get
  1303. Return _LockHeight
  1304. End Get
  1305. Set(ByVal value As Integer)
  1306. _LockHeight = value
  1307. If Not LockHeight = 0 AndAlso IsHandleCreated Then Height = LockHeight
  1308. End Set
  1309. End Property
  1310.  
  1311. #End Region
  1312.  
  1313.  
  1314. #Region " Property Helpers "
  1315.  
  1316. Protected Function GetPen(ByVal name As String) As Pen
  1317. Return New Pen(Items(name))
  1318. End Function
  1319. Protected Function GetPen(ByVal name As String, ByVal width As Single) As Pen
  1320. Return New Pen(Items(name), width)
  1321. End Function
  1322.  
  1323. Protected Function GetBrush(ByVal name As String) As SolidBrush
  1324. Return New SolidBrush(Items(name))
  1325. End Function
  1326.  
  1327. Protected Function GetColor(ByVal name As String) As Color
  1328. Return Items(name)
  1329. End Function
  1330.  
  1331. Protected Sub SetColor(ByVal name As String, ByVal value As Color)
  1332. If Items.ContainsKey(name) Then Items(name) = value Else Items.Add(name, value)
  1333. End Sub
  1334. Protected Sub SetColor(ByVal name As String, ByVal r As Byte, ByVal g As Byte, ByVal b As Byte)
  1335. SetColor(name, Color.FromArgb(r, g, b))
  1336. End Sub
  1337. Protected Sub SetColor(ByVal name As String, ByVal a As Byte, ByVal r As Byte, ByVal g As Byte, ByVal b As Byte)
  1338. SetColor(name, Color.FromArgb(a, r, g, b))
  1339. End Sub
  1340. Protected Sub SetColor(ByVal name As String, ByVal a As Byte, ByVal value As Color)
  1341. SetColor(name, Color.FromArgb(a, value))
  1342. End Sub
  1343.  
  1344. Private Sub InvalidateBitmap()
  1345. If Width = 0 OrElse Height = 0 Then Return
  1346. B = New Bitmap(Width, Height, PixelFormat.Format32bppPArgb)
  1347. G = Graphics.FromImage(B)
  1348. End Sub
  1349.  
  1350. Private Sub InvalidateCustimization()
  1351. Dim M As New MemoryStream(Items.Count * 4)
  1352.  
  1353. For Each B As Bloom In Colors
  1354. M.Write(BitConverter.GetBytes(B.Value.ToArgb), 0, 4)
  1355. Next
  1356.  
  1357. M.Close()
  1358. _Customization = Convert.ToBase64String(M.ToArray)
  1359. End Sub
  1360.  
  1361. #End Region
  1362.  
  1363.  
  1364. #Region " User Hooks "
  1365.  
  1366. Protected MustOverride Sub ColorHook()
  1367. Protected MustOverride Sub PaintHook()
  1368.  
  1369. Protected Overridable Sub OnCreation()
  1370. End Sub
  1371.  
  1372. #End Region
  1373.  
  1374.  
  1375. #Region " Offset "
  1376.  
  1377. Private OffsetReturnRectangle As Rectangle
  1378. Protected Function Offset(ByVal r As Rectangle, ByVal amount As Integer) As Rectangle
  1379. OffsetReturnRectangle = New Rectangle(r.X + amount, r.Y + amount, r.Width - (amount * 2), r.Height - (amount * 2))
  1380. Return OffsetReturnRectangle
  1381. End Function
  1382.  
  1383. Private OffsetReturnSize As Size
  1384. Protected Function Offset(ByVal s As Size, ByVal amount As Integer) As Size
  1385. OffsetReturnSize = New Size(s.Width + amount, s.Height + amount)
  1386. Return OffsetReturnSize
  1387. End Function
  1388.  
  1389. Private OffsetReturnPoint As Point
  1390. Protected Function Offset(ByVal p As Point, ByVal amount As Integer) As Point
  1391. OffsetReturnPoint = New Point(p.X + amount, p.Y + amount)
  1392. Return OffsetReturnPoint
  1393. End Function
  1394.  
  1395. #End Region
  1396.  
  1397. #Region " Center "
  1398.  
  1399. Private CenterReturn As Point
  1400.  
  1401. Protected Function Center(ByVal p As Rectangle, ByVal c As Rectangle) As Point
  1402. CenterReturn = New Point((p.Width \ 2 - c.Width \ 2) + p.X + c.X, (p.Height \ 2 - c.Height \ 2) + p.Y + c.Y)
  1403. Return CenterReturn
  1404. End Function
  1405. Protected Function Center(ByVal p As Rectangle, ByVal c As Size) As Point
  1406. CenterReturn = New Point((p.Width \ 2 - c.Width \ 2) + p.X, (p.Height \ 2 - c.Height \ 2) + p.Y)
  1407. Return CenterReturn
  1408. End Function
  1409.  
  1410. Protected Function Center(ByVal child As Rectangle) As Point
  1411. Return Center(Width, Height, child.Width, child.Height)
  1412. End Function
  1413. Protected Function Center(ByVal child As Size) As Point
  1414. Return Center(Width, Height, child.Width, child.Height)
  1415. End Function
  1416. Protected Function Center(ByVal childWidth As Integer, ByVal childHeight As Integer) As Point
  1417. Return Center(Width, Height, childWidth, childHeight)
  1418. End Function
  1419.  
  1420. Protected Function Center(ByVal p As Size, ByVal c As Size) As Point
  1421. Return Center(p.Width, p.Height, c.Width, c.Height)
  1422. End Function
  1423.  
  1424. Protected Function Center(ByVal pWidth As Integer, ByVal pHeight As Integer, ByVal cWidth As Integer, ByVal cHeight As Integer) As Point
  1425. CenterReturn = New Point(pWidth \ 2 - cWidth \ 2, pHeight \ 2 - cHeight \ 2)
  1426. Return CenterReturn
  1427. End Function
  1428.  
  1429. #End Region
  1430.  
  1431. #Region " Measure "
  1432.  
  1433. Private MeasureBitmap As Bitmap
  1434. Private MeasureGraphics As Graphics 'TODO: Potential issues during multi-threading.
  1435.  
  1436. Protected Function Measure() As Size
  1437. Return MeasureGraphics.MeasureString(Text, Font, Width).ToSize
  1438. End Function
  1439. Protected Function Measure(ByVal text As String) As Size
  1440. Return MeasureGraphics.MeasureString(text, Font, Width).ToSize
  1441. End Function
  1442.  
  1443. #End Region
  1444.  
  1445.  
  1446. #Region " DrawPixel "
  1447.  
  1448. Private DrawPixelBrush As SolidBrush
  1449.  
  1450. Protected Sub DrawPixel(ByVal c1 As Color, ByVal x As Integer, ByVal y As Integer)
  1451. If _Transparent Then
  1452. B.SetPixel(x, y, c1)
  1453. Else
  1454. DrawPixelBrush = New SolidBrush(c1)
  1455. G.FillRectangle(DrawPixelBrush, x, y, 1, 1)
  1456. End If
  1457. End Sub
  1458.  
  1459. #End Region
  1460.  
  1461. #Region " DrawCorners "
  1462.  
  1463. Private DrawCornersBrush As SolidBrush
  1464.  
  1465. Protected Sub DrawCorners(ByVal c1 As Color, ByVal offset As Integer)
  1466. DrawCorners(c1, 0, 0, Width, Height, offset)
  1467. End Sub
  1468. Protected Sub DrawCorners(ByVal c1 As Color, ByVal r1 As Rectangle, ByVal offset As Integer)
  1469. DrawCorners(c1, r1.X, r1.Y, r1.Width, r1.Height, offset)
  1470. End Sub
  1471. 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)
  1472. DrawCorners(c1, x + offset, y + offset, width - (offset * 2), height - (offset * 2))
  1473. End Sub
  1474.  
  1475. Protected Sub DrawCorners(ByVal c1 As Color)
  1476. DrawCorners(c1, 0, 0, Width, Height)
  1477. End Sub
  1478. Protected Sub DrawCorners(ByVal c1 As Color, ByVal r1 As Rectangle)
  1479. DrawCorners(c1, r1.X, r1.Y, r1.Width, r1.Height)
  1480. End Sub
  1481. Protected Sub DrawCorners(ByVal c1 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
  1482. If _NoRounding Then Return
  1483.  
  1484. If _Transparent Then
  1485. B.SetPixel(x, y, c1)
  1486. B.SetPixel(x + (width - 1), y, c1)
  1487. B.SetPixel(x, y + (height - 1), c1)
  1488. B.SetPixel(x + (width - 1), y + (height - 1), c1)
  1489. Else
  1490. DrawCornersBrush = New SolidBrush(c1)
  1491. G.FillRectangle(DrawCornersBrush, x, y, 1, 1)
  1492. G.FillRectangle(DrawCornersBrush, x + (width - 1), y, 1, 1)
  1493. G.FillRectangle(DrawCornersBrush, x, y + (height - 1), 1, 1)
  1494. G.FillRectangle(DrawCornersBrush, x + (width - 1), y + (height - 1), 1, 1)
  1495. End If
  1496. End Sub
  1497.  
  1498. #End Region
  1499.  
  1500. #Region " DrawBorders "
  1501.  
  1502. Protected Sub DrawBorders(ByVal p1 As Pen, ByVal offset As Integer)
  1503. DrawBorders(p1, 0, 0, Width, Height, offset)
  1504. End Sub
  1505. Protected Sub DrawBorders(ByVal p1 As Pen, ByVal r As Rectangle, ByVal offset As Integer)
  1506. DrawBorders(p1, r.X, r.Y, r.Width, r.Height, offset)
  1507. End Sub
  1508. 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)
  1509. DrawBorders(p1, x + offset, y + offset, width - (offset * 2), height - (offset * 2))
  1510. End Sub
  1511.  
  1512. Protected Sub DrawBorders(ByVal p1 As Pen)
  1513. DrawBorders(p1, 0, 0, Width, Height)
  1514. End Sub
  1515. Protected Sub DrawBorders(ByVal p1 As Pen, ByVal r As Rectangle)
  1516. DrawBorders(p1, r.X, r.Y, r.Width, r.Height)
  1517. End Sub
  1518. Protected Sub DrawBorders(ByVal p1 As Pen, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
  1519. G.DrawRectangle(p1, x, y, width - 1, height - 1)
  1520. End Sub
  1521.  
  1522. #End Region
  1523.  
  1524. #Region " DrawText "
  1525.  
  1526. Private DrawTextPoint As Point
  1527. Private DrawTextSize As Size
  1528.  
  1529. Protected Sub DrawText(ByVal b1 As Brush, ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
  1530. DrawText(b1, Text, a, x, y)
  1531. End Sub
  1532. Protected Sub DrawText(ByVal b1 As Brush, ByVal text As String, ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
  1533. If text.Length = 0 Then Return
  1534.  
  1535. DrawTextSize = Measure(text)
  1536. DrawTextPoint = Center(DrawTextSize)
  1537.  
  1538. Select Case a
  1539. Case HorizontalAlignment.Left
  1540. G.DrawString(text, Font, b1, x, DrawTextPoint.Y + y)
  1541. Case HorizontalAlignment.Center
  1542. G.DrawString(text, Font, b1, DrawTextPoint.X + x, DrawTextPoint.Y + y)
  1543. Case HorizontalAlignment.Right
  1544. G.DrawString(text, Font, b1, Width - DrawTextSize.Width - x, DrawTextPoint.Y + y)
  1545. End Select
  1546. End Sub
  1547.  
  1548. Protected Sub DrawText(ByVal b1 As Brush, ByVal p1 As Point)
  1549. If Text.Length = 0 Then Return
  1550. G.DrawString(Text, Font, b1, p1)
  1551. End Sub
  1552. Protected Sub DrawText(ByVal b1 As Brush, ByVal x As Integer, ByVal y As Integer)
  1553. If Text.Length = 0 Then Return
  1554. G.DrawString(Text, Font, b1, x, y)
  1555. End Sub
  1556.  
  1557. #End Region
  1558.  
  1559. #Region " DrawImage "
  1560.  
  1561. Private DrawImagePoint As Point
  1562.  
  1563. Protected Sub DrawImage(ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
  1564. DrawImage(_Image, a, x, y)
  1565. End Sub
  1566. Protected Sub DrawImage(ByVal image As Image, ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
  1567. If image Is Nothing Then Return
  1568. DrawImagePoint = Center(image.Size)
  1569.  
  1570. Select Case a
  1571. Case HorizontalAlignment.Left
  1572. G.DrawImage(image, x, DrawImagePoint.Y + y, image.Width, image.Height)
  1573. Case HorizontalAlignment.Center
  1574. G.DrawImage(image, DrawImagePoint.X + x, DrawImagePoint.Y + y, image.Width, image.Height)
  1575. Case HorizontalAlignment.Right
  1576. G.DrawImage(image, Width - image.Width - x, DrawImagePoint.Y + y, image.Width, image.Height)
  1577. End Select
  1578. End Sub
  1579.  
  1580. Protected Sub DrawImage(ByVal p1 As Point)
  1581. DrawImage(_Image, p1.X, p1.Y)
  1582. End Sub
  1583. Protected Sub DrawImage(ByVal x As Integer, ByVal y As Integer)
  1584. DrawImage(_Image, x, y)
  1585. End Sub
  1586.  
  1587. Protected Sub DrawImage(ByVal image As Image, ByVal p1 As Point)
  1588. DrawImage(image, p1.X, p1.Y)
  1589. End Sub
  1590. Protected Sub DrawImage(ByVal image As Image, ByVal x As Integer, ByVal y As Integer)
  1591. If image Is Nothing Then Return
  1592. G.DrawImage(image, x, y, image.Width, image.Height)
  1593. End Sub
  1594.  
  1595. #End Region
  1596.  
  1597. #Region " DrawGradient "
  1598.  
  1599. Private DrawGradientBrush As LinearGradientBrush
  1600. Private DrawGradientRectangle As Rectangle
  1601.  
  1602. Protected Sub DrawGradient(ByVal blend As ColorBlend, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
  1603. DrawGradientRectangle = New Rectangle(x, y, width, height)
  1604. DrawGradient(blend, DrawGradientRectangle)
  1605. End Sub
  1606. 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)
  1607. DrawGradientRectangle = New Rectangle(x, y, width, height)
  1608. DrawGradient(blend, DrawGradientRectangle, angle)
  1609. End Sub
  1610.  
  1611. Protected Sub DrawGradient(ByVal blend As ColorBlend, ByVal r As Rectangle)
  1612. DrawGradientBrush = New LinearGradientBrush(r, Color.Empty, Color.Empty, 90.0F)
  1613. DrawGradientBrush.InterpolationColors = blend
  1614. G.FillRectangle(DrawGradientBrush, r)
  1615. End Sub
  1616. Protected Sub DrawGradient(ByVal blend As ColorBlend, ByVal r As Rectangle, ByVal angle As Single)
  1617. DrawGradientBrush = New LinearGradientBrush(r, Color.Empty, Color.Empty, angle)
  1618. DrawGradientBrush.InterpolationColors = blend
  1619. G.FillRectangle(DrawGradientBrush, r)
  1620. End Sub
  1621.  
  1622.  
  1623. 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)
  1624. DrawGradientRectangle = New Rectangle(x, y, width, height)
  1625. DrawGradient(c1, c2, DrawGradientRectangle)
  1626. End Sub
  1627. 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)
  1628. DrawGradientRectangle = New Rectangle(x, y, width, height)
  1629. DrawGradient(c1, c2, DrawGradientRectangle, angle)
  1630. End Sub
  1631.  
  1632. Protected Sub DrawGradient(ByVal c1 As Color, ByVal c2 As Color, ByVal r As Rectangle)
  1633. DrawGradientBrush = New LinearGradientBrush(r, c1, c2, 90.0F)
  1634. G.FillRectangle(DrawGradientBrush, r)
  1635. End Sub
  1636. Protected Sub DrawGradient(ByVal c1 As Color, ByVal c2 As Color, ByVal r As Rectangle, ByVal angle As Single)
  1637. DrawGradientBrush = New LinearGradientBrush(r, c1, c2, angle)
  1638. G.FillRectangle(DrawGradientBrush, r)
  1639. End Sub
  1640.  
  1641. #End Region
  1642.  
  1643. #Region " DrawRadial "
  1644.  
  1645. Private DrawRadialPath As GraphicsPath
  1646. Private DrawRadialBrush1 As PathGradientBrush
  1647. Private DrawRadialBrush2 As LinearGradientBrush
  1648. Private DrawRadialRectangle As Rectangle
  1649.  
  1650. Sub DrawRadial(ByVal blend As ColorBlend, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
  1651. DrawRadialRectangle = New Rectangle(x, y, width, height)
  1652. DrawRadial(blend, DrawRadialRectangle, width \ 2, height \ 2)
  1653. End Sub
  1654. 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)
  1655. DrawRadialRectangle = New Rectangle(x, y, width, height)
  1656. DrawRadial(blend, DrawRadialRectangle, center.X, center.Y)
  1657. End Sub
  1658. 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)
  1659. DrawRadialRectangle = New Rectangle(x, y, width, height)
  1660. DrawRadial(blend, DrawRadialRectangle, cx, cy)
  1661. End Sub
  1662.  
  1663. Sub DrawRadial(ByVal blend As ColorBlend, ByVal r As Rectangle)
  1664. DrawRadial(blend, r, r.Width \ 2, r.Height \ 2)
  1665. End Sub
  1666. Sub DrawRadial(ByVal blend As ColorBlend, ByVal r As Rectangle, ByVal center As Point)
  1667. DrawRadial(blend, r, center.X, center.Y)
  1668. End Sub
  1669. Sub DrawRadial(ByVal blend As ColorBlend, ByVal r As Rectangle, ByVal cx As Integer, ByVal cy As Integer)
  1670. DrawRadialPath.Reset()
  1671. DrawRadialPath.AddEllipse(r.X, r.Y, r.Width - 1, r.Height - 1)
  1672.  
  1673. DrawRadialBrush1 = New PathGradientBrush(DrawRadialPath)
  1674. DrawRadialBrush1.CenterPoint = New Point(r.X + cx, r.Y + cy)
  1675. DrawRadialBrush1.InterpolationColors = blend
  1676.  
  1677. If G.SmoothingMode = SmoothingMode.AntiAlias Then
  1678. G.FillEllipse(DrawRadialBrush1, r.X + 1, r.Y + 1, r.Width - 3, r.Height - 3)
  1679. Else
  1680. G.FillEllipse(DrawRadialBrush1, r)
  1681. End If
  1682. End Sub
  1683.  
  1684.  
  1685. 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)
  1686. DrawRadialRectangle = New Rectangle(x, y, width, height)
  1687. DrawRadial(c1, c2, DrawRadialRectangle)
  1688. End Sub
  1689. 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)
  1690. DrawRadialRectangle = New Rectangle(x, y, width, height)
  1691. DrawRadial(c1, c2, DrawRadialRectangle, angle)
  1692. End Sub
  1693.  
  1694. Protected Sub DrawRadial(ByVal c1 As Color, ByVal c2 As Color, ByVal r As Rectangle)
  1695. DrawRadialBrush2 = New LinearGradientBrush(r, c1, c2, 90.0F)
  1696. G.FillEllipse(DrawRadialBrush2, r)
  1697. End Sub
  1698. Protected Sub DrawRadial(ByVal c1 As Color, ByVal c2 As Color, ByVal r As Rectangle, ByVal angle As Single)
  1699. DrawRadialBrush2 = New LinearGradientBrush(r, c1, c2, angle)
  1700. G.FillEllipse(DrawRadialBrush2, r)
  1701. End Sub
  1702.  
  1703. #End Region
  1704.  
  1705. End Class
  1706. Enum MouseState As Byte
  1707. None = 0
  1708. Over = 1
  1709. Down = 2
  1710. Block = 3
  1711. End Enum
  1712. Structure Bloom
  1713.  
  1714. Public _Name As String
  1715. ReadOnly Property Name() As String
  1716. Get
  1717. Return _Name
  1718. End Get
  1719. End Property
  1720.  
  1721. Private _Value As Color
  1722. Property Value() As Color
  1723. Get
  1724. Return _Value
  1725. End Get
  1726. Set(ByVal value As Color)
  1727. _Value = value
  1728. End Set
  1729. End Property
  1730.  
  1731. Sub New(ByVal name As String, ByVal value As Color)
  1732. _Name = name
  1733. _Value = value
  1734. End Sub
  1735. End Structure
  1736.  
  1737. #End Region
  1738.  
  1739.  
  1740. Class AurumTheme
  1741. Inherits ThemeContainer153
  1742. Sub New()
  1743. Header = 30
  1744. Font = New Font("Verdana", 8.25F)
  1745. End Sub
  1746. Protected Overrides Sub ColorHook()
  1747. End Sub
  1748. Dim C1 As Color = Color.FromArgb(35, 45, 56)
  1749. Dim C2 As Color = Color.FromArgb(33, 43, 53)
  1750. Private P1 As Pen
  1751. Protected Overrides Sub PaintHook()
  1752.  
  1753. G.Clear(Color.FromArgb(21, 31, 40))
  1754.  
  1755.  
  1756.  
  1757. Dim HeaderLGB As New LinearGradientBrush(New Rectangle(0, 0, Width, 15), Color.FromArgb(109, 118, 125), Color.FromArgb(51, 61, 70), 90S)
  1758. G.FillRectangle(HeaderLGB, New Rectangle(0, 0, Width, 15))
  1759.  
  1760.  
  1761.  
  1762. Dim RecLGB As New LinearGradientBrush(New Point(0, 0), New Point(0, Height), C1, C2)
  1763. Dim shadowLGB As New LinearGradientBrush(New Rectangle(9, 33, Width - 19, 20), Color.FromArgb(15, 25, 35), Color.FromArgb(35, 45, 50), 90S)
  1764. G.DrawRectangle(New Pen(New SolidBrush(Color.FromArgb(51, 61, 70))), New Rectangle(7, 31, Width - 16, Height - 40))
  1765. G.FillRectangle(RecLGB, New Rectangle(8, 32, Width - 18, Height - 42))
  1766. G.DrawRectangle(New Pen(New SolidBrush(Color.Black)), New Rectangle(8, 32, Width - 18, Height - 42))
  1767. G.FillRectangle(shadowLGB, New Rectangle(9, 33, Width - 19, 20))
  1768.  
  1769. P1 = New Pen(Color.FromArgb(61, 71, 80))
  1770. DrawBorders(P1, 1)
  1771. DrawBorders(New Pen(New SolidBrush(Color.Black)), ClientRectangle)
  1772.  
  1773.  
  1774. DrawText(New SolidBrush(Color.White), HorizontalAlignment.Center, 0, 0)
  1775.  
  1776.  
  1777. End Sub
  1778. End Class
  1779. Class AurumButton
  1780. Inherits ThemeControl153
  1781. Sub New()
  1782. Font = New Font("Verdana", 8.25F)
  1783. End Sub
  1784. Protected Overrides Sub ColorHook()
  1785. End Sub
  1786. Protected Overrides Sub PaintHook()
  1787.  
  1788. Select Case State
  1789. Case 0
  1790.  
  1791. G.Clear(Color.FromArgb(39, 49, 59))
  1792. G.DrawLine(New Pen(New SolidBrush(Color.FromArgb(60, 70, 80))), 2, Height - 1, Width - 2, Height - 1)
  1793. Dim BTNLGB As New LinearGradientBrush(New Rectangle(1, 1, Width - 2, Height / 2 - 2), Color.FromArgb(126, 135, 144), Color.FromArgb(76, 86, 96), 90S)
  1794. G.FillRectangle(BTNLGB, New Rectangle(1, 1, Width - 2, Height / 2 - 2))
  1795. G.DrawRectangle(New Pen(New SolidBrush(Color.FromArgb(66, 77, 84))), New Rectangle(1, 1, Width - 3, Height - 4))
  1796. G.DrawRectangle(New Pen(New SolidBrush(Color.FromArgb(19, 29, 39))), New Rectangle(0, 0, Width - 1, Height - 2))
  1797. DrawText(New SolidBrush(Color.FromArgb(222, 222, 222)), HorizontalAlignment.Center, 0, -2)
  1798.  
  1799. Case 1
  1800.  
  1801. G.Clear(Color.FromArgb(43, 53, 63))
  1802. G.DrawLine(New Pen(New SolidBrush(Color.FromArgb(40, 50, 60))), 2, Height - 1, Width - 4, Height - 1)
  1803. Dim BTNLGBOver As New LinearGradientBrush(New Rectangle(1, 1, Width - 2, Height / 2 - 2), Color.FromArgb(140, 149, 155), Color.FromArgb(87, 97, 107), 90S)
  1804. G.FillRectangle(BTNLGBOver, New Rectangle(1, 1, Width - 2, Height / 2 - 2))
  1805. DrawText(New SolidBrush(Color.White), HorizontalAlignment.Center, 0, -2)
  1806. Case 2
  1807.  
  1808. G.Clear(Color.FromArgb(30, 40, 50))
  1809. Dim BTNLGBOver As New LinearGradientBrush(New Rectangle(1, 1, Width - 2, Height / 2 - 2), Color.FromArgb(99, 108, 115), Color.FromArgb(46, 56, 66), 90S)
  1810. G.FillRectangle(BTNLGBOver, New Rectangle(1, 1, Width - 2, Height / 2 - 2))
  1811. G.DrawRectangle(New Pen(New SolidBrush(Color.FromArgb(0, 0, 0))), New Rectangle(1, 1, Width - 3, Height - 4))
  1812. DrawText(New SolidBrush(Color.FromArgb(210, 210, 210)), HorizontalAlignment.Center, 0, -2)
  1813.  
  1814. End Select
  1815.  
  1816.  
  1817. G.DrawRectangle(New Pen(New SolidBrush(Color.FromArgb(70, 80, 90))), New Rectangle(1, 1, Width - 3, Height - 4))
  1818. G.DrawRectangle(New Pen(New SolidBrush(Color.FromArgb(21, 31, 41))), New Rectangle(0, 0, Width - 1, Height - 2))
  1819.  
  1820. End Sub
  1821. End Class
  1822. Class AurumButtonOver
  1823. Inherits ThemeControl153
  1824. Sub New()
  1825. Font = New Font("Verdana", 8.25F)
  1826. End Sub
  1827. Protected Overrides Sub ColorHook()
  1828. End Sub
  1829. Protected Overrides Sub PaintHook()
  1830.  
  1831.  
  1832.  
  1833.  
  1834.  
  1835. G.Clear(Color.FromArgb(43, 53, 63))
  1836.  
  1837. Dim BTNLGBOver As New LinearGradientBrush(New Rectangle(1, 1, Width - 2, Height / 2 - 2), Color.FromArgb(140, 149, 155), Color.FromArgb(87, 97, 107), 90S)
  1838. G.FillRectangle(BTNLGBOver, New Rectangle(1, 1, Width - 2, Height / 2 - 2))
  1839. 'G.DrawRectangle(New Pen(New SolidBrush(Color.FromArgb(55, 66, 73))), New Rectangle(1, 1, Width - 3, Height - 4))
  1840. 'G.DrawRectangle(New Pen(New SolidBrush(Color.FromArgb(21, 31, 41))), New Rectangle(0, 0, Width - 1, Height - 2))
  1841. 'DrawBorders(New Pen(Color.FromArgb(63, 74, 81)), 3)
  1842.  
  1843.  
  1844.  
  1845.  
  1846. G.DrawRectangle(New Pen(New SolidBrush(Color.FromArgb(55, 66, 73))), New Rectangle(1, 1, Width - 3, Height - 4))
  1847. G.DrawRectangle(New Pen(New SolidBrush(Color.FromArgb(21, 31, 41))), New Rectangle(0, 0, Width - 1, Height - 2))
  1848.  
  1849.  
  1850.  
  1851. DrawText(New SolidBrush(Color.White), HorizontalAlignment.Center, 0, -2)
  1852. End Sub
  1853. End Class
  1854. Class AurumButtonDown
  1855. Inherits ThemeControl153
  1856. Sub New()
  1857. Font = New Font("Verdana", 8.25F)
  1858. End Sub
  1859. Protected Overrides Sub ColorHook()
  1860. End Sub
  1861. Protected Overrides Sub PaintHook()
  1862. G.Clear(Color.FromArgb(30, 40, 50))
  1863. Dim BTNLGBOver As New LinearGradientBrush(New Rectangle(1, 1, Width - 2, Height / 2 - 2), Color.FromArgb(99, 108, 115), Color.FromArgb(46, 56, 66), 90S)
  1864. G.FillRectangle(BTNLGBOver, New Rectangle(1, 1, Width - 2, Height / 2 - 2))
  1865. G.DrawRectangle(New Pen(New SolidBrush(Color.FromArgb(0, 0, 0))), New Rectangle(1, 1, Width - 3, Height - 4))
  1866. G.DrawRectangle(New Pen(New SolidBrush(Color.FromArgb(55, 66, 73))), New Rectangle(1, 1, Width - 3, Height - 4))
  1867. G.DrawRectangle(New Pen(New SolidBrush(Color.FromArgb(21, 31, 41))), New Rectangle(0, 0, Width - 1, Height - 2))
  1868. DrawText(New SolidBrush(Color.FromArgb(210, 210, 210)), HorizontalAlignment.Center, 0, -2)
  1869. End Sub
  1870. End Class
  1871. Class AurumPGBar
  1872. Inherits ThemeControl153
  1873. Private GlowAnimation As Timer = New Timer
  1874. Private _GlowColor As Color = Color.FromArgb(90, 255, 255, 255)
  1875. Private _Animate As Boolean = True
  1876. Private _Value As Int32 = 0
  1877. Private _HighlightColor As Color = Color.Silver
  1878. Private _BackgroundColor As Color = Color.FromArgb(150, 150, 150)
  1879. Private _StartColor As Color = Color.FromArgb(110, 110, 110)
  1880. #Region "Properties"
  1881. Public Property Color() As Color
  1882. Get
  1883. Return _StartColor
  1884. End Get
  1885. Set(ByVal value As Color)
  1886. _StartColor = value
  1887. Me.Invalidate()
  1888. End Set
  1889. End Property
  1890. Public Property Animate() As Boolean
  1891. Get
  1892. Return _Animate
  1893. End Get
  1894. Set(ByVal value As Boolean)
  1895. _Animate = value
  1896. If value = True Then
  1897. GlowAnimation.Start()
  1898. Else
  1899. GlowAnimation.Stop()
  1900. End If
  1901. Me.Invalidate()
  1902. End Set
  1903. End Property
  1904. Public Property GlowColor() As Color
  1905. Get
  1906. Return _GlowColor
  1907. End Get
  1908. Set(ByVal value As Color)
  1909. _GlowColor = value
  1910. Me.Invalidate()
  1911. End Set
  1912. End Property
  1913. Public Property Value() As Int32
  1914. Get
  1915. Return _Value
  1916. End Get
  1917. Set(ByVal value As Int32)
  1918. If value > 100 Or value < 0 Then Return
  1919. _Value = value
  1920. If value < 100 Then GlowAnimation.Start()
  1921. If value = 100 Then GlowAnimation.Stop()
  1922. Me.Invalidate()
  1923. End Set
  1924. End Property
  1925. Public Property BackgroundColor() As Color
  1926. Get
  1927. Return _BackgroundColor
  1928. End Get
  1929. Set(ByVal value As Color)
  1930. _BackgroundColor = value
  1931. Me.Invalidate()
  1932. End Set
  1933. End Property
  1934. Public Property HighlightColor() As Color
  1935. Get
  1936. Return _HighlightColor
  1937. End Get
  1938. Set(ByVal value As Color)
  1939. _HighlightColor = value
  1940. Me.Invalidate()
  1941. End Set
  1942. End Property
  1943. #End Region
  1944.  
  1945. Sub New()
  1946. If Not InDesignMode() Then
  1947. GlowAnimation.Interval = 15
  1948. If Value < 100 Then GlowAnimation.Start()
  1949. AddHandler GlowAnimation.Tick, AddressOf GlowAnimation_Tick
  1950. End If
  1951. End Sub
  1952. Private Function InDesignMode() As Boolean
  1953. Return (LicenseManager.UsageMode = LicenseUsageMode.Designtime)
  1954. End Function
  1955. Protected Overrides Sub ColorHook()
  1956.  
  1957. End Sub
  1958.  
  1959. Private _mGlowPosition As Integer = -325
  1960.  
  1961. Protected Overrides Sub PaintHook()
  1962.  
  1963.  
  1964.  
  1965. ' -------------------Draw Background for the MBProgressBar--------------------
  1966. Dim BackRectangle As Rectangle = Me.ClientRectangle
  1967. BackRectangle.Width = BackRectangle.Width - 1
  1968. BackRectangle.Height = BackRectangle.Height - 1
  1969. Dim GrafP As GraphicsPath = RoundRect(BackRectangle, 2, 2, 2, 2)
  1970. G.FillPath(New SolidBrush(Me.BackgroundColor), GrafP)
  1971.  
  1972.  
  1973. '--------------------Draw Background Shadows for MBProgrssBar------------------
  1974. Dim BGSH As Rectangle = New Rectangle(2, 2, 10, Me.Height - 5)
  1975. Dim LGBS As LinearGradientBrush = New LinearGradientBrush(BGSH, Color.FromArgb(0, 30, 60, 50), Color.Transparent, LinearGradientMode.Horizontal)
  1976. G.FillRectangle(LGBS, BGSH)
  1977. Dim BGSRectangle As Rectangle = New Rectangle(Me.Width - 12, 2, 10, Me.Height - 5)
  1978. Dim LG As LinearGradientBrush = New LinearGradientBrush(BGSH, Color.FromArgb(150, 150, 150), Color.FromArgb(0, 10, 30, 20), LinearGradientMode.Horizontal)
  1979. G.FillRectangle(LG, BGSRectangle)
  1980.  
  1981.  
  1982. '----------------------Draw MBProgressBar--------------------
  1983. Dim ProgressRect As Rectangle = New Rectangle(1, 2, Me.Width - 3, Me.Height - 3)
  1984. ProgressRect.Width = CInt((Value * 1.0F / (100) * Me.Width))
  1985. G.FillRectangle(New SolidBrush(Me.Color), ProgressRect)
  1986.  
  1987.  
  1988. '----------------------Draw Shadows for MBProgressBar------------------
  1989. Dim SHRect As Rectangle = New Rectangle(1, 2, 15, Me.Height - 3)
  1990. Dim LGSHP As LinearGradientBrush = New LinearGradientBrush(SHRect, Color.White, Color.White, LinearGradientMode.Horizontal)
  1991.  
  1992. Dim BColor As ColorBlend = New ColorBlend(3)
  1993. BColor.Colors = New Color() {Color.Gray, Color.FromArgb(40, 0, 0, 0), Color.Transparent}
  1994. BColor.Positions = New Single() {0.0F, 0.2F, 1.0F}
  1995. LGSHP.InterpolationColors = BColor
  1996.  
  1997. SHRect.X = SHRect.X - 1
  1998. G.FillRectangle(LGSHP, SHRect)
  1999.  
  2000. Dim Rect1 As Rectangle = New Rectangle(Me.Width - 3, 2, 15, Me.Height - 3)
  2001. Rect1.X = CInt((Value * 1.0F / (100) * Me.Width) - 14)
  2002. Dim LGSH1 As LinearGradientBrush = New LinearGradientBrush(Rect1, Color.Black, Color.Black, LinearGradientMode.Horizontal)
  2003.  
  2004. Dim BColor1 As ColorBlend = New ColorBlend(3)
  2005. BColor1.Colors = New Color() {Color.Transparent, Color.FromArgb(70, 0, 0, 0), Color.Transparent}
  2006. BColor1.Positions = New Single() {0.0F, 0.8F, 1.0F}
  2007. LGSH1.InterpolationColors = BColor1
  2008.  
  2009. G.FillRectangle(LGSH1, Rect1)
  2010.  
  2011.  
  2012. '-------------------------Draw Highlight for MBProgressBar-----------------
  2013. Dim HLRect As Rectangle = New Rectangle(1, 1, Me.Width - 1, 6)
  2014. Dim HLGPa As GraphicsPath = RoundRect(HLRect, 2, 2, 0, 0)
  2015. G.SetClip(HLGPa)
  2016. Dim HLGBS As LinearGradientBrush = New LinearGradientBrush(HLRect, Color.White, Color.FromArgb(128, Color.White), LinearGradientMode.Vertical)
  2017. G.FillPath(HLGBS, HLGPa)
  2018. G.ResetClip()
  2019. Dim HLrect2 As Rectangle = New Rectangle(1, Me.Height - 8, Me.Width - 1, 6)
  2020. Dim bp1 As GraphicsPath = RoundRect(HLrect2, 0, 0, 2, 2)
  2021. G.SetClip(bp1)
  2022. Dim bg1 As LinearGradientBrush = New LinearGradientBrush(HLrect2, Color.Transparent, Color.FromArgb(100, Me.HighlightColor), LinearGradientMode.Vertical)
  2023. G.FillPath(bg1, bp1)
  2024. G.ResetClip()
  2025.  
  2026.  
  2027. '--------------------Draw Inner Sroke for MBProgressBar--------------
  2028. Dim Rect20 As Rectangle = Me.ClientRectangle
  2029. Rect20.X = Rect20.X + 1
  2030. Rect20.Y = Rect20.Y + 1
  2031. Rect20.Width -= 3
  2032. Rect20.Height -= 3
  2033. Dim Rect15 As GraphicsPath = RoundRect(Rect20, 2, 2, 2, 2)
  2034. G.DrawPath(New Pen(Color.FromArgb(100, Color.Black)), Rect15)
  2035.  
  2036.  
  2037.  
  2038. '------------------------Draw Glow for MBProgressBar-----------------------
  2039. Dim GlowRect As Rectangle = New Rectangle(_mGlowPosition, 0, 60, 30)
  2040. Dim GlowLGBS As LinearGradientBrush = New LinearGradientBrush(GlowRect, Color.Gray, Color.Transparent, LinearGradientMode.Horizontal)
  2041. Dim BColor3 As ColorBlend = New ColorBlend(4)
  2042. BColor3.Colors = New Color() {Color.Transparent, Me.GlowColor, Me.GlowColor, Color.Transparent}
  2043. BColor3.Positions = New Single() {0.0F, 0.5F, 0.6F, 1.0F}
  2044. GlowLGBS.InterpolationColors = BColor3
  2045. Dim clip As Rectangle = New Rectangle(1, 2, Me.Width - 3, Me.Height - 3)
  2046. clip.Width = CInt((Value * 1.0F / (100) * Me.Width))
  2047. G.SetClip(clip)
  2048. G.FillRectangle(GlowLGBS, GlowRect)
  2049. G.ResetClip()
  2050.  
  2051.  
  2052. '-----------------------Draw Outer Stroke on the Control----------------------------
  2053. Dim StrokeRect As Rectangle = Me.ClientRectangle
  2054. StrokeRect.Width = StrokeRect.Width - 1
  2055. StrokeRect.Height = StrokeRect.Height - 1
  2056. Dim GGH As GraphicsPath = RoundRect(StrokeRect, 2, 2, 2, 2)
  2057. G.DrawPath(New Pen(Color.FromArgb(100, 100, 100)), GGH)
  2058. DrawCorners(Color.FromArgb(5, 15, 25), ClientRectangle)
  2059.  
  2060.  
  2061.  
  2062. End Sub
  2063. Private Function RoundRect(ByVal r As RectangleF, ByVal r1 As Single, ByVal r2 As Single, ByVal r3 As Single, ByVal r4 As Single) As GraphicsPath
  2064. Dim x As Single = r.X, y As Single = r.Y, w As Single = r.Width, h As Single = r.Height
  2065. Dim rr5 As GraphicsPath = New GraphicsPath
  2066. rr5.AddBezier(x, y + r1, x, y, x + r1, y, x + r1, y)
  2067. rr5.AddLine(x + r1, y, x + w - r2, y)
  2068. rr5.AddBezier(x + w - r2, y, x + w, y, x + w, y + r2, x + w, y + r2)
  2069. rr5.AddLine(x + w, y + r2, x + w, y + h - r3)
  2070. rr5.AddBezier(x + w, y + h - r3, x + w, y + h, x + w - r3, y + h, x + w - r3, y + h)
  2071. rr5.AddLine(x + w - r3, y + h, x + r4, y + h)
  2072. rr5.AddBezier(x + r4, y + h, x, y + h, x, y + h - r4, x, y + h - r4)
  2073. rr5.AddLine(x, y + h - r4, x, y + r1)
  2074. Return rr5
  2075. End Function
  2076. Private Sub GlowAnimation_Tick(ByVal sender As Object, ByVal e As EventArgs)
  2077. If Me.Animate Then
  2078. _mGlowPosition += 4
  2079. If _mGlowPosition > Me.Width Then
  2080. _mGlowPosition = -10
  2081. Me.Invalidate()
  2082. End If
  2083. Else
  2084. GlowAnimation.Stop()
  2085. _mGlowPosition = -50
  2086. End If
  2087. End Sub
  2088. End Class
  2089. Class AurumCheckBox
  2090. Inherits ThemeControl153
  2091. Private _CheckedState As Boolean
  2092. Public Property CheckedState() As Boolean
  2093. Get
  2094. Return _CheckedState
  2095. End Get
  2096. Set(ByVal v As Boolean)
  2097. _CheckedState = v
  2098. Invalidate()
  2099. End Set
  2100. End Property
  2101. Sub New()
  2102. Font = New Font("Verdana", 8.25F)
  2103. Size = New Size(90, 15)
  2104.  
  2105. MinimumSize = New Size(16, 16)
  2106. MaximumSize = New Size(600, 16)
  2107. CheckedState = False
  2108. End Sub
  2109. Protected Overrides Sub ColorHook()
  2110.  
  2111. End Sub
  2112. Dim P1 As Pen = New Pen(Color.FromArgb(20, 20, 20))
  2113. Dim P2 As Pen = New Pen(Color.FromArgb(80, 80, 80))
  2114. Dim InnerRectDown As LinearGradientBrush = New LinearGradientBrush(New Rectangle(4, 4, 9, 9), Color.FromArgb(48, 58, 68), Color.FromArgb(85, 85, 85), 90S)
  2115. Dim InnerRect As LinearGradientBrush = New LinearGradientBrush(New Rectangle(4, 4, 9, 9), Color.FromArgb(61, 71, 81), Color.FromArgb(100, 100, 100), 90S)
  2116. Dim InnerRectCheck As LinearGradientBrush = New LinearGradientBrush(New Rectangle(4, 4, 9, 9), Color.FromArgb(111, 121, 131), Color.FromArgb(160, 170, 180), 90S)
  2117.  
  2118. Protected Overrides Sub PaintHook()
  2119.  
  2120. G.Clear(Color.FromArgb(30, 40, 50))
  2121.  
  2122. Select Case CheckedState
  2123.  
  2124. Case True
  2125. 'G.SmoothingMode = SmoothingMode.HighQuality
  2126. G.FillRectangle(InnerRectCheck, 4, 4, 9, 9)
  2127. G.DrawRectangle(P1, 1, 1, 14, 14)
  2128. G.DrawRectangle(P2, 2, 2, 12, 12)
  2129. DrawText(New SolidBrush(Color.White), HorizontalAlignment.Left, 17, 0)
  2130. Case False
  2131.  
  2132.  
  2133. G.DrawRectangle(P1, 1, 1, 14, 14)
  2134. G.DrawRectangle(P2, 2, 2, 12, 12)
  2135. G.FillRectangle(InnerRect, 4, 4, 9, 9)
  2136. DrawText(New SolidBrush(Color.White), HorizontalAlignment.Left, 17, 0)
  2137. End Select
  2138.  
  2139. Select Case State
  2140. Case 2
  2141. G.FillRectangle(InnerRectDown, 4, 4, 9, 9)
  2142. End Select
  2143.  
  2144.  
  2145. End Sub
  2146. Sub changeCheck() Handles Me.Click
  2147. Select Case CheckedState
  2148. Case True
  2149. CheckedState = False
  2150. Case False
  2151. CheckedState = True
  2152. End Select
  2153. End Sub
  2154. End Class
  2155. Class AurumGroupBox
  2156. Inherits ThemeContainer153
  2157. Sub New()
  2158. Font = New Font("Verdana", 8.25F)
  2159. End Sub
  2160.  
  2161. Protected Overrides Sub ColorHook()
  2162. ControlMode = True
  2163. End Sub
  2164. Dim P1 As Pen
  2165.  
  2166. Protected Overrides Sub PaintHook()
  2167. G.Clear(Color.FromArgb(29, 39, 49))
  2168. G.SmoothingMode = SmoothingMode.HighQuality
  2169.  
  2170. Dim HLGBS2 As New LinearGradientBrush(New Rectangle(0, 0, Width, 24), Color.FromArgb(90, 100, 110), Color.FromArgb(57, 67, 77), 90S)
  2171. Dim HLGBS As New LinearGradientBrush(New Rectangle(0, 0, Width, 12), Color.FromArgb(50, 60, 70), Color.FromArgb(70, 80, 90), 90S)
  2172. G.FillRectangle(HLGBS2, New Rectangle(0, 0, Width, 24))
  2173. G.FillRectangle(HLGBS, New Rectangle(0, 0, Width, 12))
  2174.  
  2175. P1 = New Pen(Color.FromArgb(30, 40, 50))
  2176. G.DrawLine(P1, 0, 24, Width, 24)
  2177. G.DrawRectangle((New Pen(New SolidBrush(Color.FromArgb(61, 71, 81)))), New Rectangle(1, 1, Width - 3, Height - 3))
  2178. G.DrawRectangle((New Pen(New SolidBrush(Color.FromArgb(10, 20, 30)))), New Rectangle(0, 0, Width - 1, Height - 1))
  2179.  
  2180.  
  2181. DrawText(New SolidBrush(Color.GhostWhite), HorizontalAlignment.Center, 0, 0)
  2182. End Sub
  2183. End Class
  2184. Class AuRumRadioB
  2185. Inherits ThemeControl153
  2186. Private _Checked As Boolean = False
  2187. Public Property Checked() As Boolean
  2188. Get
  2189. Return _Checked
  2190. End Get
  2191. Set(ByVal checked As Boolean)
  2192. _Checked = checked
  2193. Invalidate()
  2194. End Set
  2195. End Property
  2196. Private P1 As Pen
  2197. Private P2 As Pen
  2198. Private G1, G2 As LinearGradientBrush
  2199. Private B1 As SolidBrush
  2200. Sub New()
  2201. Size = New Size(133, 11)
  2202. MinimumSize = New Size(16, 16)
  2203. MaximumSize = New Size(138, 13)
  2204. Font = New Font("Verdana", 8.25F)
  2205. End Sub
  2206. Protected Overrides Sub ColorHook()
  2207. P1 = New Pen(Color.FromArgb(90, 100, 110))
  2208. P2 = Pens.Black
  2209. G1 = New LinearGradientBrush(New Rectangle(0, 0, 13, 13), Color.FromArgb(80, 90, 100), Color.FromArgb(35, 45, 55), 30S)
  2210. B1 = New SolidBrush(Color.White)
  2211. 'G2 = New LinearGradientBrush(New Rectangle(4, 4, 5, 5), Color.FromArgb(150, 150, 150), Color.FromArgb(180, 180, 180), 90S)
  2212. End Sub
  2213. Dim Rect1, Rect2, Rect3 As New Rectangle
  2214. Protected Overrides Sub PaintHook()
  2215. G.Clear(Color.FromArgb(30, 40, 50))
  2216.  
  2217. Rect1 = New Rectangle(0, 0, 13, 13)
  2218. Rect2 = New Rectangle(1, 1, 11, 11)
  2219. ' Rect3 = New Rectangle(4, 4, 4, 4)
  2220. If (Checked) Then
  2221.  
  2222. G.DrawEllipse(P2, Rect1)
  2223. G.FillEllipse(G1, Rect1)
  2224.  
  2225.  
  2226. Else
  2227. G.FillEllipse(New LinearGradientBrush(New Rectangle(0, 0, 13, 13), Color.FromArgb(30, 40, 50), Color.FromArgb(5, 15, 25), 30S), Rect1)
  2228. End If
  2229.  
  2230. G.DrawEllipse(P1, Rect2)
  2231. G.DrawEllipse(P2, Rect1)
  2232.  
  2233. DrawText(B1, 14, 0)
  2234. End Sub
  2235. Sub RemoveCheck()
  2236. For Each Ctrl As Control In Parent.Controls
  2237. If TypeOf Ctrl Is AuRumRadioB Then
  2238. If Ctrl.Handle = Me.Handle Then Continue For
  2239. DirectCast(Ctrl, AuRumRadioB).Checked = False
  2240. End If
  2241. Next
  2242. End Sub
  2243. Sub Clicked() Handles Me.MouseClick
  2244. Select Case Checked
  2245. Case False
  2246. Checked = True
  2247. RemoveCheck()
  2248. End Select
  2249. End Sub
  2250. End Class
  2251. Class TopBTN
  2252. Inherits ThemeControl153
  2253. Sub New()
  2254. Font = New Font("Verdana", 8.25F)
  2255. Size = New Size(25, 26)
  2256.  
  2257. End Sub
  2258. Protected Overrides Sub ColorHook()
  2259.  
  2260. End Sub
  2261.  
  2262. Protected Overrides Sub PaintHook()
  2263.  
  2264. Select Case State
  2265. Case 0
  2266.  
  2267. G.Clear(Color.FromArgb(21, 31, 40))
  2268. 'G.DrawLine(New Pen(New SolidBrush(Color.FromArgb(70, 80, 90))), 1, Height - 1, Width - 1, Height - 1)
  2269. Dim BTNLGB As New LinearGradientBrush(New Rectangle(1, 1, Width - 2, Height / 2 - 2), Color.FromArgb(119, 128, 135), Color.FromArgb(61, 71, 80), 90S)
  2270. G.FillRectangle(BTNLGB, New Rectangle(1, 1, Width - 2, Height / 2 - 2))
  2271. G.DrawRectangle(New Pen(New SolidBrush(Color.FromArgb(30, 40, 50))), New Rectangle(1, 1, Width - 3, Height - 4))
  2272. G.DrawRectangle(New Pen(New SolidBrush(Color.FromArgb(100, 110, 120))), New Rectangle(0, 0, Width - 1, Height - 2))
  2273.  
  2274.  
  2275. Case 1
  2276. G.Clear(Color.FromArgb(26, 36, 46))
  2277. G.DrawLine(New Pen(New SolidBrush(Color.FromArgb(10, 20, 30))), 2, Height - 1, Width - 2, Height - 1)
  2278. Dim BTNLGB As New LinearGradientBrush(New Rectangle(1, 1, Width - 2, Height / 2 - 2), Color.FromArgb(124, 132, 139), Color.FromArgb(66, 76, 86), 90S)
  2279. G.FillRectangle(BTNLGB, New Rectangle(1, 1, Width - 2, Height / 2 - 2))
  2280. G.DrawRectangle(New Pen(New SolidBrush(Color.FromArgb(40, 50, 60))), New Rectangle(1, 1, Width - 3, Height - 4))
  2281. G.DrawRectangle(New Pen(New SolidBrush(Color.FromArgb(110, 120, 130))), New Rectangle(0, 0, Width - 1, Height - 2))
  2282.  
  2283. Case 2
  2284.  
  2285. G.Clear(Color.FromArgb(15, 25, 35))
  2286. G.DrawLine(New Pen(New SolidBrush(Color.FromArgb(10, 20, 30))), 2, Height - 1, Width - 2, Height - 1)
  2287. Dim BTNLGB As New LinearGradientBrush(New Rectangle(1, 1, Width - 2, Height / 2 - 2), Color.FromArgb(124, 132, 139), Color.FromArgb(66, 76, 86), 90S)
  2288. G.FillRectangle(BTNLGB, New Rectangle(1, 1, Width - 2, Height / 2 - 2))
  2289. G.DrawRectangle(New Pen(New SolidBrush(Color.FromArgb(25, 35, 45))), New Rectangle(1, 1, Width - 3, Height - 4))
  2290. G.DrawRectangle(New Pen(New SolidBrush(Color.FromArgb(95, 105, 115))), New Rectangle(0, 0, Width - 1, Height - 2))
  2291. End Select
  2292. DrawText(New SolidBrush(Color.White), HorizontalAlignment.Center, 0, 0)
  2293. End Sub
  2294. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement