Advertisement
Guest User

FrogByte THeme

a guest
Feb 13th, 2015
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 120.12 KB | None | 0 0
  1. #Region "Themebase"
  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. Imports System.Drawing.Text
  8.  
  9. '------------------
  10. 'Creator: aeonhack
  11. 'Site: elitevs.net
  12. 'Created: 08/02/2011
  13. 'Changed: 12/06/2011
  14. 'Version: 1.5.4
  15. '------------------
  16.  
  17. MustInherit Class ThemeContainer154
  18. Inherits ContainerControl
  19.  
  20. #Region " Initialization "
  21.  
  22. Protected G As Graphics, B As Bitmap
  23.  
  24. Sub New()
  25. SetStyle(DirectCast(139270, ControlStyles), True)
  26.  
  27. _ImageSize = Size.Empty
  28. Font = New Font("Verdana", 8S)
  29.  
  30. MeasureBitmap = New Bitmap(1, 1)
  31. MeasureGraphics = Graphics.FromImage(MeasureBitmap)
  32.  
  33. DrawRadialPath = New GraphicsPath
  34.  
  35. InvalidateCustimization()
  36. End Sub
  37.  
  38. Protected NotOverridable Overrides Sub OnHandleCreated(ByVal e As EventArgs)
  39. If DoneCreation Then InitializeMessages()
  40.  
  41. InvalidateCustimization()
  42. ColorHook()
  43.  
  44. If Not _LockWidth = 0 Then Width = _LockWidth
  45. If Not _LockHeight = 0 Then Height = _LockHeight
  46. If Not _ControlMode Then MyBase.Dock = DockStyle.Fill
  47.  
  48. Transparent = _Transparent
  49. If _Transparent AndAlso _BackColor Then BackColor = Color.Transparent
  50.  
  51. MyBase.OnHandleCreated(e)
  52. End Sub
  53.  
  54. Private DoneCreation As Boolean
  55. Protected NotOverridable Overrides Sub OnParentChanged(ByVal e As EventArgs)
  56. MyBase.OnParentChanged(e)
  57.  
  58. If Parent Is Nothing Then Return
  59. _IsParentForm = TypeOf Parent Is Form
  60.  
  61. If Not _ControlMode Then
  62. InitializeMessages()
  63.  
  64. If _IsParentForm Then
  65. ParentForm.FormBorderStyle = _BorderStyle
  66. ParentForm.TransparencyKey = _TransparencyKey
  67.  
  68. If Not DesignMode Then
  69. AddHandler ParentForm.Shown, AddressOf FormShown
  70. End If
  71. End If
  72.  
  73. Parent.BackColor = BackColor
  74. End If
  75.  
  76. OnCreation()
  77. DoneCreation = True
  78. InvalidateTimer()
  79. End Sub
  80.  
  81. #End Region
  82.  
  83. Private Sub DoAnimation(ByVal i As Boolean)
  84. OnAnimation()
  85. If i Then Invalidate()
  86. End Sub
  87.  
  88. Protected NotOverridable Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  89. If Width = 0 OrElse Height = 0 Then Return
  90.  
  91. If _Transparent AndAlso _ControlMode Then
  92. PaintHook()
  93. e.Graphics.DrawImage(B, 0, 0)
  94. Else
  95. G = e.Graphics
  96. PaintHook()
  97. End If
  98. End Sub
  99.  
  100. Protected Overrides Sub OnHandleDestroyed(ByVal e As EventArgs)
  101. RemoveAnimationCallback(AddressOf DoAnimation)
  102. MyBase.OnHandleDestroyed(e)
  103. End Sub
  104.  
  105. Private HasShown As Boolean
  106. Private Sub FormShown(ByVal sender As Object, ByVal e As EventArgs)
  107. If _ControlMode OrElse HasShown Then Return
  108.  
  109. If _StartPosition = FormStartPosition.CenterParent OrElse _StartPosition = FormStartPosition.CenterScreen Then
  110. Dim SB As Rectangle = Screen.PrimaryScreen.Bounds
  111. Dim CB As Rectangle = ParentForm.Bounds
  112. ParentForm.Location = New Point(SB.Width \ 2 - CB.Width \ 2, SB.Height \ 2 - CB.Width \ 2)
  113. End If
  114.  
  115. HasShown = True
  116. End Sub
  117.  
  118.  
  119. #Region " Size Handling "
  120.  
  121. Private Frame As Rectangle
  122. Protected NotOverridable Overrides Sub OnSizeChanged(ByVal e As EventArgs)
  123. If _Movable AndAlso Not _ControlMode Then
  124. Frame = New Rectangle(7, 7, Width - 14, _Header - 7)
  125. End If
  126.  
  127. InvalidateBitmap()
  128. Invalidate()
  129.  
  130. MyBase.OnSizeChanged(e)
  131. End Sub
  132.  
  133. Protected Overrides Sub SetBoundsCore(ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal specified As BoundsSpecified)
  134. If Not _LockWidth = 0 Then width = _LockWidth
  135. If Not _LockHeight = 0 Then height = _LockHeight
  136. MyBase.SetBoundsCore(x, y, width, height, specified)
  137. End Sub
  138.  
  139. #End Region
  140.  
  141. #Region " State Handling "
  142.  
  143. Protected State As MouseState
  144. Private Sub SetState(ByVal current As MouseState)
  145. State = current
  146. Invalidate()
  147. End Sub
  148.  
  149. Protected Overrides Sub OnMouseMove(ByVal e As MouseEventArgs)
  150. If Not (_IsParentForm AndAlso ParentForm.WindowState = FormWindowState.Maximized) Then
  151. If _Sizable AndAlso Not _ControlMode Then InvalidateMouse()
  152. End If
  153.  
  154. MyBase.OnMouseMove(e)
  155. End Sub
  156.  
  157. Protected Overrides Sub OnEnabledChanged(ByVal e As EventArgs)
  158. If Enabled Then SetState(MouseState.None) Else SetState(MouseState.Block)
  159. MyBase.OnEnabledChanged(e)
  160. End Sub
  161.  
  162. Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
  163. SetState(MouseState.Over)
  164. MyBase.OnMouseEnter(e)
  165. End Sub
  166.  
  167. Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  168. SetState(MouseState.Over)
  169. MyBase.OnMouseUp(e)
  170. End Sub
  171.  
  172. Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
  173. SetState(MouseState.None)
  174.  
  175. If GetChildAtPoint(PointToClient(MousePosition)) IsNot Nothing Then
  176. If _Sizable AndAlso Not _ControlMode Then
  177. Cursor = Cursors.Default
  178. Previous = 0
  179. End If
  180. End If
  181.  
  182. MyBase.OnMouseLeave(e)
  183. End Sub
  184.  
  185. Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  186. If e.Button = Windows.Forms.MouseButtons.Left Then SetState(MouseState.Down)
  187.  
  188. If Not (_IsParentForm AndAlso ParentForm.WindowState = FormWindowState.Maximized OrElse _ControlMode) Then
  189. If _Movable AndAlso Frame.Contains(e.Location) Then
  190. Capture = False
  191. WM_LMBUTTONDOWN = True
  192. DefWndProc(Messages(0))
  193. ElseIf _Sizable AndAlso Not Previous = 0 Then
  194. Capture = False
  195. WM_LMBUTTONDOWN = True
  196. DefWndProc(Messages(Previous))
  197. End If
  198. End If
  199.  
  200. MyBase.OnMouseDown(e)
  201. End Sub
  202.  
  203. Private WM_LMBUTTONDOWN As Boolean
  204. Protected Overrides Sub WndProc(ByRef m As Message)
  205. MyBase.WndProc(m)
  206.  
  207. If WM_LMBUTTONDOWN AndAlso m.Msg = 513 Then
  208. WM_LMBUTTONDOWN = False
  209.  
  210. SetState(MouseState.Over)
  211. If Not _SmartBounds Then Return
  212.  
  213. If IsParentMdi Then
  214. CorrectBounds(New Rectangle(Point.Empty, Parent.Parent.Size))
  215. Else
  216. CorrectBounds(Screen.FromControl(Parent).WorkingArea)
  217. End If
  218. End If
  219. End Sub
  220.  
  221. Private GetIndexPoint As Point
  222. Private B1, B2, B3, B4 As Boolean
  223. Private Function GetIndex() As Integer
  224. GetIndexPoint = PointToClient(MousePosition)
  225. B1 = GetIndexPoint.X < 7
  226. B2 = GetIndexPoint.X > Width - 7
  227. B3 = GetIndexPoint.Y < 7
  228. B4 = GetIndexPoint.Y > Height - 7
  229.  
  230. If B1 AndAlso B3 Then Return 4
  231. If B1 AndAlso B4 Then Return 7
  232. If B2 AndAlso B3 Then Return 5
  233. If B2 AndAlso B4 Then Return 8
  234. If B1 Then Return 1
  235. If B2 Then Return 2
  236. If B3 Then Return 3
  237. If B4 Then Return 6
  238. Return 0
  239. End Function
  240.  
  241. Private Current, Previous As Integer
  242. Private Sub InvalidateMouse()
  243. Current = GetIndex()
  244. If Current = Previous Then Return
  245.  
  246. Previous = Current
  247. Select Case Previous
  248. Case 0
  249. Cursor = Cursors.Default
  250. Case 1, 2
  251. Cursor = Cursors.SizeWE
  252. Case 3, 6
  253. Cursor = Cursors.SizeNS
  254. Case 4, 8
  255. Cursor = Cursors.SizeNWSE
  256. Case 5, 7
  257. Cursor = Cursors.SizeNESW
  258. End Select
  259. End Sub
  260.  
  261. Private Messages(8) As Message
  262. Private Sub InitializeMessages()
  263. Messages(0) = Message.Create(Parent.Handle, 161, New IntPtr(2), IntPtr.Zero)
  264. For I As Integer = 1 To 8
  265. Messages(I) = Message.Create(Parent.Handle, 161, New IntPtr(I + 9), IntPtr.Zero)
  266. Next
  267. End Sub
  268.  
  269. Private Sub CorrectBounds(ByVal bounds As Rectangle)
  270. If Parent.Width > bounds.Width Then Parent.Width = bounds.Width
  271. If Parent.Height > bounds.Height Then Parent.Height = bounds.Height
  272.  
  273. Dim X As Integer = Parent.Location.X
  274. Dim Y As Integer = Parent.Location.Y
  275.  
  276. If X < bounds.X Then X = bounds.X
  277. If Y < bounds.Y Then Y = bounds.Y
  278.  
  279. Dim Width As Integer = bounds.X + bounds.Width
  280. Dim Height As Integer = bounds.Y + bounds.Height
  281.  
  282. If X + Parent.Width > Width Then X = Width - Parent.Width
  283. If Y + Parent.Height > Height Then Y = Height - Parent.Height
  284.  
  285. Parent.Location = New Point(X, Y)
  286. End Sub
  287.  
  288. #End Region
  289.  
  290.  
  291. #Region " Base Properties "
  292.  
  293. Overrides Property Dock As DockStyle
  294. Get
  295. Return MyBase.Dock
  296. End Get
  297. Set(ByVal value As DockStyle)
  298. If Not _ControlMode Then Return
  299. MyBase.Dock = value
  300. End Set
  301. End Property
  302.  
  303. Private _BackColor As Boolean
  304. <Category("Misc")> _
  305. Overrides Property BackColor() As Color
  306. Get
  307. Return MyBase.BackColor
  308. End Get
  309. Set(ByVal value As Color)
  310. If value = MyBase.BackColor Then Return
  311.  
  312. If Not IsHandleCreated AndAlso _ControlMode AndAlso value = Color.Transparent Then
  313. _BackColor = True
  314. Return
  315. End If
  316.  
  317. MyBase.BackColor = value
  318. If Parent IsNot Nothing Then
  319. If Not _ControlMode Then Parent.BackColor = value
  320. ColorHook()
  321. End If
  322. End Set
  323. End Property
  324.  
  325. Overrides Property MinimumSize As Size
  326. Get
  327. Return MyBase.MinimumSize
  328. End Get
  329. Set(ByVal value As Size)
  330. MyBase.MinimumSize = value
  331. If Parent IsNot Nothing Then Parent.MinimumSize = value
  332. End Set
  333. End Property
  334.  
  335. Overrides Property MaximumSize As Size
  336. Get
  337. Return MyBase.MaximumSize
  338. End Get
  339. Set(ByVal value As Size)
  340. MyBase.MaximumSize = value
  341. If Parent IsNot Nothing Then Parent.MaximumSize = value
  342. End Set
  343. End Property
  344.  
  345. Overrides Property Text() As String
  346. Get
  347. Return MyBase.Text
  348. End Get
  349. Set(ByVal value As String)
  350. MyBase.Text = value
  351. Invalidate()
  352. End Set
  353. End Property
  354.  
  355. Overrides Property Font() As Font
  356. Get
  357. Return MyBase.Font
  358. End Get
  359. Set(ByVal value As Font)
  360. MyBase.Font = value
  361. Invalidate()
  362. End Set
  363. End Property
  364.  
  365. <Browsable(False), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
  366. Overrides Property ForeColor() As Color
  367. Get
  368. Return Color.Empty
  369. End Get
  370. Set(ByVal value As Color)
  371. End Set
  372. End Property
  373. <Browsable(False), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
  374. Overrides Property BackgroundImage() As Image
  375. Get
  376. Return Nothing
  377. End Get
  378. Set(ByVal value As Image)
  379. End Set
  380. End Property
  381. <Browsable(False), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
  382. Overrides Property BackgroundImageLayout() As ImageLayout
  383. Get
  384. Return ImageLayout.None
  385. End Get
  386. Set(ByVal value As ImageLayout)
  387. End Set
  388. End Property
  389.  
  390. #End Region
  391.  
  392. #Region " Public Properties "
  393.  
  394. Private _SmartBounds As Boolean = True
  395. Property SmartBounds() As Boolean
  396. Get
  397. Return _SmartBounds
  398. End Get
  399. Set(ByVal value As Boolean)
  400. _SmartBounds = value
  401. End Set
  402. End Property
  403.  
  404. Private _Movable As Boolean = True
  405. Property Movable() As Boolean
  406. Get
  407. Return _Movable
  408. End Get
  409. Set(ByVal value As Boolean)
  410. _Movable = value
  411. End Set
  412. End Property
  413.  
  414. Private _Sizable As Boolean = True
  415. Property Sizable() As Boolean
  416. Get
  417. Return _Sizable
  418. End Get
  419. Set(ByVal value As Boolean)
  420. _Sizable = value
  421. End Set
  422. End Property
  423.  
  424. Private _TransparencyKey As Color
  425. Property TransparencyKey() As Color
  426. Get
  427. If _IsParentForm AndAlso Not _ControlMode Then Return ParentForm.TransparencyKey Else Return _TransparencyKey
  428. End Get
  429. Set(ByVal value As Color)
  430. If value = _TransparencyKey Then Return
  431. _TransparencyKey = value
  432.  
  433. If _IsParentForm AndAlso Not _ControlMode Then
  434. ParentForm.TransparencyKey = value
  435. ColorHook()
  436. End If
  437. End Set
  438. End Property
  439.  
  440. Private _BorderStyle As FormBorderStyle
  441. Property BorderStyle() As FormBorderStyle
  442. Get
  443. If _IsParentForm AndAlso Not _ControlMode Then Return ParentForm.FormBorderStyle Else Return _BorderStyle
  444. End Get
  445. Set(ByVal value As FormBorderStyle)
  446. _BorderStyle = value
  447.  
  448. If _IsParentForm AndAlso Not _ControlMode Then
  449. ParentForm.FormBorderStyle = value
  450.  
  451. If Not value = FormBorderStyle.None Then
  452. Movable = False
  453. Sizable = False
  454. End If
  455. End If
  456. End Set
  457. End Property
  458.  
  459. Private _StartPosition As FormStartPosition
  460. Property StartPosition As FormStartPosition
  461. Get
  462. If _IsParentForm AndAlso Not _ControlMode Then Return ParentForm.StartPosition Else Return _StartPosition
  463. End Get
  464. Set(ByVal value As FormStartPosition)
  465. _StartPosition = value
  466.  
  467. If _IsParentForm AndAlso Not _ControlMode Then
  468. ParentForm.StartPosition = value
  469. End If
  470. End Set
  471. End Property
  472.  
  473. Private _NoRounding As Boolean
  474. Property NoRounding() As Boolean
  475. Get
  476. Return _NoRounding
  477. End Get
  478. Set(ByVal v As Boolean)
  479. _NoRounding = v
  480. Invalidate()
  481. End Set
  482. End Property
  483.  
  484. Private _Image As Image
  485. Property Image() As Image
  486. Get
  487. Return _Image
  488. End Get
  489. Set(ByVal value As Image)
  490. If value Is Nothing Then _ImageSize = Size.Empty Else _ImageSize = value.Size
  491.  
  492. _Image = value
  493. Invalidate()
  494. End Set
  495. End Property
  496.  
  497. Private Items As New Dictionary(Of String, Color)
  498. Property Colors() As Bloom()
  499. Get
  500. Dim T As New List(Of Bloom)
  501. Dim E As Dictionary(Of String, Color).Enumerator = Items.GetEnumerator
  502.  
  503. While E.MoveNext
  504. T.Add(New Bloom(E.Current.Key, E.Current.Value))
  505. End While
  506.  
  507. Return T.ToArray
  508. End Get
  509. Set(ByVal value As Bloom())
  510. For Each B As Bloom In value
  511. If Items.ContainsKey(B.Name) Then Items(B.Name) = B.Value
  512. Next
  513.  
  514. InvalidateCustimization()
  515. ColorHook()
  516. Invalidate()
  517. End Set
  518. End Property
  519.  
  520. Private _Customization As String
  521. Property Customization() As String
  522. Get
  523. Return _Customization
  524. End Get
  525. Set(ByVal value As String)
  526. If value = _Customization Then Return
  527.  
  528. Dim Data As Byte()
  529. Dim Items As Bloom() = Colors
  530.  
  531. Try
  532. Data = Convert.FromBase64String(value)
  533. For I As Integer = 0 To Items.Length - 1
  534. Items(I).Value = Color.FromArgb(BitConverter.ToInt32(Data, I * 4))
  535. Next
  536. Catch
  537. Return
  538. End Try
  539.  
  540. _Customization = value
  541.  
  542. Colors = Items
  543. ColorHook()
  544. Invalidate()
  545. End Set
  546. End Property
  547.  
  548. Private _Transparent As Boolean
  549. Property Transparent() As Boolean
  550. Get
  551. Return _Transparent
  552. End Get
  553. Set(ByVal value As Boolean)
  554. _Transparent = value
  555. If Not (IsHandleCreated OrElse _ControlMode) Then Return
  556.  
  557. If Not value AndAlso Not BackColor.A = 255 Then
  558. Throw New Exception("Unable to change value to false while a transparent BackColor is in use.")
  559. End If
  560.  
  561. SetStyle(ControlStyles.Opaque, Not value)
  562. SetStyle(ControlStyles.SupportsTransparentBackColor, value)
  563.  
  564. InvalidateBitmap()
  565. Invalidate()
  566. End Set
  567. End Property
  568.  
  569. #End Region
  570.  
  571. #Region " Private Properties "
  572.  
  573. Private _ImageSize As Size
  574. Protected ReadOnly Property ImageSize() As Size
  575. Get
  576. Return _ImageSize
  577. End Get
  578. End Property
  579.  
  580. Private _IsParentForm As Boolean
  581. Protected ReadOnly Property IsParentForm As Boolean
  582. Get
  583. Return _IsParentForm
  584. End Get
  585. End Property
  586.  
  587. Protected ReadOnly Property IsParentMdi As Boolean
  588. Get
  589. If Parent Is Nothing Then Return False
  590. Return Parent.Parent IsNot Nothing
  591. End Get
  592. End Property
  593.  
  594. Private _LockWidth As Integer
  595. Protected Property LockWidth() As Integer
  596. Get
  597. Return _LockWidth
  598. End Get
  599. Set(ByVal value As Integer)
  600. _LockWidth = value
  601. If Not LockWidth = 0 AndAlso IsHandleCreated Then Width = LockWidth
  602. End Set
  603. End Property
  604.  
  605. Private _LockHeight As Integer
  606. Protected Property LockHeight() As Integer
  607. Get
  608. Return _LockHeight
  609. End Get
  610. Set(ByVal value As Integer)
  611. _LockHeight = value
  612. If Not LockHeight = 0 AndAlso IsHandleCreated Then Height = LockHeight
  613. End Set
  614. End Property
  615.  
  616. Private _Header As Integer = 24
  617. Protected Property Header() As Integer
  618. Get
  619. Return _Header
  620. End Get
  621. Set(ByVal v As Integer)
  622. _Header = v
  623.  
  624. If Not _ControlMode Then
  625. Frame = New Rectangle(7, 7, Width - 14, v - 7)
  626. Invalidate()
  627. End If
  628. End Set
  629. End Property
  630.  
  631. Private _ControlMode As Boolean
  632. Protected Property ControlMode() As Boolean
  633. Get
  634. Return _ControlMode
  635. End Get
  636. Set(ByVal v As Boolean)
  637. _ControlMode = v
  638.  
  639. Transparent = _Transparent
  640. If _Transparent AndAlso _BackColor Then BackColor = Color.Transparent
  641.  
  642. InvalidateBitmap()
  643. Invalidate()
  644. End Set
  645. End Property
  646.  
  647. Private _IsAnimated As Boolean
  648. Protected Property IsAnimated() As Boolean
  649. Get
  650. Return _IsAnimated
  651. End Get
  652. Set(ByVal value As Boolean)
  653. _IsAnimated = value
  654. InvalidateTimer()
  655. End Set
  656. End Property
  657.  
  658. #End Region
  659.  
  660.  
  661. #Region " Property Helpers "
  662.  
  663. Protected Function GetPen(ByVal name As String) As Pen
  664. Return New Pen(Items(name))
  665. End Function
  666. Protected Function GetPen(ByVal name As String, ByVal width As Single) As Pen
  667. Return New Pen(Items(name), width)
  668. End Function
  669.  
  670. Protected Function GetBrush(ByVal name As String) As SolidBrush
  671. Return New SolidBrush(Items(name))
  672. End Function
  673.  
  674. Protected Function GetColor(ByVal name As String) As Color
  675. Return Items(name)
  676. End Function
  677.  
  678. Protected Sub SetColor(ByVal name As String, ByVal value As Color)
  679. If Items.ContainsKey(name) Then Items(name) = value Else Items.Add(name, value)
  680. End Sub
  681. Protected Sub SetColor(ByVal name As String, ByVal r As Byte, ByVal g As Byte, ByVal b As Byte)
  682. SetColor(name, Color.FromArgb(r, g, b))
  683. End Sub
  684. Protected Sub SetColor(ByVal name As String, ByVal a As Byte, ByVal r As Byte, ByVal g As Byte, ByVal b As Byte)
  685. SetColor(name, Color.FromArgb(a, r, g, b))
  686. End Sub
  687. Protected Sub SetColor(ByVal name As String, ByVal a As Byte, ByVal value As Color)
  688. SetColor(name, Color.FromArgb(a, value))
  689. End Sub
  690.  
  691. Private Sub InvalidateBitmap()
  692. If _Transparent AndAlso _ControlMode Then
  693. If Width = 0 OrElse Height = 0 Then Return
  694. B = New Bitmap(Width, Height, PixelFormat.Format32bppPArgb)
  695. G = Graphics.FromImage(B)
  696. Else
  697. G = Nothing
  698. B = Nothing
  699. End If
  700. End Sub
  701.  
  702. Private Sub InvalidateCustimization()
  703. Dim M As New MemoryStream(Items.Count * 4)
  704.  
  705. For Each B As Bloom In Colors
  706. M.Write(BitConverter.GetBytes(B.Value.ToArgb), 0, 4)
  707. Next
  708.  
  709. M.Close()
  710. _Customization = Convert.ToBase64String(M.ToArray)
  711. End Sub
  712.  
  713. Private Sub InvalidateTimer()
  714. If DesignMode OrElse Not DoneCreation Then Return
  715.  
  716. If _IsAnimated Then
  717. AddAnimationCallback(AddressOf DoAnimation)
  718. Else
  719. RemoveAnimationCallback(AddressOf DoAnimation)
  720. End If
  721. End Sub
  722.  
  723. #End Region
  724.  
  725.  
  726. #Region " User Hooks "
  727.  
  728. Protected MustOverride Sub ColorHook()
  729. Protected MustOverride Sub PaintHook()
  730.  
  731. Protected Overridable Sub OnCreation()
  732. End Sub
  733.  
  734. Protected Overridable Sub OnAnimation()
  735. End Sub
  736.  
  737. #End Region
  738.  
  739.  
  740. #Region " Offset "
  741.  
  742. Private OffsetReturnRectangle As Rectangle
  743. Protected Function Offset(ByVal r As Rectangle, ByVal amount As Integer) As Rectangle
  744. OffsetReturnRectangle = New Rectangle(r.X + amount, r.Y + amount, r.Width - (amount * 2), r.Height - (amount * 2))
  745. Return OffsetReturnRectangle
  746. End Function
  747.  
  748. Private OffsetReturnSize As Size
  749. Protected Function Offset(ByVal s As Size, ByVal amount As Integer) As Size
  750. OffsetReturnSize = New Size(s.Width + amount, s.Height + amount)
  751. Return OffsetReturnSize
  752. End Function
  753.  
  754. Private OffsetReturnPoint As Point
  755. Protected Function Offset(ByVal p As Point, ByVal amount As Integer) As Point
  756. OffsetReturnPoint = New Point(p.X + amount, p.Y + amount)
  757. Return OffsetReturnPoint
  758. End Function
  759.  
  760. #End Region
  761.  
  762. #Region " Center "
  763.  
  764. Private CenterReturn As Point
  765.  
  766. Protected Function Center(ByVal p As Rectangle, ByVal c As Rectangle) As Point
  767. CenterReturn = New Point((p.Width \ 2 - c.Width \ 2) + p.X + c.X, (p.Height \ 2 - c.Height \ 2) + p.Y + c.Y)
  768. Return CenterReturn
  769. End Function
  770. Protected Function Center(ByVal p As Rectangle, ByVal c As Size) As Point
  771. CenterReturn = New Point((p.Width \ 2 - c.Width \ 2) + p.X, (p.Height \ 2 - c.Height \ 2) + p.Y)
  772. Return CenterReturn
  773. End Function
  774.  
  775. Protected Function Center(ByVal child As Rectangle) As Point
  776. Return Center(Width, Height, child.Width, child.Height)
  777. End Function
  778. Protected Function Center(ByVal child As Size) As Point
  779. Return Center(Width, Height, child.Width, child.Height)
  780. End Function
  781. Protected Function Center(ByVal childWidth As Integer, ByVal childHeight As Integer) As Point
  782. Return Center(Width, Height, childWidth, childHeight)
  783. End Function
  784.  
  785. Protected Function Center(ByVal p As Size, ByVal c As Size) As Point
  786. Return Center(p.Width, p.Height, c.Width, c.Height)
  787. End Function
  788.  
  789. Protected Function Center(ByVal pWidth As Integer, ByVal pHeight As Integer, ByVal cWidth As Integer, ByVal cHeight As Integer) As Point
  790. CenterReturn = New Point(pWidth \ 2 - cWidth \ 2, pHeight \ 2 - cHeight \ 2)
  791. Return CenterReturn
  792. End Function
  793.  
  794. #End Region
  795.  
  796. #Region " Measure "
  797.  
  798. Private MeasureBitmap As Bitmap
  799. Private MeasureGraphics As Graphics
  800.  
  801. Protected Function Measure() As Size
  802. SyncLock MeasureGraphics
  803. Return MeasureGraphics.MeasureString(Text, Font, Width).ToSize
  804. End SyncLock
  805. End Function
  806. Protected Function Measure(ByVal text As String) As Size
  807. SyncLock MeasureGraphics
  808. Return MeasureGraphics.MeasureString(text, Font, Width).ToSize
  809. End SyncLock
  810. End Function
  811.  
  812. #End Region
  813.  
  814.  
  815. #Region " DrawPixel "
  816.  
  817. Private DrawPixelBrush As SolidBrush
  818.  
  819. Protected Sub DrawPixel(ByVal c1 As Color, ByVal x As Integer, ByVal y As Integer)
  820. If _Transparent Then
  821. B.SetPixel(x, y, c1)
  822. Else
  823. DrawPixelBrush = New SolidBrush(c1)
  824. G.FillRectangle(DrawPixelBrush, x, y, 1, 1)
  825. End If
  826. End Sub
  827.  
  828. #End Region
  829.  
  830. #Region " DrawCorners "
  831.  
  832. Private DrawCornersBrush As SolidBrush
  833.  
  834. Protected Sub DrawCorners(ByVal c1 As Color, ByVal offset As Integer)
  835. DrawCorners(c1, 0, 0, Width, Height, offset)
  836. End Sub
  837. Protected Sub DrawCorners(ByVal c1 As Color, ByVal r1 As Rectangle, ByVal offset As Integer)
  838. DrawCorners(c1, r1.X, r1.Y, r1.Width, r1.Height, offset)
  839. End Sub
  840. 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)
  841. DrawCorners(c1, x + offset, y + offset, width - (offset * 2), height - (offset * 2))
  842. End Sub
  843.  
  844. Protected Sub DrawCorners(ByVal c1 As Color)
  845. DrawCorners(c1, 0, 0, Width, Height)
  846. End Sub
  847. Protected Sub DrawCorners(ByVal c1 As Color, ByVal r1 As Rectangle)
  848. DrawCorners(c1, r1.X, r1.Y, r1.Width, r1.Height)
  849. End Sub
  850. Protected Sub DrawCorners(ByVal c1 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
  851. If _NoRounding Then Return
  852.  
  853. If _Transparent Then
  854. B.SetPixel(x, y, c1)
  855. B.SetPixel(x + (width - 1), y, c1)
  856. B.SetPixel(x, y + (height - 1), c1)
  857. B.SetPixel(x + (width - 1), y + (height - 1), c1)
  858. Else
  859. DrawCornersBrush = New SolidBrush(c1)
  860. G.FillRectangle(DrawCornersBrush, x, y, 1, 1)
  861. G.FillRectangle(DrawCornersBrush, x + (width - 1), y, 1, 1)
  862. G.FillRectangle(DrawCornersBrush, x, y + (height - 1), 1, 1)
  863. G.FillRectangle(DrawCornersBrush, x + (width - 1), y + (height - 1), 1, 1)
  864. End If
  865. End Sub
  866.  
  867. #End Region
  868.  
  869. #Region " DrawBorders "
  870.  
  871. Protected Sub DrawBorders(ByVal p1 As Pen, ByVal offset As Integer)
  872. DrawBorders(p1, 0, 0, Width, Height, offset)
  873. End Sub
  874. Protected Sub DrawBorders(ByVal p1 As Pen, ByVal r As Rectangle, ByVal offset As Integer)
  875. DrawBorders(p1, r.X, r.Y, r.Width, r.Height, offset)
  876. End Sub
  877. 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)
  878. DrawBorders(p1, x + offset, y + offset, width - (offset * 2), height - (offset * 2))
  879. End Sub
  880.  
  881. Protected Sub DrawBorders(ByVal p1 As Pen)
  882. DrawBorders(p1, 0, 0, Width, Height)
  883. End Sub
  884. Protected Sub DrawBorders(ByVal p1 As Pen, ByVal r As Rectangle)
  885. DrawBorders(p1, r.X, r.Y, r.Width, r.Height)
  886. End Sub
  887. Protected Sub DrawBorders(ByVal p1 As Pen, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
  888. G.DrawRectangle(p1, x, y, width - 1, height - 1)
  889. End Sub
  890.  
  891. #End Region
  892.  
  893. #Region " DrawText "
  894.  
  895. Private DrawTextPoint As Point
  896. Private DrawTextSize As Size
  897.  
  898. Protected Sub DrawText(ByVal b1 As Brush, ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
  899. DrawText(b1, Text, a, x, y)
  900. End Sub
  901. Protected Sub DrawText(ByVal b1 As Brush, ByVal text As String, ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
  902. If text.Length = 0 Then Return
  903.  
  904. DrawTextSize = Measure(text)
  905. DrawTextPoint = New Point(Width \ 2 - DrawTextSize.Width \ 2, Header \ 2 - DrawTextSize.Height \ 2)
  906.  
  907. Select Case a
  908. Case HorizontalAlignment.Left
  909. G.DrawString(text, Font, b1, x, DrawTextPoint.Y + y)
  910. Case HorizontalAlignment.Center
  911. G.DrawString(text, Font, b1, DrawTextPoint.X + x, DrawTextPoint.Y + y)
  912. Case HorizontalAlignment.Right
  913. G.DrawString(text, Font, b1, Width - DrawTextSize.Width - x, DrawTextPoint.Y + y)
  914. End Select
  915. End Sub
  916.  
  917. Protected Sub DrawText(ByVal b1 As Brush, ByVal p1 As Point)
  918. If Text.Length = 0 Then Return
  919. G.DrawString(Text, Font, b1, p1)
  920. End Sub
  921. Protected Sub DrawText(ByVal b1 As Brush, ByVal x As Integer, ByVal y As Integer)
  922. If Text.Length = 0 Then Return
  923. G.DrawString(Text, Font, b1, x, y)
  924. End Sub
  925.  
  926. #End Region
  927.  
  928. #Region " DrawImage "
  929.  
  930. Private DrawImagePoint As Point
  931.  
  932. Protected Sub DrawImage(ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
  933. DrawImage(_Image, a, x, y)
  934. End Sub
  935. Protected Sub DrawImage(ByVal image As Image, ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
  936. If image Is Nothing Then Return
  937. DrawImagePoint = New Point(Width \ 2 - image.Width \ 2, Header \ 2 - image.Height \ 2)
  938.  
  939. Select Case a
  940. Case HorizontalAlignment.Left
  941. G.DrawImage(image, x, DrawImagePoint.Y + y, image.Width, image.Height)
  942. Case HorizontalAlignment.Center
  943. G.DrawImage(image, DrawImagePoint.X + x, DrawImagePoint.Y + y, image.Width, image.Height)
  944. Case HorizontalAlignment.Right
  945. G.DrawImage(image, Width - image.Width - x, DrawImagePoint.Y + y, image.Width, image.Height)
  946. End Select
  947. End Sub
  948.  
  949. Protected Sub DrawImage(ByVal p1 As Point)
  950. DrawImage(_Image, p1.X, p1.Y)
  951. End Sub
  952. Protected Sub DrawImage(ByVal x As Integer, ByVal y As Integer)
  953. DrawImage(_Image, x, y)
  954. End Sub
  955.  
  956. Protected Sub DrawImage(ByVal image As Image, ByVal p1 As Point)
  957. DrawImage(image, p1.X, p1.Y)
  958. End Sub
  959. Protected Sub DrawImage(ByVal image As Image, ByVal x As Integer, ByVal y As Integer)
  960. If image Is Nothing Then Return
  961. G.DrawImage(image, x, y, image.Width, image.Height)
  962. End Sub
  963.  
  964. #End Region
  965.  
  966. #Region " DrawGradient "
  967.  
  968. Private DrawGradientBrush As LinearGradientBrush
  969. Private DrawGradientRectangle As Rectangle
  970.  
  971. Protected Sub DrawGradient(ByVal blend As ColorBlend, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
  972. DrawGradientRectangle = New Rectangle(x, y, width, height)
  973. DrawGradient(blend, DrawGradientRectangle)
  974. End Sub
  975. 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)
  976. DrawGradientRectangle = New Rectangle(x, y, width, height)
  977. DrawGradient(blend, DrawGradientRectangle, angle)
  978. End Sub
  979.  
  980. Protected Sub DrawGradient(ByVal blend As ColorBlend, ByVal r As Rectangle)
  981. DrawGradientBrush = New LinearGradientBrush(r, Color.Empty, Color.Empty, 90.0F)
  982. DrawGradientBrush.InterpolationColors = blend
  983. G.FillRectangle(DrawGradientBrush, r)
  984. End Sub
  985. Protected Sub DrawGradient(ByVal blend As ColorBlend, ByVal r As Rectangle, ByVal angle As Single)
  986. DrawGradientBrush = New LinearGradientBrush(r, Color.Empty, Color.Empty, angle)
  987. DrawGradientBrush.InterpolationColors = blend
  988. G.FillRectangle(DrawGradientBrush, r)
  989. End Sub
  990.  
  991.  
  992. 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)
  993. DrawGradientRectangle = New Rectangle(x, y, width, height)
  994. DrawGradient(c1, c2, DrawGradientRectangle)
  995. End Sub
  996. 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)
  997. DrawGradientRectangle = New Rectangle(x, y, width, height)
  998. DrawGradient(c1, c2, DrawGradientRectangle, angle)
  999. End Sub
  1000.  
  1001. Protected Sub DrawGradient(ByVal c1 As Color, ByVal c2 As Color, ByVal r As Rectangle)
  1002. DrawGradientBrush = New LinearGradientBrush(r, c1, c2, 90.0F)
  1003. G.FillRectangle(DrawGradientBrush, r)
  1004. End Sub
  1005. Protected Sub DrawGradient(ByVal c1 As Color, ByVal c2 As Color, ByVal r As Rectangle, ByVal angle As Single)
  1006. DrawGradientBrush = New LinearGradientBrush(r, c1, c2, angle)
  1007. G.FillRectangle(DrawGradientBrush, r)
  1008. End Sub
  1009.  
  1010. #End Region
  1011.  
  1012. #Region " DrawRadial "
  1013.  
  1014. Private DrawRadialPath As GraphicsPath
  1015. Private DrawRadialBrush1 As PathGradientBrush
  1016. Private DrawRadialBrush2 As LinearGradientBrush
  1017. Private DrawRadialRectangle As Rectangle
  1018.  
  1019. Sub DrawRadial(ByVal blend As ColorBlend, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
  1020. DrawRadialRectangle = New Rectangle(x, y, width, height)
  1021. DrawRadial(blend, DrawRadialRectangle, width \ 2, height \ 2)
  1022. End Sub
  1023. 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)
  1024. DrawRadialRectangle = New Rectangle(x, y, width, height)
  1025. DrawRadial(blend, DrawRadialRectangle, center.X, center.Y)
  1026. End Sub
  1027. 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)
  1028. DrawRadialRectangle = New Rectangle(x, y, width, height)
  1029. DrawRadial(blend, DrawRadialRectangle, cx, cy)
  1030. End Sub
  1031.  
  1032. Sub DrawRadial(ByVal blend As ColorBlend, ByVal r As Rectangle)
  1033. DrawRadial(blend, r, r.Width \ 2, r.Height \ 2)
  1034. End Sub
  1035. Sub DrawRadial(ByVal blend As ColorBlend, ByVal r As Rectangle, ByVal center As Point)
  1036. DrawRadial(blend, r, center.X, center.Y)
  1037. End Sub
  1038. Sub DrawRadial(ByVal blend As ColorBlend, ByVal r As Rectangle, ByVal cx As Integer, ByVal cy As Integer)
  1039. DrawRadialPath.Reset()
  1040. DrawRadialPath.AddEllipse(r.X, r.Y, r.Width - 1, r.Height - 1)
  1041.  
  1042. DrawRadialBrush1 = New PathGradientBrush(DrawRadialPath)
  1043. DrawRadialBrush1.CenterPoint = New Point(r.X + cx, r.Y + cy)
  1044. DrawRadialBrush1.InterpolationColors = blend
  1045.  
  1046. If G.SmoothingMode = SmoothingMode.AntiAlias Then
  1047. G.FillEllipse(DrawRadialBrush1, r.X + 1, r.Y + 1, r.Width - 3, r.Height - 3)
  1048. Else
  1049. G.FillEllipse(DrawRadialBrush1, r)
  1050. End If
  1051. End Sub
  1052.  
  1053.  
  1054. 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)
  1055. DrawRadialRectangle = New Rectangle(x, y, width, height)
  1056. DrawRadial(c1, c2, DrawGradientRectangle)
  1057. End Sub
  1058. 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)
  1059. DrawRadialRectangle = New Rectangle(x, y, width, height)
  1060. DrawRadial(c1, c2, DrawGradientRectangle, angle)
  1061. End Sub
  1062.  
  1063. Protected Sub DrawRadial(ByVal c1 As Color, ByVal c2 As Color, ByVal r As Rectangle)
  1064. DrawRadialBrush2 = New LinearGradientBrush(r, c1, c2, 90.0F)
  1065. G.FillRectangle(DrawGradientBrush, r)
  1066. End Sub
  1067. Protected Sub DrawRadial(ByVal c1 As Color, ByVal c2 As Color, ByVal r As Rectangle, ByVal angle As Single)
  1068. DrawRadialBrush2 = New LinearGradientBrush(r, c1, c2, angle)
  1069. G.FillEllipse(DrawGradientBrush, r)
  1070. End Sub
  1071.  
  1072. #End Region
  1073.  
  1074. #Region " CreateRound "
  1075.  
  1076. Private CreateRoundPath As GraphicsPath
  1077. Private CreateRoundRectangle As Rectangle
  1078.  
  1079. Function CreateRound(ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal slope As Integer) As GraphicsPath
  1080. CreateRoundRectangle = New Rectangle(x, y, width, height)
  1081. Return CreateRound(CreateRoundRectangle, slope)
  1082. End Function
  1083.  
  1084. Function CreateRound(ByVal r As Rectangle, ByVal slope As Integer) As GraphicsPath
  1085. CreateRoundPath = New GraphicsPath(FillMode.Winding)
  1086. CreateRoundPath.AddArc(r.X, r.Y, slope, slope, 180.0F, 90.0F)
  1087. CreateRoundPath.AddArc(r.Right - slope, r.Y, slope, slope, 270.0F, 90.0F)
  1088. CreateRoundPath.AddArc(r.Right - slope, r.Bottom - slope, slope, slope, 0.0F, 90.0F)
  1089. CreateRoundPath.AddArc(r.X, r.Bottom - slope, slope, slope, 90.0F, 90.0F)
  1090. CreateRoundPath.CloseFigure()
  1091. Return CreateRoundPath
  1092. End Function
  1093.  
  1094. #End Region
  1095.  
  1096. End Class
  1097.  
  1098. MustInherit Class ThemeControl154
  1099. Inherits Control
  1100.  
  1101.  
  1102. #Region " Initialization "
  1103.  
  1104. Protected G As Graphics, B As Bitmap
  1105.  
  1106. Sub New()
  1107. SetStyle(DirectCast(139270, ControlStyles), True)
  1108.  
  1109. _ImageSize = Size.Empty
  1110. Font = New Font("Verdana", 8S)
  1111.  
  1112. MeasureBitmap = New Bitmap(1, 1)
  1113. MeasureGraphics = Graphics.FromImage(MeasureBitmap)
  1114.  
  1115. DrawRadialPath = New GraphicsPath
  1116.  
  1117. InvalidateCustimization() 'Remove?
  1118. End Sub
  1119.  
  1120. Protected NotOverridable Overrides Sub OnHandleCreated(ByVal e As EventArgs)
  1121. InvalidateCustimization()
  1122. ColorHook()
  1123.  
  1124. If Not _LockWidth = 0 Then Width = _LockWidth
  1125. If Not _LockHeight = 0 Then Height = _LockHeight
  1126.  
  1127. Transparent = _Transparent
  1128. If _Transparent AndAlso _BackColor Then BackColor = Color.Transparent
  1129.  
  1130. MyBase.OnHandleCreated(e)
  1131. End Sub
  1132.  
  1133. Private DoneCreation As Boolean
  1134. Protected NotOverridable Overrides Sub OnParentChanged(ByVal e As EventArgs)
  1135. If Parent IsNot Nothing Then
  1136. OnCreation()
  1137. DoneCreation = True
  1138. InvalidateTimer()
  1139. End If
  1140.  
  1141. MyBase.OnParentChanged(e)
  1142. End Sub
  1143.  
  1144. #End Region
  1145.  
  1146. Private Sub DoAnimation(ByVal i As Boolean)
  1147. OnAnimation()
  1148. If i Then Invalidate()
  1149. End Sub
  1150.  
  1151. Protected NotOverridable Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  1152. If Width = 0 OrElse Height = 0 Then Return
  1153.  
  1154. If _Transparent Then
  1155. PaintHook()
  1156. e.Graphics.DrawImage(B, 0, 0)
  1157. Else
  1158. G = e.Graphics
  1159. PaintHook()
  1160. End If
  1161. End Sub
  1162.  
  1163. Protected Overrides Sub OnHandleDestroyed(ByVal e As EventArgs)
  1164. RemoveAnimationCallback(AddressOf DoAnimation)
  1165. MyBase.OnHandleDestroyed(e)
  1166. End Sub
  1167.  
  1168. #Region " Size Handling "
  1169.  
  1170. Protected NotOverridable Overrides Sub OnSizeChanged(ByVal e As EventArgs)
  1171. If _Transparent Then
  1172. InvalidateBitmap()
  1173. End If
  1174.  
  1175. Invalidate()
  1176. MyBase.OnSizeChanged(e)
  1177. End Sub
  1178.  
  1179. Protected Overrides Sub SetBoundsCore(ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal specified As BoundsSpecified)
  1180. If Not _LockWidth = 0 Then width = _LockWidth
  1181. If Not _LockHeight = 0 Then height = _LockHeight
  1182. MyBase.SetBoundsCore(x, y, width, height, specified)
  1183. End Sub
  1184.  
  1185. #End Region
  1186.  
  1187. #Region " State Handling "
  1188.  
  1189. Private InPosition As Boolean
  1190. Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
  1191. InPosition = True
  1192. SetState(MouseState.Over)
  1193. MyBase.OnMouseEnter(e)
  1194. End Sub
  1195.  
  1196. Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  1197. If InPosition Then SetState(MouseState.Over)
  1198. MyBase.OnMouseUp(e)
  1199. End Sub
  1200.  
  1201. Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  1202. If e.Button = Windows.Forms.MouseButtons.Left Then SetState(MouseState.Down)
  1203. MyBase.OnMouseDown(e)
  1204. End Sub
  1205.  
  1206. Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
  1207. InPosition = False
  1208. SetState(MouseState.None)
  1209. MyBase.OnMouseLeave(e)
  1210. End Sub
  1211.  
  1212. Protected Overrides Sub OnEnabledChanged(ByVal e As EventArgs)
  1213. If Enabled Then SetState(MouseState.None) Else SetState(MouseState.Block)
  1214. MyBase.OnEnabledChanged(e)
  1215. End Sub
  1216.  
  1217. Protected State As MouseState
  1218. Private Sub SetState(ByVal current As MouseState)
  1219. State = current
  1220. Invalidate()
  1221. End Sub
  1222.  
  1223. #End Region
  1224.  
  1225.  
  1226. #Region " Base Properties "
  1227.  
  1228. <Browsable(False), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
  1229. Overrides Property ForeColor() As Color
  1230. Get
  1231. Return Color.Empty
  1232. End Get
  1233. Set(ByVal value As Color)
  1234. End Set
  1235. End Property
  1236. <Browsable(False), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
  1237. Overrides Property BackgroundImage() As Image
  1238. Get
  1239. Return Nothing
  1240. End Get
  1241. Set(ByVal value As Image)
  1242. End Set
  1243. End Property
  1244. <Browsable(False), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
  1245. Overrides Property BackgroundImageLayout() As ImageLayout
  1246. Get
  1247. Return ImageLayout.None
  1248. End Get
  1249. Set(ByVal value As ImageLayout)
  1250. End Set
  1251. End Property
  1252.  
  1253. Overrides Property Text() As String
  1254. Get
  1255. Return MyBase.Text
  1256. End Get
  1257. Set(ByVal value As String)
  1258. MyBase.Text = value
  1259. Invalidate()
  1260. End Set
  1261. End Property
  1262. Overrides Property Font() As Font
  1263. Get
  1264. Return MyBase.Font
  1265. End Get
  1266. Set(ByVal value As Font)
  1267. MyBase.Font = value
  1268. Invalidate()
  1269. End Set
  1270. End Property
  1271.  
  1272. Private _BackColor As Boolean
  1273. <Category("Misc")> _
  1274. Overrides Property BackColor() As Color
  1275. Get
  1276. Return MyBase.BackColor
  1277. End Get
  1278. Set(ByVal value As Color)
  1279. If Not IsHandleCreated AndAlso value = Color.Transparent Then
  1280. _BackColor = True
  1281. Return
  1282. End If
  1283.  
  1284. MyBase.BackColor = value
  1285. If Parent IsNot Nothing Then ColorHook()
  1286. End Set
  1287. End Property
  1288.  
  1289. #End Region
  1290.  
  1291. #Region " Public Properties "
  1292.  
  1293. Private _NoRounding As Boolean
  1294. Property NoRounding() As Boolean
  1295. Get
  1296. Return _NoRounding
  1297. End Get
  1298. Set(ByVal v As Boolean)
  1299. _NoRounding = v
  1300. Invalidate()
  1301. End Set
  1302. End Property
  1303.  
  1304. Private _Image As Image
  1305. Property Image() As Image
  1306. Get
  1307. Return _Image
  1308. End Get
  1309. Set(ByVal value As Image)
  1310. If value Is Nothing Then
  1311. _ImageSize = Size.Empty
  1312. Else
  1313. _ImageSize = value.Size
  1314. End If
  1315.  
  1316. _Image = value
  1317. Invalidate()
  1318. End Set
  1319. End Property
  1320.  
  1321. Private _Transparent As Boolean
  1322. Property Transparent() As Boolean
  1323. Get
  1324. Return _Transparent
  1325. End Get
  1326. Set(ByVal value As Boolean)
  1327. _Transparent = value
  1328. If Not IsHandleCreated Then Return
  1329.  
  1330. If Not value AndAlso Not BackColor.A = 255 Then
  1331. Throw New Exception("Unable to change value to false while a transparent BackColor is in use.")
  1332. End If
  1333.  
  1334. SetStyle(ControlStyles.Opaque, Not value)
  1335. SetStyle(ControlStyles.SupportsTransparentBackColor, value)
  1336.  
  1337. If value Then InvalidateBitmap() Else B = Nothing
  1338. Invalidate()
  1339. End Set
  1340. End Property
  1341.  
  1342. Private Items As New Dictionary(Of String, Color)
  1343. Property Colors() As Bloom()
  1344. Get
  1345. Dim T As New List(Of Bloom)
  1346. Dim E As Dictionary(Of String, Color).Enumerator = Items.GetEnumerator
  1347.  
  1348. While E.MoveNext
  1349. T.Add(New Bloom(E.Current.Key, E.Current.Value))
  1350. End While
  1351.  
  1352. Return T.ToArray
  1353. End Get
  1354. Set(ByVal value As Bloom())
  1355. For Each B As Bloom In value
  1356. If Items.ContainsKey(B.Name) Then Items(B.Name) = B.Value
  1357. Next
  1358.  
  1359. InvalidateCustimization()
  1360. ColorHook()
  1361. Invalidate()
  1362. End Set
  1363. End Property
  1364.  
  1365. Private _Customization As String
  1366. Property Customization() As String
  1367. Get
  1368. Return _Customization
  1369. End Get
  1370. Set(ByVal value As String)
  1371. If value = _Customization Then Return
  1372.  
  1373. Dim Data As Byte()
  1374. Dim Items As Bloom() = Colors
  1375.  
  1376. Try
  1377. Data = Convert.FromBase64String(value)
  1378. For I As Integer = 0 To Items.Length - 1
  1379. Items(I).Value = Color.FromArgb(BitConverter.ToInt32(Data, I * 4))
  1380. Next
  1381. Catch
  1382. Return
  1383. End Try
  1384.  
  1385. _Customization = value
  1386.  
  1387. Colors = Items
  1388. ColorHook()
  1389. Invalidate()
  1390. End Set
  1391. End Property
  1392.  
  1393. #End Region
  1394.  
  1395. #Region " Private Properties "
  1396.  
  1397. Private _ImageSize As Size
  1398. Protected ReadOnly Property ImageSize() As Size
  1399. Get
  1400. Return _ImageSize
  1401. End Get
  1402. End Property
  1403.  
  1404. Private _LockWidth As Integer
  1405. Protected Property LockWidth() As Integer
  1406. Get
  1407. Return _LockWidth
  1408. End Get
  1409. Set(ByVal value As Integer)
  1410. _LockWidth = value
  1411. If Not LockWidth = 0 AndAlso IsHandleCreated Then Width = LockWidth
  1412. End Set
  1413. End Property
  1414.  
  1415. Private _LockHeight As Integer
  1416. Protected Property LockHeight() As Integer
  1417. Get
  1418. Return _LockHeight
  1419. End Get
  1420. Set(ByVal value As Integer)
  1421. _LockHeight = value
  1422. If Not LockHeight = 0 AndAlso IsHandleCreated Then Height = LockHeight
  1423. End Set
  1424. End Property
  1425.  
  1426. Private _IsAnimated As Boolean
  1427. Protected Property IsAnimated() As Boolean
  1428. Get
  1429. Return _IsAnimated
  1430. End Get
  1431. Set(ByVal value As Boolean)
  1432. _IsAnimated = value
  1433. InvalidateTimer()
  1434. End Set
  1435. End Property
  1436.  
  1437. #End Region
  1438.  
  1439.  
  1440. #Region " Property Helpers "
  1441.  
  1442. Protected Function GetPen(ByVal name As String) As Pen
  1443. Return New Pen(Items(name))
  1444. End Function
  1445. Protected Function GetPen(ByVal name As String, ByVal width As Single) As Pen
  1446. Return New Pen(Items(name), width)
  1447. End Function
  1448.  
  1449. Protected Function GetBrush(ByVal name As String) As SolidBrush
  1450. Return New SolidBrush(Items(name))
  1451. End Function
  1452.  
  1453. Protected Function GetColor(ByVal name As String) As Color
  1454. Return Items(name)
  1455. End Function
  1456.  
  1457. Protected Sub SetColor(ByVal name As String, ByVal value As Color)
  1458. If Items.ContainsKey(name) Then Items(name) = value Else Items.Add(name, value)
  1459. End Sub
  1460. Protected Sub SetColor(ByVal name As String, ByVal r As Byte, ByVal g As Byte, ByVal b As Byte)
  1461. SetColor(name, Color.FromArgb(r, g, b))
  1462. End Sub
  1463. Protected Sub SetColor(ByVal name As String, ByVal a As Byte, ByVal r As Byte, ByVal g As Byte, ByVal b As Byte)
  1464. SetColor(name, Color.FromArgb(a, r, g, b))
  1465. End Sub
  1466. Protected Sub SetColor(ByVal name As String, ByVal a As Byte, ByVal value As Color)
  1467. SetColor(name, Color.FromArgb(a, value))
  1468. End Sub
  1469.  
  1470. Private Sub InvalidateBitmap()
  1471. If Width = 0 OrElse Height = 0 Then Return
  1472. B = New Bitmap(Width, Height, PixelFormat.Format32bppPArgb)
  1473. G = Graphics.FromImage(B)
  1474. End Sub
  1475.  
  1476. Private Sub InvalidateCustimization()
  1477. Dim M As New MemoryStream(Items.Count * 4)
  1478.  
  1479. For Each B As Bloom In Colors
  1480. M.Write(BitConverter.GetBytes(B.Value.ToArgb), 0, 4)
  1481. Next
  1482.  
  1483. M.Close()
  1484. _Customization = Convert.ToBase64String(M.ToArray)
  1485. End Sub
  1486.  
  1487. Private Sub InvalidateTimer()
  1488. If DesignMode OrElse Not DoneCreation Then Return
  1489.  
  1490. If _IsAnimated Then
  1491. AddAnimationCallback(AddressOf DoAnimation)
  1492. Else
  1493. RemoveAnimationCallback(AddressOf DoAnimation)
  1494. End If
  1495. End Sub
  1496. #End Region
  1497.  
  1498.  
  1499. #Region " User Hooks "
  1500.  
  1501. Protected MustOverride Sub ColorHook()
  1502. Protected MustOverride Sub PaintHook()
  1503.  
  1504. Protected Overridable Sub OnCreation()
  1505. End Sub
  1506.  
  1507. Protected Overridable Sub OnAnimation()
  1508. End Sub
  1509.  
  1510. #End Region
  1511.  
  1512.  
  1513. #Region " Offset "
  1514.  
  1515. Private OffsetReturnRectangle As Rectangle
  1516. Protected Function Offset(ByVal r As Rectangle, ByVal amount As Integer) As Rectangle
  1517. OffsetReturnRectangle = New Rectangle(r.X + amount, r.Y + amount, r.Width - (amount * 2), r.Height - (amount * 2))
  1518. Return OffsetReturnRectangle
  1519. End Function
  1520.  
  1521. Private OffsetReturnSize As Size
  1522. Protected Function Offset(ByVal s As Size, ByVal amount As Integer) As Size
  1523. OffsetReturnSize = New Size(s.Width + amount, s.Height + amount)
  1524. Return OffsetReturnSize
  1525. End Function
  1526.  
  1527. Private OffsetReturnPoint As Point
  1528. Protected Function Offset(ByVal p As Point, ByVal amount As Integer) As Point
  1529. OffsetReturnPoint = New Point(p.X + amount, p.Y + amount)
  1530. Return OffsetReturnPoint
  1531. End Function
  1532.  
  1533. #End Region
  1534.  
  1535. #Region " Center "
  1536.  
  1537. Private CenterReturn As Point
  1538.  
  1539. Protected Function Center(ByVal p As Rectangle, ByVal c As Rectangle) As Point
  1540. CenterReturn = New Point((p.Width \ 2 - c.Width \ 2) + p.X + c.X, (p.Height \ 2 - c.Height \ 2) + p.Y + c.Y)
  1541. Return CenterReturn
  1542. End Function
  1543. Protected Function Center(ByVal p As Rectangle, ByVal c As Size) As Point
  1544. CenterReturn = New Point((p.Width \ 2 - c.Width \ 2) + p.X, (p.Height \ 2 - c.Height \ 2) + p.Y)
  1545. Return CenterReturn
  1546. End Function
  1547.  
  1548. Protected Function Center(ByVal child As Rectangle) As Point
  1549. Return Center(Width, Height, child.Width, child.Height)
  1550. End Function
  1551. Protected Function Center(ByVal child As Size) As Point
  1552. Return Center(Width, Height, child.Width, child.Height)
  1553. End Function
  1554. Protected Function Center(ByVal childWidth As Integer, ByVal childHeight As Integer) As Point
  1555. Return Center(Width, Height, childWidth, childHeight)
  1556. End Function
  1557.  
  1558. Protected Function Center(ByVal p As Size, ByVal c As Size) As Point
  1559. Return Center(p.Width, p.Height, c.Width, c.Height)
  1560. End Function
  1561.  
  1562. Protected Function Center(ByVal pWidth As Integer, ByVal pHeight As Integer, ByVal cWidth As Integer, ByVal cHeight As Integer) As Point
  1563. CenterReturn = New Point(pWidth \ 2 - cWidth \ 2, pHeight \ 2 - cHeight \ 2)
  1564. Return CenterReturn
  1565. End Function
  1566.  
  1567. #End Region
  1568.  
  1569. #Region " Measure "
  1570.  
  1571. Private MeasureBitmap As Bitmap
  1572. Private MeasureGraphics As Graphics 'TODO: Potential issues during multi-threading.
  1573.  
  1574. Protected Function Measure() As Size
  1575. Return MeasureGraphics.MeasureString(Text, Font, Width).ToSize
  1576. End Function
  1577. Protected Function Measure(ByVal text As String) As Size
  1578. Return MeasureGraphics.MeasureString(text, Font, Width).ToSize
  1579. End Function
  1580.  
  1581. #End Region
  1582.  
  1583.  
  1584. #Region " DrawPixel "
  1585.  
  1586. Private DrawPixelBrush As SolidBrush
  1587.  
  1588. Protected Sub DrawPixel(ByVal c1 As Color, ByVal x As Integer, ByVal y As Integer)
  1589. If _Transparent Then
  1590. B.SetPixel(x, y, c1)
  1591. Else
  1592. DrawPixelBrush = New SolidBrush(c1)
  1593. G.FillRectangle(DrawPixelBrush, x, y, 1, 1)
  1594. End If
  1595. End Sub
  1596.  
  1597. #End Region
  1598.  
  1599. #Region " DrawCorners "
  1600.  
  1601. Private DrawCornersBrush As SolidBrush
  1602.  
  1603. Protected Sub DrawCorners(ByVal c1 As Color, ByVal offset As Integer)
  1604. DrawCorners(c1, 0, 0, Width, Height, offset)
  1605. End Sub
  1606. Protected Sub DrawCorners(ByVal c1 As Color, ByVal r1 As Rectangle, ByVal offset As Integer)
  1607. DrawCorners(c1, r1.X, r1.Y, r1.Width, r1.Height, offset)
  1608. End Sub
  1609. 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)
  1610. DrawCorners(c1, x + offset, y + offset, width - (offset * 2), height - (offset * 2))
  1611. End Sub
  1612.  
  1613. Protected Sub DrawCorners(ByVal c1 As Color)
  1614. DrawCorners(c1, 0, 0, Width, Height)
  1615. End Sub
  1616. Protected Sub DrawCorners(ByVal c1 As Color, ByVal r1 As Rectangle)
  1617. DrawCorners(c1, r1.X, r1.Y, r1.Width, r1.Height)
  1618. End Sub
  1619. Protected Sub DrawCorners(ByVal c1 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
  1620. If _NoRounding Then Return
  1621.  
  1622. If _Transparent Then
  1623. B.SetPixel(x, y, c1)
  1624. B.SetPixel(x + (width - 1), y, c1)
  1625. B.SetPixel(x, y + (height - 1), c1)
  1626. B.SetPixel(x + (width - 1), y + (height - 1), c1)
  1627. Else
  1628. DrawCornersBrush = New SolidBrush(c1)
  1629. G.FillRectangle(DrawCornersBrush, x, y, 1, 1)
  1630. G.FillRectangle(DrawCornersBrush, x + (width - 1), y, 1, 1)
  1631. G.FillRectangle(DrawCornersBrush, x, y + (height - 1), 1, 1)
  1632. G.FillRectangle(DrawCornersBrush, x + (width - 1), y + (height - 1), 1, 1)
  1633. End If
  1634. End Sub
  1635.  
  1636. #End Region
  1637.  
  1638. #Region " DrawBorders "
  1639.  
  1640. Protected Sub DrawBorders(ByVal p1 As Pen, ByVal offset As Integer)
  1641. DrawBorders(p1, 0, 0, Width, Height, offset)
  1642. End Sub
  1643. Protected Sub DrawBorders(ByVal p1 As Pen, ByVal r As Rectangle, ByVal offset As Integer)
  1644. DrawBorders(p1, r.X, r.Y, r.Width, r.Height, offset)
  1645. End Sub
  1646. 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)
  1647. DrawBorders(p1, x + offset, y + offset, width - (offset * 2), height - (offset * 2))
  1648. End Sub
  1649.  
  1650. Protected Sub DrawBorders(ByVal p1 As Pen)
  1651. DrawBorders(p1, 0, 0, Width, Height)
  1652. End Sub
  1653. Protected Sub DrawBorders(ByVal p1 As Pen, ByVal r As Rectangle)
  1654. DrawBorders(p1, r.X, r.Y, r.Width, r.Height)
  1655. End Sub
  1656. Protected Sub DrawBorders(ByVal p1 As Pen, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
  1657. G.DrawRectangle(p1, x, y, width - 1, height - 1)
  1658. End Sub
  1659.  
  1660. #End Region
  1661.  
  1662. #Region " DrawText "
  1663.  
  1664. Private DrawTextPoint As Point
  1665. Private DrawTextSize As Size
  1666.  
  1667. Protected Sub DrawText(ByVal b1 As Brush, ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
  1668. DrawText(b1, Text, a, x, y)
  1669. End Sub
  1670. Protected Sub DrawText(ByVal b1 As Brush, ByVal text As String, ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
  1671. If text.Length = 0 Then Return
  1672.  
  1673. DrawTextSize = Measure(text)
  1674. DrawTextPoint = Center(DrawTextSize)
  1675.  
  1676. Select Case a
  1677. Case HorizontalAlignment.Left
  1678. G.DrawString(text, Font, b1, x, DrawTextPoint.Y + y)
  1679. Case HorizontalAlignment.Center
  1680. G.DrawString(text, Font, b1, DrawTextPoint.X + x, DrawTextPoint.Y + y)
  1681. Case HorizontalAlignment.Right
  1682. G.DrawString(text, Font, b1, Width - DrawTextSize.Width - x, DrawTextPoint.Y + y)
  1683. End Select
  1684. End Sub
  1685.  
  1686. Protected Sub DrawText(ByVal b1 As Brush, ByVal p1 As Point)
  1687. If Text.Length = 0 Then Return
  1688. G.DrawString(Text, Font, b1, p1)
  1689. End Sub
  1690. Protected Sub DrawText(ByVal b1 As Brush, ByVal x As Integer, ByVal y As Integer)
  1691. If Text.Length = 0 Then Return
  1692. G.DrawString(Text, Font, b1, x, y)
  1693. End Sub
  1694.  
  1695. #End Region
  1696.  
  1697. #Region " DrawImage "
  1698.  
  1699. Private DrawImagePoint As Point
  1700.  
  1701. Protected Sub DrawImage(ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
  1702. DrawImage(_Image, a, x, y)
  1703. End Sub
  1704. Protected Sub DrawImage(ByVal image As Image, ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
  1705. If image Is Nothing Then Return
  1706. DrawImagePoint = Center(image.Size)
  1707.  
  1708. Select Case a
  1709. Case HorizontalAlignment.Left
  1710. G.DrawImage(image, x, DrawImagePoint.Y + y, image.Width, image.Height)
  1711. Case HorizontalAlignment.Center
  1712. G.DrawImage(image, DrawImagePoint.X + x, DrawImagePoint.Y + y, image.Width, image.Height)
  1713. Case HorizontalAlignment.Right
  1714. G.DrawImage(image, Width - image.Width - x, DrawImagePoint.Y + y, image.Width, image.Height)
  1715. End Select
  1716. End Sub
  1717.  
  1718. Protected Sub DrawImage(ByVal p1 As Point)
  1719. DrawImage(_Image, p1.X, p1.Y)
  1720. End Sub
  1721. Protected Sub DrawImage(ByVal x As Integer, ByVal y As Integer)
  1722. DrawImage(_Image, x, y)
  1723. End Sub
  1724.  
  1725. Protected Sub DrawImage(ByVal image As Image, ByVal p1 As Point)
  1726. DrawImage(image, p1.X, p1.Y)
  1727. End Sub
  1728. Protected Sub DrawImage(ByVal image As Image, ByVal x As Integer, ByVal y As Integer)
  1729. If image Is Nothing Then Return
  1730. G.DrawImage(image, x, y, image.Width, image.Height)
  1731. End Sub
  1732.  
  1733. #End Region
  1734.  
  1735. #Region " DrawGradient "
  1736.  
  1737. Private DrawGradientBrush As LinearGradientBrush
  1738. Private DrawGradientRectangle As Rectangle
  1739.  
  1740. Protected Sub DrawGradient(ByVal blend As ColorBlend, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
  1741. DrawGradientRectangle = New Rectangle(x, y, width, height)
  1742. DrawGradient(blend, DrawGradientRectangle)
  1743. End Sub
  1744. 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)
  1745. DrawGradientRectangle = New Rectangle(x, y, width, height)
  1746. DrawGradient(blend, DrawGradientRectangle, angle)
  1747. End Sub
  1748.  
  1749. Protected Sub DrawGradient(ByVal blend As ColorBlend, ByVal r As Rectangle)
  1750. DrawGradientBrush = New LinearGradientBrush(r, Color.Empty, Color.Empty, 90.0F)
  1751. DrawGradientBrush.InterpolationColors = blend
  1752. G.FillRectangle(DrawGradientBrush, r)
  1753. End Sub
  1754. Protected Sub DrawGradient(ByVal blend As ColorBlend, ByVal r As Rectangle, ByVal angle As Single)
  1755. DrawGradientBrush = New LinearGradientBrush(r, Color.Empty, Color.Empty, angle)
  1756. DrawGradientBrush.InterpolationColors = blend
  1757. G.FillRectangle(DrawGradientBrush, r)
  1758. End Sub
  1759.  
  1760.  
  1761. 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)
  1762. DrawGradientRectangle = New Rectangle(x, y, width, height)
  1763. DrawGradient(c1, c2, DrawGradientRectangle)
  1764. End Sub
  1765. 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)
  1766. DrawGradientRectangle = New Rectangle(x, y, width, height)
  1767. DrawGradient(c1, c2, DrawGradientRectangle, angle)
  1768. End Sub
  1769.  
  1770. Protected Sub DrawGradient(ByVal c1 As Color, ByVal c2 As Color, ByVal r As Rectangle)
  1771. DrawGradientBrush = New LinearGradientBrush(r, c1, c2, 90.0F)
  1772. G.FillRectangle(DrawGradientBrush, r)
  1773. End Sub
  1774. Protected Sub DrawGradient(ByVal c1 As Color, ByVal c2 As Color, ByVal r As Rectangle, ByVal angle As Single)
  1775. DrawGradientBrush = New LinearGradientBrush(r, c1, c2, angle)
  1776. G.FillRectangle(DrawGradientBrush, r)
  1777. End Sub
  1778.  
  1779. #End Region
  1780.  
  1781. #Region " DrawRadial "
  1782.  
  1783. Private DrawRadialPath As GraphicsPath
  1784. Private DrawRadialBrush1 As PathGradientBrush
  1785. Private DrawRadialBrush2 As LinearGradientBrush
  1786. Private DrawRadialRectangle As Rectangle
  1787.  
  1788. Sub DrawRadial(ByVal blend As ColorBlend, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
  1789. DrawRadialRectangle = New Rectangle(x, y, width, height)
  1790. DrawRadial(blend, DrawRadialRectangle, width \ 2, height \ 2)
  1791. End Sub
  1792. 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)
  1793. DrawRadialRectangle = New Rectangle(x, y, width, height)
  1794. DrawRadial(blend, DrawRadialRectangle, center.X, center.Y)
  1795. End Sub
  1796. 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)
  1797. DrawRadialRectangle = New Rectangle(x, y, width, height)
  1798. DrawRadial(blend, DrawRadialRectangle, cx, cy)
  1799. End Sub
  1800.  
  1801. Sub DrawRadial(ByVal blend As ColorBlend, ByVal r As Rectangle)
  1802. DrawRadial(blend, r, r.Width \ 2, r.Height \ 2)
  1803. End Sub
  1804. Sub DrawRadial(ByVal blend As ColorBlend, ByVal r As Rectangle, ByVal center As Point)
  1805. DrawRadial(blend, r, center.X, center.Y)
  1806. End Sub
  1807. Sub DrawRadial(ByVal blend As ColorBlend, ByVal r As Rectangle, ByVal cx As Integer, ByVal cy As Integer)
  1808. DrawRadialPath.Reset()
  1809. DrawRadialPath.AddEllipse(r.X, r.Y, r.Width - 1, r.Height - 1)
  1810.  
  1811. DrawRadialBrush1 = New PathGradientBrush(DrawRadialPath)
  1812. DrawRadialBrush1.CenterPoint = New Point(r.X + cx, r.Y + cy)
  1813. DrawRadialBrush1.InterpolationColors = blend
  1814.  
  1815. If G.SmoothingMode = SmoothingMode.AntiAlias Then
  1816. G.FillEllipse(DrawRadialBrush1, r.X + 1, r.Y + 1, r.Width - 3, r.Height - 3)
  1817. Else
  1818. G.FillEllipse(DrawRadialBrush1, r)
  1819. End If
  1820. End Sub
  1821.  
  1822.  
  1823. 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)
  1824. DrawRadialRectangle = New Rectangle(x, y, width, height)
  1825. DrawRadial(c1, c2, DrawRadialRectangle)
  1826. End Sub
  1827. 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)
  1828. DrawRadialRectangle = New Rectangle(x, y, width, height)
  1829. DrawRadial(c1, c2, DrawRadialRectangle, angle)
  1830. End Sub
  1831.  
  1832. Protected Sub DrawRadial(ByVal c1 As Color, ByVal c2 As Color, ByVal r As Rectangle)
  1833. DrawRadialBrush2 = New LinearGradientBrush(r, c1, c2, 90.0F)
  1834. G.FillEllipse(DrawRadialBrush2, r)
  1835. End Sub
  1836. Protected Sub DrawRadial(ByVal c1 As Color, ByVal c2 As Color, ByVal r As Rectangle, ByVal angle As Single)
  1837. DrawRadialBrush2 = New LinearGradientBrush(r, c1, c2, angle)
  1838. G.FillEllipse(DrawRadialBrush2, r)
  1839. End Sub
  1840.  
  1841. #End Region
  1842.  
  1843. #Region " CreateRound "
  1844.  
  1845. Private CreateRoundPath As GraphicsPath
  1846. Private CreateRoundRectangle As Rectangle
  1847.  
  1848. Function CreateRound(ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal slope As Integer) As GraphicsPath
  1849. CreateRoundRectangle = New Rectangle(x, y, width, height)
  1850. Return CreateRound(CreateRoundRectangle, slope)
  1851. End Function
  1852.  
  1853. Function CreateRound(ByVal r As Rectangle, ByVal slope As Integer) As GraphicsPath
  1854. CreateRoundPath = New GraphicsPath(FillMode.Winding)
  1855. CreateRoundPath.AddArc(r.X, r.Y, slope, slope, 180.0F, 90.0F)
  1856. CreateRoundPath.AddArc(r.Right - slope, r.Y, slope, slope, 270.0F, 90.0F)
  1857. CreateRoundPath.AddArc(r.Right - slope, r.Bottom - slope, slope, slope, 0.0F, 90.0F)
  1858. CreateRoundPath.AddArc(r.X, r.Bottom - slope, slope, slope, 90.0F, 90.0F)
  1859. CreateRoundPath.CloseFigure()
  1860. Return CreateRoundPath
  1861. End Function
  1862.  
  1863. #End Region
  1864.  
  1865. End Class
  1866.  
  1867. Module ThemeShare
  1868.  
  1869. #Region " Animation "
  1870.  
  1871. Private Frames As Integer
  1872. Private Invalidate As Boolean
  1873. Public ThemeTimer As New PrecisionTimer
  1874.  
  1875. Private Const FPS As Integer = 50 '1000 / 50 = 20 FPS
  1876. Private Const Rate As Integer = 10
  1877.  
  1878. Public Delegate Sub AnimationDelegate(ByVal invalidate As Boolean)
  1879.  
  1880. Private Callbacks As New List(Of AnimationDelegate)
  1881.  
  1882. Private Sub HandleCallbacks(ByVal state As IntPtr, ByVal reserve As Boolean)
  1883. Invalidate = (Frames >= FPS)
  1884. If Invalidate Then Frames = 0
  1885.  
  1886. SyncLock Callbacks
  1887. For I As Integer = 0 To Callbacks.Count - 1
  1888. Callbacks(I).Invoke(Invalidate)
  1889. Next
  1890. End SyncLock
  1891.  
  1892. Frames += Rate
  1893. End Sub
  1894.  
  1895. Private Sub InvalidateThemeTimer()
  1896. If Callbacks.Count = 0 Then
  1897. ThemeTimer.Delete()
  1898. Else
  1899. ThemeTimer.Create(0, Rate, AddressOf HandleCallbacks)
  1900. End If
  1901. End Sub
  1902.  
  1903. Sub AddAnimationCallback(ByVal callback As AnimationDelegate)
  1904. SyncLock Callbacks
  1905. If Callbacks.Contains(callback) Then Return
  1906.  
  1907. Callbacks.Add(callback)
  1908. InvalidateThemeTimer()
  1909. End SyncLock
  1910. End Sub
  1911.  
  1912. Sub RemoveAnimationCallback(ByVal callback As AnimationDelegate)
  1913. SyncLock Callbacks
  1914. If Not Callbacks.Contains(callback) Then Return
  1915.  
  1916. Callbacks.Remove(callback)
  1917. InvalidateThemeTimer()
  1918. End SyncLock
  1919. End Sub
  1920.  
  1921. #End Region
  1922.  
  1923. End Module
  1924.  
  1925. Enum MouseState As Byte
  1926. None = 0
  1927. Over = 1
  1928. Down = 2
  1929. Block = 3
  1930. End Enum
  1931.  
  1932. Structure Bloom
  1933.  
  1934. Public _Name As String
  1935. ReadOnly Property Name() As String
  1936. Get
  1937. Return _Name
  1938. End Get
  1939. End Property
  1940.  
  1941. Private _Value As Color
  1942. Property Value() As Color
  1943. Get
  1944. Return _Value
  1945. End Get
  1946. Set(ByVal value As Color)
  1947. _Value = value
  1948. End Set
  1949. End Property
  1950.  
  1951. Property ValueHex() As String
  1952. Get
  1953. Return String.Concat("#", _
  1954. _Value.R.ToString("X2", Nothing), _
  1955. _Value.G.ToString("X2", Nothing), _
  1956. _Value.B.ToString("X2", Nothing))
  1957. End Get
  1958. Set(ByVal value As String)
  1959. Try
  1960. _Value = ColorTranslator.FromHtml(value)
  1961. Catch
  1962. Return
  1963. End Try
  1964. End Set
  1965. End Property
  1966.  
  1967.  
  1968. Sub New(ByVal name As String, ByVal value As Color)
  1969. _Name = name
  1970. _Value = value
  1971. End Sub
  1972. End Structure
  1973.  
  1974. '------------------
  1975. 'Creator: aeonhack
  1976. 'Site: elitevs.net
  1977. 'Created: 11/30/2011
  1978. 'Changed: 11/30/2011
  1979. 'Version: 1.0.0
  1980. '------------------
  1981. Class PrecisionTimer
  1982. Implements IDisposable
  1983.  
  1984. Private _Enabled As Boolean
  1985. ReadOnly Property Enabled() As Boolean
  1986. Get
  1987. Return _Enabled
  1988. End Get
  1989. End Property
  1990.  
  1991. Private Handle As IntPtr
  1992. Private TimerCallback As TimerDelegate
  1993.  
  1994. <DllImport("kernel32.dll", EntryPoint:="CreateTimerQueueTimer")> _
  1995. Private Shared Function CreateTimerQueueTimer( _
  1996. ByRef handle As IntPtr, _
  1997. ByVal queue As IntPtr, _
  1998. ByVal callback As TimerDelegate, _
  1999. ByVal state As IntPtr, _
  2000. ByVal dueTime As UInteger, _
  2001. ByVal period As UInteger, _
  2002. ByVal flags As UInteger) As Boolean
  2003. End Function
  2004.  
  2005. <DllImport("kernel32.dll", EntryPoint:="DeleteTimerQueueTimer")> _
  2006. Private Shared Function DeleteTimerQueueTimer( _
  2007. ByVal queue As IntPtr, _
  2008. ByVal handle As IntPtr, _
  2009. ByVal callback As IntPtr) As Boolean
  2010. End Function
  2011.  
  2012. Delegate Sub TimerDelegate(ByVal r1 As IntPtr, ByVal r2 As Boolean)
  2013.  
  2014. Sub Create(ByVal dueTime As UInteger, ByVal period As UInteger, ByVal callback As TimerDelegate)
  2015. If _Enabled Then Return
  2016.  
  2017. TimerCallback = callback
  2018. Dim Success As Boolean = CreateTimerQueueTimer(Handle, IntPtr.Zero, TimerCallback, IntPtr.Zero, dueTime, period, 0)
  2019.  
  2020. If Not Success Then ThrowNewException("CreateTimerQueueTimer")
  2021. _Enabled = Success
  2022. End Sub
  2023.  
  2024. Sub Delete()
  2025. If Not _Enabled Then Return
  2026. Dim Success As Boolean = DeleteTimerQueueTimer(IntPtr.Zero, Handle, IntPtr.Zero)
  2027.  
  2028. If Not Success AndAlso Not Marshal.GetLastWin32Error = 997 Then
  2029. ThrowNewException("DeleteTimerQueueTimer")
  2030. End If
  2031.  
  2032. _Enabled = Not Success
  2033. End Sub
  2034.  
  2035. Private Sub ThrowNewException(ByVal name As String)
  2036. Throw New Exception(String.Format("{0} failed. Win32Error: {1}", name, Marshal.GetLastWin32Error))
  2037. End Sub
  2038.  
  2039. Public Sub Dispose() Implements IDisposable.Dispose
  2040. Delete()
  2041. End Sub
  2042. End Class
  2043.  
  2044. Module ThemeModule
  2045.  
  2046. Friend G As Graphics
  2047.  
  2048. Sub New()
  2049. TextBitmap = New Bitmap(1, 1)
  2050. TextGraphics = Graphics.FromImage(TextBitmap)
  2051. End Sub
  2052.  
  2053. Private TextBitmap As Bitmap
  2054. Private TextGraphics As Graphics
  2055.  
  2056. Friend Function MeasureString(ByVal text As String, ByVal font As Font) As SizeF
  2057. Return TextGraphics.MeasureString(text, font)
  2058. End Function
  2059.  
  2060. Friend Function MeasureString(ByVal text As String, ByVal font As Font, ByVal width As Integer) As SizeF
  2061. Return TextGraphics.MeasureString(text, font, width, StringFormat.GenericTypographic)
  2062. End Function
  2063.  
  2064. Private CreateRoundPath As GraphicsPath
  2065. Private CreateRoundRectangle As Rectangle
  2066.  
  2067. Friend Function CreateRound(ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal slope As Integer) As GraphicsPath
  2068. CreateRoundRectangle = New Rectangle(x, y, width, height)
  2069. Return CreateRound(CreateRoundRectangle, slope)
  2070. End Function
  2071.  
  2072. Friend Function CreateRound(ByVal r As Rectangle, ByVal slope As Integer) As GraphicsPath
  2073. CreateRoundPath = New GraphicsPath(FillMode.Winding)
  2074. CreateRoundPath.AddArc(r.X, r.Y, slope, slope, 180.0F, 90.0F)
  2075. CreateRoundPath.AddArc(r.Right - slope, r.Y, slope, slope, 270.0F, 90.0F)
  2076. CreateRoundPath.AddArc(r.Right - slope, r.Bottom - slope, slope, slope, 0.0F, 90.0F)
  2077. CreateRoundPath.AddArc(r.X, r.Bottom - slope, slope, slope, 90.0F, 90.0F)
  2078. CreateRoundPath.CloseFigure()
  2079. Return CreateRoundPath
  2080. End Function
  2081.  
  2082. End Module
  2083. #End Region
  2084.  
  2085. '/------------------------------------------------------------------------------------------------------------------\
  2086. '| 88888888888 888888888888 88 |
  2087. '| 88 ,d 88 88 |
  2088. '| 88 88 88 88 |
  2089. '| 88aaaaa 8b,dPPYba, ,adPPYba, ,adPPYba, MM88MMM 88 88,dPPYba, ,adPPYba, 88,dPYba,,adPYba, ,adPPYba, |
  2090. '| 88""""" 88P' "Y8 a8" "8a I8[ "" 88 88 88P' "8a a8P_____88 88P' "88" "8a a8P_____88 |
  2091. '| 88 88 8b d8 `"Y8ba, 88 88 88 88 8PP""""""" 88 88 88 8PP""""""" |
  2092. '| 88 88 "8a, ,a8" aa ]8I 88, 88 88 88 "8b, ,aa 88 88 88 "8b, ,aa |
  2093. '| 88 88 `"YbbdP"' `"YbbdP"' "Y888 88 88 88 `"Ybbd8"' 88 88 88 `"Ybbd8"' |
  2094. '| |
  2095. '| |
  2096. '| Creator: Hoody |
  2097. '| Created: 2/25/2014 |
  2098. '| Changed: 3/16/2014 |
  2099. '| Version: 1.2.1 |
  2100. '\------------------------------------------------------------------------------------------------------------------/
  2101. Class FrostButton
  2102. Inherits ThemeControl154
  2103.  
  2104. Private _FontColor As Color = Color.FromArgb(132, 112, 255)
  2105. Public Property FontColor() As Color
  2106. Get
  2107. Return _FontColor
  2108. End Get
  2109. Set(ByVal value As Color)
  2110. _FontColor = value
  2111. Invalidate()
  2112. End Set
  2113. End Property
  2114.  
  2115. #Region "None Colors"
  2116.  
  2117. Private _ColorNone1 As Color = Color.FromArgb(47, 48, 52)
  2118. Public Property ColorNone1() As Color
  2119. Get
  2120. Return _ColorNone1
  2121. End Get
  2122. Set(ByVal value As Color)
  2123. _ColorNone1 = value
  2124. Invalidate()
  2125. End Set
  2126. End Property
  2127.  
  2128. Private _ColorNone2 As Color = Color.FromArgb(29, 29, 29)
  2129. Public Property ColorNone2() As Color
  2130. Get
  2131. Return _ColorNone2
  2132. End Get
  2133. Set(ByVal value As Color)
  2134. _ColorNone2 = value
  2135. Invalidate()
  2136. End Set
  2137. End Property
  2138.  
  2139. Private _ColorNoneOutline As Color = Color.FromArgb(70, 70, 70)
  2140. Public Property ColorNoneOutline() As Color
  2141. Get
  2142. Return _ColorNoneOutline
  2143. End Get
  2144. Set(ByVal value As Color)
  2145. _ColorNoneOutline = value
  2146. Invalidate()
  2147. End Set
  2148. End Property
  2149.  
  2150. #End Region
  2151.  
  2152. #Region "Over Colors"
  2153.  
  2154. Private _ColorOver1 As Color = Color.FromArgb(67, 68, 72)
  2155. Public Property ColorOver1() As Color
  2156. Get
  2157. Return _ColorOver1
  2158. End Get
  2159. Set(ByVal value As Color)
  2160. _ColorOver1 = value
  2161. Invalidate()
  2162. End Set
  2163. End Property
  2164.  
  2165. Private _ColorOver2 As Color = Color.FromArgb(49, 49, 49)
  2166. Public Property ColorOver2() As Color
  2167. Get
  2168. Return _ColorOver2
  2169. End Get
  2170. Set(ByVal value As Color)
  2171. _ColorOver2 = value
  2172. Invalidate()
  2173. End Set
  2174. End Property
  2175.  
  2176. Private _ColorOverOutline As Color = Color.FromArgb(100, 100, 100)
  2177. Public Property ColorOverOutline() As Color
  2178. Get
  2179. Return _ColorOverOutline
  2180. End Get
  2181. Set(ByVal value As Color)
  2182. _ColorOverOutline = value
  2183. Invalidate()
  2184. End Set
  2185. End Property
  2186.  
  2187. #End Region
  2188.  
  2189. #Region "Down Colors"
  2190.  
  2191. Private _ColorDown1 As Color = Color.FromArgb(27, 28, 32)
  2192. Public Property ColorDown1() As Color
  2193. Get
  2194. Return _ColorDown1
  2195. End Get
  2196. Set(ByVal value As Color)
  2197. _ColorDown1 = value
  2198. Invalidate()
  2199. End Set
  2200. End Property
  2201.  
  2202. Private _ColorDown2 As Color = Color.FromArgb(9, 9, 9)
  2203. Public Property ColorDown2() As Color
  2204. Get
  2205. Return _ColorDown2
  2206. End Get
  2207. Set(ByVal value As Color)
  2208. _ColorDown2 = value
  2209. Invalidate()
  2210. End Set
  2211. End Property
  2212.  
  2213. Private _ColorDownOutline As Color = Color.FromArgb(40, 40, 40)
  2214. Public Property ColorDownOutline() As Color
  2215. Get
  2216. Return _ColorDownOutline
  2217. End Get
  2218. Set(ByVal value As Color)
  2219. _ColorDownOutline = value
  2220. Invalidate()
  2221. End Set
  2222. End Property
  2223.  
  2224. #End Region
  2225.  
  2226.  
  2227. Sub New()
  2228. BackColor = Color.FromArgb(0, 0, 0)
  2229. Font = New Font("Segoe UI", 10)
  2230. End Sub
  2231. Dim TextBrush As Brush
  2232. Protected Overrides Sub ColorHook()
  2233. End Sub
  2234.  
  2235. Protected Overrides Sub PaintHook()
  2236. G.Clear(BackColor)
  2237. Select Case State
  2238. Case MouseState.None
  2239. G.FillRectangle(New SolidBrush(_ColorNone1), New Rectangle(0, 0, Width, Height))
  2240. G.FillRectangle(New SolidBrush(_ColorNone2), New Rectangle(0, Height / 2, Width, Height))
  2241. G.DrawRectangle(New Pen(_ColorNoneOutline), New Rectangle(1, 1, Width - 3, Height - 3))
  2242. Case MouseState.Over
  2243. G.FillRectangle(New SolidBrush(_ColorOver1), New Rectangle(0, 0, Width, Height))
  2244. G.FillRectangle(New SolidBrush(_ColorOver2), New Rectangle(0, Height / 2, Width, Height))
  2245. G.DrawRectangle(New Pen(_ColorOverOutline), New Rectangle(1, 1, Width - 3, Height - 3))
  2246. Case MouseState.Down
  2247. G.FillRectangle(New SolidBrush(_ColorDown1), New Rectangle(0, 0, Width, Height))
  2248. G.FillRectangle(New SolidBrush(_ColorDown2), New Rectangle(0, Height / 2, Width, Height))
  2249. G.DrawRectangle(New Pen(_ColorDownOutline), New Rectangle(1, 1, Width - 3, Height - 3))
  2250. End Select
  2251. DrawText(New SolidBrush(FontColor), HorizontalAlignment.Center, 0, 0)
  2252. G.DrawRectangle(New Pen(BackColor), New Rectangle(0, 0, Width - 1, Height - 1))
  2253. End Sub
  2254. End Class
  2255. <DefaultEvent("CheckedChanged")> _
  2256. Class FrostCheckBox
  2257. Inherits ThemeControl154
  2258.  
  2259.  
  2260. Private _FontColor As Color = Color.FromArgb(132, 112, 255)
  2261. Public Property FontColor() As Color
  2262. Get
  2263. Return _FontColor
  2264. End Get
  2265. Set(ByVal value As Color)
  2266. _FontColor = value
  2267. Invalidate()
  2268. End Set
  2269. End Property
  2270.  
  2271. Private _Color1 As Color = Color.FromArgb(70, 70, 70)
  2272. Public Property Color1() As Color
  2273. Get
  2274. Return _Color1
  2275. End Get
  2276. Set(ByVal value As Color)
  2277. _Color1 = value
  2278. Invalidate()
  2279. End Set
  2280. End Property
  2281.  
  2282. Private _Color2 As Color = Color.FromArgb(132, 112, 255)
  2283. Public Property Color2() As Color
  2284. Get
  2285. Return _Color2
  2286. End Get
  2287. Set(ByVal value As Color)
  2288. _Color2 = value
  2289. Invalidate()
  2290. End Set
  2291. End Property
  2292.  
  2293. Private _Color3 As Color = Color.FromArgb(122, 102, 245)
  2294. Public Property Color3() As Color
  2295. Get
  2296. Return _Color3
  2297. End Get
  2298. Set(ByVal value As Color)
  2299. _Color3 = value
  2300. Invalidate()
  2301. End Set
  2302. End Property
  2303.  
  2304. Private _Color4 As Color = Color.FromArgb(30, 30, 30)
  2305. Public Property Color4() As Color
  2306. Get
  2307. Return _Color4
  2308. End Get
  2309. Set(ByVal value As Color)
  2310. _Color4 = value
  2311. Invalidate()
  2312. End Set
  2313. End Property
  2314.  
  2315. Private _Color5 As Color = Color.FromArgb(25, 25, 25)
  2316. Public Property Color5() As Color
  2317. Get
  2318. Return _Color5
  2319. End Get
  2320. Set(ByVal value As Color)
  2321. _Color5 = value
  2322. Invalidate()
  2323. End Set
  2324. End Property
  2325.  
  2326. Event CheckedChanged(ByVal sender As Object)
  2327.  
  2328. Sub New()
  2329. SetStyle(DirectCast(139286, ControlStyles), True)
  2330. SetStyle(ControlStyles.Selectable, False)
  2331.  
  2332. BackColor = Color.FromArgb(21, 21, 21)
  2333. Font = New Font("Segoe UI", 10)
  2334.  
  2335. End Sub
  2336.  
  2337. Private _Checked As Boolean
  2338. Public Property Checked() As Boolean
  2339. Get
  2340. Return _Checked
  2341. End Get
  2342. Set(ByVal value As Boolean)
  2343. _Checked = value
  2344.  
  2345. If _Checked Then
  2346. InvalidateParent()
  2347. End If
  2348.  
  2349. RaiseEvent CheckedChanged(Me)
  2350. Invalidate()
  2351. End Set
  2352. End Property
  2353.  
  2354. Private Sub InvalidateParent()
  2355. If Parent Is Nothing Then Return
  2356. End Sub
  2357.  
  2358.  
  2359. Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  2360. If Checked Then
  2361. Checked = False
  2362. Else
  2363. Checked = True
  2364. End If
  2365. MyBase.OnMouseDown(e)
  2366. End Sub
  2367.  
  2368. Protected Overrides Sub ColorHook()
  2369. End Sub
  2370.  
  2371. Protected Overrides Sub PaintHook()
  2372. SetStyle(ControlStyles.SupportsTransparentBackColor, True)
  2373. G.Clear(BackColor)
  2374. G.DrawRectangle(New Pen(_Color1), New Rectangle(1, 1, Height - 3, Height - 3))
  2375. If _Checked Then
  2376. G.FillRectangle(New SolidBrush(_Color2), New Rectangle(3, 3, Height - 6, Height / 2))
  2377. G.FillRectangle(New SolidBrush(_Color3), New Rectangle(3, Height / 2, Height - 6, Height / 2 - 4))
  2378. Else
  2379. G.FillRectangle(New SolidBrush(_Color4), New Rectangle(3, 3, Height - 6, Height / 2))
  2380. G.FillRectangle(New SolidBrush(_Color5), New Rectangle(3, Height / 2, Height - 6, Height / 2 - 4))
  2381. End If
  2382. DrawText(New SolidBrush(_FontColor), Height + 5, Height / 2 - Me.Font.SizeInPoints)
  2383. End Sub
  2384. End Class
  2385. Class FrostCloseWindow
  2386. Inherits ThemeControl154
  2387.  
  2388. #Region "Color None"
  2389.  
  2390. Private _ColorNone1 As Color = Color.FromArgb(40, 40, 40)
  2391. Public Property ColorNone1() As Color
  2392. Get
  2393. Return _ColorNone1
  2394. End Get
  2395. Set(ByVal value As Color)
  2396. _ColorNone1 = value
  2397. Invalidate()
  2398. End Set
  2399. End Property
  2400.  
  2401. Private _ColorNone2 As Color = Color.FromArgb(35, 35, 35)
  2402. Public Property ColorNone2() As Color
  2403. Get
  2404. Return _ColorNone2
  2405. End Get
  2406. Set(ByVal value As Color)
  2407. _ColorNone2 = value
  2408. Invalidate()
  2409. End Set
  2410. End Property
  2411.  
  2412. Private _ColorNoneOutline As Color = Color.FromArgb(0, 0, 0)
  2413. Public Property ColorNoneOutline() As Color
  2414. Get
  2415. Return _ColorNoneOutline
  2416. End Get
  2417. Set(ByVal value As Color)
  2418. _ColorNoneOutline = value
  2419. Invalidate()
  2420. End Set
  2421. End Property
  2422.  
  2423. #End Region
  2424.  
  2425. #Region "Color Over"
  2426.  
  2427. Private _ColorOver1 As Color = Color.FromArgb(60, 60, 60)
  2428. Public Property ColorOver1() As Color
  2429. Get
  2430. Return _ColorOver1
  2431. End Get
  2432. Set(ByVal value As Color)
  2433. _ColorOver1 = value
  2434. Invalidate()
  2435. End Set
  2436. End Property
  2437.  
  2438. Private _ColorOver2 As Color = Color.FromArgb(55, 55, 55)
  2439. Public Property ColorOver2() As Color
  2440. Get
  2441. Return _ColorOver2
  2442. End Get
  2443. Set(ByVal value As Color)
  2444. _ColorOver2 = value
  2445. Invalidate()
  2446. End Set
  2447. End Property
  2448.  
  2449. Private _ColorOverOutline As Color = Color.FromArgb(0, 0, 0)
  2450. Public Property ColorOverOutline() As Color
  2451. Get
  2452. Return _ColorOverOutline
  2453. End Get
  2454. Set(ByVal value As Color)
  2455. _ColorOverOutline = value
  2456. Invalidate()
  2457. End Set
  2458. End Property
  2459.  
  2460. #End Region
  2461.  
  2462. Sub New()
  2463. Anchor = AnchorStyles.Top Or AnchorStyles.Right
  2464. End Sub
  2465. Protected Overrides Sub ColorHook()
  2466. End Sub
  2467.  
  2468. Protected Overrides Sub PaintHook()
  2469. G.Clear(Color.Transparent)
  2470. Me.Width = 30
  2471. Me.Height = 7
  2472. Me.MaximumSize = New Size(New Point(25, 7))
  2473. Select Case State
  2474. Case MouseState.None
  2475. G.FillRectangle(New SolidBrush(_ColorNone1), New Rectangle(0, 0, Width, Height / 2))
  2476. G.FillRectangle(New SolidBrush(_ColorNone1), New Rectangle(0, Height / 2, Width, Height / 2))
  2477. G.DrawRectangle(New Pen(_ColorNoneOutline), New Rectangle(0, 0, Width - 1, Height - 1))
  2478. Case MouseState.Over
  2479. G.FillRectangle(New SolidBrush(_ColorOver1), New Rectangle(0, 0, Width, Height / 2))
  2480. G.FillRectangle(New SolidBrush(_ColorOver2), New Rectangle(0, Height / 2, Width, Height / 2))
  2481. G.DrawRectangle(New Pen(_ColorOverOutline), New Rectangle(0, 0, Width - 1, Height - 1))
  2482.  
  2483. ' I would do MouseState.Down : FindForm.Close() but it closes the theme then the form and it looks ugly. Just do it manually. Sorry
  2484. End Select
  2485. End Sub
  2486. End Class
  2487. Class FrostComboBox
  2488. Inherits ComboBox
  2489.  
  2490. Private _FontColor As Color = Color.FromArgb(132, 112, 255)
  2491. Public Property FontColor() As Color
  2492. Get
  2493. Return _FontColor
  2494. End Get
  2495. Set(ByVal value As Color)
  2496. _FontColor = value
  2497. Invalidate()
  2498. End Set
  2499. End Property
  2500.  
  2501. Private _Color1 As Color = Color.FromArgb(27, 28, 32)
  2502. Public Property Color1() As Color
  2503. Get
  2504. Return _Color1
  2505. End Get
  2506. Set(ByVal value As Color)
  2507. _Color1 = value
  2508. Invalidate()
  2509. End Set
  2510. End Property
  2511.  
  2512. Private _Color2 As Color = Color.FromArgb(9, 9, 9)
  2513. Public Property Color2() As Color
  2514. Get
  2515. Return _Color2
  2516. End Get
  2517. Set(ByVal value As Color)
  2518. _Color2 = value
  2519. Invalidate()
  2520. End Set
  2521. End Property
  2522.  
  2523. Private _Color3 As Color = Color.FromArgb(70, 70, 70)
  2524. Public Property Color3() As Color
  2525. Get
  2526. Return _Color3
  2527. End Get
  2528. Set(ByVal value As Color)
  2529. _Color3 = value
  2530. Invalidate()
  2531. End Set
  2532. End Property
  2533.  
  2534. Private _Color4 As Color = Color.FromArgb(100, 100, 100)
  2535. Public Property Color4() As Color
  2536. Get
  2537. Return _Color4
  2538. End Get
  2539. Set(ByVal value As Color)
  2540. _Color4 = value
  2541. Invalidate()
  2542. End Set
  2543. End Property
  2544.  
  2545. Private _Color5 As Color = Color.FromArgb(29, 29, 29)
  2546. Public Property Color5() As Color
  2547. Get
  2548. Return _Color5
  2549. End Get
  2550. Set(ByVal value As Color)
  2551. _Color5 = value
  2552. Invalidate()
  2553. End Set
  2554. End Property
  2555.  
  2556. Private _Color6 As Color = Color.FromArgb(21, 21, 21)
  2557. Public Property Color6() As Color
  2558. Get
  2559. Return _Color6
  2560. End Get
  2561. Set(ByVal value As Color)
  2562. _Color6 = value
  2563. Invalidate()
  2564. End Set
  2565. End Property
  2566.  
  2567. Sub New()
  2568. SetStyle(DirectCast(139286, ControlStyles), True)
  2569. SetStyle(ControlStyles.Selectable, False)
  2570. DrawMode = Windows.Forms.DrawMode.OwnerDrawFixed
  2571. DropDownStyle = ComboBoxStyle.DropDownList
  2572. Font = New Font("Segoe UI", 10)
  2573. BackColor = Color.FromArgb(0, 0, 0)
  2574. End Sub
  2575. Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  2576. Dim G As Graphics = e.Graphics
  2577. G.Clear(BackColor)
  2578. G.FillRectangle(New SolidBrush(_Color1), New Rectangle(2, 2, Width, (Height / 2) - 2))
  2579. G.FillRectangle(New SolidBrush(_Color2), New Rectangle(2, (Height / 2), Width, (Height / 2) - 2.5))
  2580. G.DrawRectangle(New Pen(BackColor), New Rectangle(0, 0, Width - 1, Height - 1))
  2581. G.DrawRectangle(New Pen(_Color3), New Rectangle(1, 1, Width - 3, Height - 3))
  2582. G.FillPolygon(New SolidBrush(_Color4), {New Point(Width - 13, Height / 2 - 2), New Point(Width - 6, Height / 2 - 2), New Point(Width - 10, Height / 2 + 2)})
  2583. G.DrawString(Text, Font, New SolidBrush(_FontColor), New Point(5, 3))
  2584. End Sub
  2585. Protected Overrides Sub OnDrawItem(ByVal e As DrawItemEventArgs)
  2586. e.Graphics.TextRenderingHint = TextRenderingHint.ClearTypeGridFit
  2587. If (e.State And DrawItemState.Selected) = DrawItemState.Selected Then
  2588. e.Graphics.FillRectangle(New SolidBrush(_Color5), e.Bounds)
  2589. Else
  2590. e.Graphics.FillRectangle(New SolidBrush(_Color6), e.Bounds)
  2591. End If
  2592. If Not e.Index = -1 Then
  2593. e.Graphics.DrawString(GetItemText(Items(e.Index)), e.Font, New SolidBrush(_FontColor), e.Bounds)
  2594. End If
  2595. End Sub
  2596. End Class
  2597. Class FrostGroupBox
  2598. Inherits ThemeContainer154
  2599.  
  2600. Private _Color1 As Color = Color.FromArgb(21, 21, 21)
  2601. Public Property Color1() As Color
  2602. Get
  2603. Return _Color1
  2604. End Get
  2605. Set(ByVal value As Color)
  2606. _Color1 = value
  2607. Invalidate()
  2608. End Set
  2609. End Property
  2610.  
  2611. Private _Color2 As Color = Color.FromArgb(9, 9, 9)
  2612. Public Property Color2() As Color
  2613. Get
  2614. Return _Color2
  2615. End Get
  2616. Set(ByVal value As Color)
  2617. _Color2 = value
  2618. Invalidate()
  2619. End Set
  2620. End Property
  2621.  
  2622. Private _Color3 As Color = Color.FromArgb(27, 28, 32)
  2623. Public Property Color3() As Color
  2624. Get
  2625. Return _Color3
  2626. End Get
  2627. Set(ByVal value As Color)
  2628. _Color3 = value
  2629. Invalidate()
  2630. End Set
  2631. End Property
  2632.  
  2633. Private _Color4 As Color = Color.FromArgb(100, 100, 100)
  2634. Public Property Color4() As Color
  2635. Get
  2636. Return _Color4
  2637. End Get
  2638. Set(ByVal value As Color)
  2639. _Color4 = value
  2640. Invalidate()
  2641. End Set
  2642. End Property
  2643.  
  2644. Private _Color5 As Color = Color.FromArgb(0, 0, 0)
  2645. Public Property Color5() As Color
  2646. Get
  2647. Return _Color5
  2648. End Get
  2649. Set(ByVal value As Color)
  2650. _Color5 = value
  2651. Invalidate()
  2652. End Set
  2653. End Property
  2654.  
  2655. Private _FontColor As Color = Color.FromArgb(132, 112, 255)
  2656. Public Property FontColor() As Color
  2657. Get
  2658. Return _FontColor
  2659. End Get
  2660. Set(ByVal value As Color)
  2661. _FontColor = value
  2662. Invalidate()
  2663. End Set
  2664. End Property
  2665.  
  2666. Sub New()
  2667. ControlMode = True
  2668. BackColor = Color.FromArgb(0, 0, 0)
  2669. Font = New Font("Segoe UI", 10)
  2670. End Sub
  2671.  
  2672. Protected Overrides Sub ColorHook()
  2673.  
  2674. End Sub
  2675.  
  2676. Protected Overrides Sub PaintHook()
  2677. G.Clear(_Color1)
  2678.  
  2679. G.FillRectangle(New SolidBrush(_Color3), New Rectangle(0, 0, Width, 24))
  2680. G.FillRectangle(New SolidBrush(_Color2), New Rectangle(0, 14, Width, 10))
  2681.  
  2682. G.FillPolygon(New SolidBrush(_Color2), {New Point(0, 34), New Point(0, 24), New Point(10, 24)})
  2683. G.FillPolygon(New SolidBrush(_Color2), {New Point(Width, 34), New Point(Width, 24), New Point(Width - 10, 24)})
  2684.  
  2685. G.DrawRectangle(New Pen(_Color4), New Rectangle(0, 0, Width - 1, Height - 1))
  2686.  
  2687. G.FillPolygon(New SolidBrush(_Color5), {New Point(0, 8), New Point(0, 0), New Point(8, 0)})
  2688. G.FillPolygon(New SolidBrush(_Color5), {New Point(Width, 7), New Point(Width, 0), New Point(Width - 8, 0)})
  2689. G.FillPolygon(New SolidBrush(_Color5), {New Point(0, Height - 8), New Point(0, Height), New Point(8, Height)})
  2690. G.FillPolygon(New SolidBrush(_Color5), {New Point(Width, Height - 8), New Point(Width, Height), New Point(Width - 9, Height)})
  2691.  
  2692. G.DrawLine(New Pen(_Color4), New Point(0, 7), New Point(7, 0))
  2693. G.DrawLine(New Pen(_Color4), New Point(Width - 2, 6), New Point(Width - 8, 0))
  2694. G.DrawLine(New Pen(_Color4), New Point(0, Height - 8), New Point(8, Height))
  2695. G.DrawLine(New Pen(_Color4), New Point(Width - 1, Height - 8), New Point(Width - 8, Height - 1))
  2696.  
  2697. DrawText(New SolidBrush(_FontColor), HorizontalAlignment.Left, 10, 2)
  2698. End Sub
  2699. End Class
  2700. Class FrostMessageBox
  2701. Inherits System.Windows.Forms.Form
  2702. Private _Message As String = ""
  2703. Private _Title As String = ""
  2704. Property Title As String
  2705. Get
  2706. Return _Title
  2707. End Get
  2708. Set(ByVal value As String)
  2709. _Title = value
  2710. End Set
  2711. End Property
  2712. Property Message As String
  2713. Get
  2714. Return _Message
  2715. End Get
  2716. Set(ByVal value As String)
  2717. _Message = value
  2718. End Set
  2719. End Property
  2720.  
  2721. Public Sub Display()
  2722. Dim Theme As New FrostTheme
  2723. Dim Textbox As New FrostTextBox
  2724. Textbox.Text = _Message
  2725. Textbox.Multiline = True
  2726. Textbox.Location = New Point(23, 47)
  2727. Textbox.Size = New Point(350, 72)
  2728. Textbox.ReadOnly = True
  2729. Me.Text = _Title
  2730. Dim Button As New FrostButton
  2731. Button.Text = "Ok"
  2732. Button.Size = New Point(210, 24)
  2733. Button.Location = New Point(93, 128)
  2734. Me.Controls.AddRange({Theme, Textbox, Button})
  2735. AddHandler Button.Click, AddressOf quit
  2736. Theme.SendToBack()
  2737. Me.Size = New Point(396, 175)
  2738. Me.TransparencyKey = Color.Fuchsia
  2739. Me.Show()
  2740. End Sub
  2741. Private Sub quit()
  2742. Me.Close()
  2743. End Sub
  2744. End Class
  2745. Class FrostMinWindow
  2746. Inherits ThemeControl154
  2747.  
  2748. #Region "Color None"
  2749.  
  2750. Private _ColorNone1 As Color = Color.FromArgb(40, 40, 40)
  2751. Public Property ColorNone1() As Color
  2752. Get
  2753. Return _ColorNone1
  2754. End Get
  2755. Set(ByVal value As Color)
  2756. _ColorNone1 = value
  2757. Invalidate()
  2758. End Set
  2759. End Property
  2760.  
  2761. Private _ColorNone2 As Color = Color.FromArgb(35, 35, 35)
  2762. Public Property ColorNone2() As Color
  2763. Get
  2764. Return _ColorNone2
  2765. End Get
  2766. Set(ByVal value As Color)
  2767. _ColorNone2 = value
  2768. Invalidate()
  2769. End Set
  2770. End Property
  2771.  
  2772. Private _ColorNoneOutline As Color = Color.FromArgb(0, 0, 0)
  2773. Public Property ColorNoneOutline() As Color
  2774. Get
  2775. Return _ColorNoneOutline
  2776. End Get
  2777. Set(ByVal value As Color)
  2778. _ColorNoneOutline = value
  2779. Invalidate()
  2780. End Set
  2781. End Property
  2782.  
  2783. #End Region
  2784.  
  2785. #Region "Color Over"
  2786.  
  2787. Private _ColorOver1 As Color = Color.FromArgb(60, 60, 60)
  2788. Public Property ColorOver1() As Color
  2789. Get
  2790. Return _ColorOver1
  2791. End Get
  2792. Set(ByVal value As Color)
  2793. _ColorOver1 = value
  2794. Invalidate()
  2795. End Set
  2796. End Property
  2797.  
  2798. Private _ColorOver2 As Color = Color.FromArgb(55, 55, 55)
  2799. Public Property ColorOver2() As Color
  2800. Get
  2801. Return _ColorOver2
  2802. End Get
  2803. Set(ByVal value As Color)
  2804. _ColorOver2 = value
  2805. Invalidate()
  2806. End Set
  2807. End Property
  2808.  
  2809. Private _ColorOverOutline As Color = Color.FromArgb(0, 0, 0)
  2810. Public Property ColorOverOutline() As Color
  2811. Get
  2812. Return _ColorOverOutline
  2813. End Get
  2814. Set(ByVal value As Color)
  2815. _ColorOverOutline = value
  2816. Invalidate()
  2817. End Set
  2818. End Property
  2819.  
  2820. #End Region
  2821.  
  2822. Sub New()
  2823. Anchor = AnchorStyles.Top Or AnchorStyles.Right
  2824. End Sub
  2825. Protected Overrides Sub ColorHook()
  2826. End Sub
  2827.  
  2828. Protected Overrides Sub PaintHook()
  2829. G.Clear(Color.Transparent)
  2830. G.FillRectangle(New SolidBrush(Color.Transparent), New Rectangle(0, 0, Width, Height))
  2831. Me.Width = 30
  2832. Me.Height = 7
  2833. Me.MaximumSize = New Size(New Point(25, 7))
  2834. Select Case State
  2835. Case MouseState.None
  2836. G.FillRectangle(New SolidBrush(_ColorNone1), New Rectangle(0, 0, Width, Height / 2))
  2837. G.FillRectangle(New SolidBrush(_ColorNone1), New Rectangle(0, Height / 2, Width, Height / 2))
  2838. G.DrawRectangle(New Pen(_ColorNoneOutline), New Rectangle(0, 0, Width - 1, Height - 1))
  2839. Case MouseState.Over
  2840. G.FillRectangle(New SolidBrush(_ColorOver1), New Rectangle(0, 0, Width, Height / 2))
  2841. G.FillRectangle(New SolidBrush(_ColorOver2), New Rectangle(0, Height / 2, Width, Height / 2))
  2842. G.DrawRectangle(New Pen(_ColorOverOutline), New Rectangle(0, 0, Width - 1, Height - 1))
  2843. Case MouseState.Down
  2844. FindForm.WindowState = FormWindowState.Minimized
  2845. End Select
  2846. End Sub
  2847. End Class
  2848. Class FrostProgressBar
  2849. Inherits ThemeControl154
  2850. Private _Minimum As Integer
  2851. Property Minimum() As Integer
  2852. Get
  2853. Return _Minimum
  2854. End Get
  2855. Set(ByVal value As Integer)
  2856. If value < 0 Then
  2857. Throw New Exception("Property value is not valid.")
  2858. End If
  2859.  
  2860. _Minimum = value
  2861. If value > _Value Then _Value = value
  2862. If value > _Maximum Then _Maximum = value
  2863. Invalidate()
  2864. End Set
  2865. End Property
  2866.  
  2867. Private _Maximum As Integer = 100
  2868. Property Maximum() As Integer
  2869. Get
  2870. Return _Maximum
  2871. End Get
  2872. Set(ByVal value As Integer)
  2873. If value < 0 Then
  2874. Throw New Exception("Property value is not valid.")
  2875. End If
  2876.  
  2877. _Maximum = value
  2878. If value < _Value Then _Value = value
  2879. If value < _Minimum Then _Minimum = value
  2880. Invalidate()
  2881. End Set
  2882. End Property
  2883.  
  2884. Private _Value As Integer
  2885. Property Value() As Integer
  2886. Get
  2887. Return _Value
  2888. End Get
  2889. Set(ByVal value As Integer)
  2890. If value > _Maximum OrElse value < _Minimum Then
  2891. Throw New Exception("Property value is not valid.")
  2892. End If
  2893.  
  2894. _Value = value
  2895. Invalidate()
  2896. End Set
  2897. End Property
  2898.  
  2899. Public Sub Increment(ByVal amount As Integer)
  2900. If Value + amount > Maximum Then
  2901. Value = Maximum
  2902. Else
  2903. Value += amount
  2904. End If
  2905. End Sub
  2906.  
  2907. Private _FontColor As Color = Color.FromArgb(132, 112, 255)
  2908. Public Property FontColor() As Color
  2909. Get
  2910. Return _FontColor
  2911. End Get
  2912. Set(ByVal value As Color)
  2913. _FontColor = value
  2914. Invalidate()
  2915. End Set
  2916. End Property
  2917.  
  2918. Private _Color1 As Color = Color.FromArgb(0, 0, 0)
  2919. Public Property Color1() As Color
  2920. Get
  2921. Return _Color1
  2922. End Get
  2923. Set(ByVal value As Color)
  2924. _Color1 = value
  2925. Invalidate()
  2926. End Set
  2927. End Property
  2928.  
  2929. Private _Color2 As Color = Color.FromArgb(70, 70, 70)
  2930. Public Property Color2() As Color
  2931. Get
  2932. Return _Color2
  2933. End Get
  2934. Set(ByVal value As Color)
  2935. _Color2 = value
  2936. Invalidate()
  2937. End Set
  2938. End Property
  2939.  
  2940. Private _Color3 As Color = Color.FromArgb(40, 40, 40)
  2941. Public Property Color3() As Color
  2942. Get
  2943. Return _Color3
  2944. End Get
  2945. Set(ByVal value As Color)
  2946. _Color3 = value
  2947. Invalidate()
  2948. End Set
  2949. End Property
  2950.  
  2951. Private _Color4 As Color = Color.FromArgb(21, 21, 21)
  2952. Public Property Color4() As Color
  2953. Get
  2954. Return _Color4
  2955. End Get
  2956. Set(ByVal value As Color)
  2957. _Color4 = value
  2958. Invalidate()
  2959. End Set
  2960. End Property
  2961.  
  2962. Private _Color5 As Color = Color.FromArgb(27, 28, 32)
  2963. Public Property Color5() As Color
  2964. Get
  2965. Return _Color5
  2966. End Get
  2967. Set(ByVal value As Color)
  2968. _Color5 = value
  2969. Invalidate()
  2970. End Set
  2971. End Property
  2972.  
  2973. Private _Color6 As Color = Color.FromArgb(9, 9, 9)
  2974. Public Property Color6() As Color
  2975. Get
  2976. Return _Color6
  2977. End Get
  2978. Set(ByVal value As Color)
  2979. _Color6 = value
  2980. Invalidate()
  2981. End Set
  2982. End Property
  2983.  
  2984. Sub New()
  2985. BackColor = Color.FromArgb(30, 30, 30)
  2986. Font = New Font("Segoe UI", 10)
  2987. End Sub
  2988.  
  2989. Protected Overrides Sub ColorHook()
  2990. End Sub
  2991.  
  2992. Protected Overrides Sub PaintHook()
  2993. Dim HB As New HatchBrush(HatchStyle.LightUpwardDiagonal, _Color3, _Color4)
  2994.  
  2995. G.Clear(BackColor)
  2996. G.DrawRectangle(New Pen(_Color1), New Rectangle(0, 0, Width - 1, Height - 1))
  2997. G.DrawRectangle(New Pen(_Color2), New Rectangle(1, 1, Width - 3, Height - 3))
  2998. G.FillRectangle(HB, New Rectangle(2, 2, Width - 4, Height - 4))
  2999. G.FillRectangle(New SolidBrush(_Color5), New Rectangle(2, 2, Int((_Value - _Minimum) / (_Maximum - _Minimum) * (Width - 4)), (Height / 2) - 2))
  3000. G.FillRectangle(New SolidBrush(_Color6), New Rectangle(2, (Height / 2), CInt((_Value - _Minimum) / (_Maximum - _Minimum) * (Width - 4)), (Height / 2) - 2.5))
  3001. G.DrawString(_Value.ToString + "%", Font, New SolidBrush(_FontColor), (Width / 2) - (_Value.ToString + "%").Length * 5, 3)
  3002. End Sub
  3003. End Class
  3004. <DefaultEvent("CheckedChanged")> _
  3005. Class FrostRadioButton
  3006. Inherits ThemeControl154
  3007.  
  3008. Private _FontColor As Color = Color.FromArgb(132, 112, 255)
  3009. Public Property FontColor() As Color
  3010. Get
  3011. Return _FontColor
  3012. End Get
  3013. Set(ByVal value As Color)
  3014. _FontColor = value
  3015. Invalidate()
  3016. End Set
  3017. End Property
  3018.  
  3019. Private _Color1 As Color = Color.FromArgb(70, 70, 70)
  3020. Public Property Color1() As Color
  3021. Get
  3022. Return _Color1
  3023. End Get
  3024. Set(ByVal value As Color)
  3025. _Color1 = value
  3026. Invalidate()
  3027. End Set
  3028. End Property
  3029.  
  3030. Private _Color2 As Color = Color.FromArgb(132, 112, 255)
  3031. Public Property Color2() As Color
  3032. Get
  3033. Return _Color2
  3034. End Get
  3035. Set(ByVal value As Color)
  3036. _Color2 = value
  3037. Invalidate()
  3038. End Set
  3039. End Property
  3040.  
  3041. Private _Color3 As Color = Color.FromArgb(122, 102, 245)
  3042. Public Property Color3() As Color
  3043. Get
  3044. Return _Color3
  3045. End Get
  3046. Set(ByVal value As Color)
  3047. _Color3 = value
  3048. Invalidate()
  3049. End Set
  3050. End Property
  3051.  
  3052. Private _Color4 As Color = Color.FromArgb(30, 30, 30)
  3053. Public Property Color4() As Color
  3054. Get
  3055. Return _Color4
  3056. End Get
  3057. Set(ByVal value As Color)
  3058. _Color4 = value
  3059. Invalidate()
  3060. End Set
  3061. End Property
  3062.  
  3063. Private _Color5 As Color = Color.FromArgb(25, 25, 25)
  3064. Public Property Color5() As Color
  3065. Get
  3066. Return _Color5
  3067. End Get
  3068. Set(ByVal value As Color)
  3069. _Color5 = value
  3070. Invalidate()
  3071. End Set
  3072. End Property
  3073.  
  3074. Event CheckedChanged(ByVal sender As Object)
  3075.  
  3076. Sub New()
  3077. SetStyle(DirectCast(139286, ControlStyles), True)
  3078. SetStyle(ControlStyles.Selectable, False)
  3079.  
  3080. BackColor = Color.FromArgb(21, 21, 21)
  3081. Font = New Font("Segoe UI", 10)
  3082. End Sub
  3083.  
  3084. Private _Checked As Boolean
  3085. Public Property Checked() As Boolean
  3086. Get
  3087. Return _Checked
  3088. End Get
  3089. Set(ByVal value As Boolean)
  3090. _Checked = value
  3091.  
  3092. If _Checked Then
  3093. InvalidateParent()
  3094. End If
  3095.  
  3096. RaiseEvent CheckedChanged(Me)
  3097. Invalidate()
  3098. End Set
  3099. End Property
  3100.  
  3101. Private Sub InvalidateParent()
  3102. If Parent Is Nothing Then Return
  3103.  
  3104. For Each C As Control In Parent.Controls
  3105. If Not (C Is Me) AndAlso (TypeOf C Is FrostRadioButton) Then
  3106. DirectCast(C, FrostRadioButton).Checked = False
  3107. End If
  3108. Next
  3109. End Sub
  3110.  
  3111.  
  3112. Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  3113. Checked = True
  3114. MyBase.OnMouseDown(e)
  3115. End Sub
  3116.  
  3117. Dim TextBrush As Brush
  3118. Protected Overrides Sub ColorHook()
  3119. End Sub
  3120.  
  3121. Protected Overrides Sub PaintHook()
  3122. SetStyle(ControlStyles.SupportsTransparentBackColor, True)
  3123. G.Clear(BackColor)
  3124. G.DrawRectangle(New Pen(_Color1), New Rectangle(1, 1, Height - 3, Height - 3))
  3125. If _Checked Then
  3126. G.FillRectangle(New SolidBrush(_Color2), New Rectangle(3, 3, Height - 6, Height / 2))
  3127. G.FillRectangle(New SolidBrush(_Color3), New Rectangle(3, Height / 2, Height - 6, Height / 2 - 4))
  3128. Else
  3129. G.FillRectangle(New SolidBrush(_Color4), New Rectangle(3, 3, Height - 6, Height / 2))
  3130. G.FillRectangle(New SolidBrush(_Color5), New Rectangle(3, Height / 2, Height - 6, Height / 2 - 4))
  3131. End If
  3132. DrawText(New SolidBrush(_FontColor), Height + 5, Height / 2 - Me.Font.SizeInPoints)
  3133. End Sub
  3134. End Class
  3135. Class FrostTabControl
  3136. Inherits TabControl
  3137. Dim G As Graphics
  3138.  
  3139. Private _FontColor As Color = Color.FromArgb(132, 112, 255)
  3140. Public Property FontColor() As Color
  3141. Get
  3142. Return _FontColor
  3143. End Get
  3144. Set(ByVal value As Color)
  3145. _FontColor = value
  3146. Invalidate()
  3147. End Set
  3148. End Property
  3149.  
  3150. Private _Color1 As Color = Color.FromArgb(21, 21, 21)
  3151. Public Property Color1() As Color
  3152. Get
  3153. Return _Color1
  3154. End Get
  3155. Set(ByVal value As Color)
  3156. _Color1 = value
  3157. Invalidate()
  3158. End Set
  3159. End Property
  3160.  
  3161. Private _Color2 As Color = Color.FromArgb(100, 100, 100)
  3162. Public Property Color2() As Color
  3163. Get
  3164. Return _Color2
  3165. End Get
  3166. Set(ByVal value As Color)
  3167. _Color2 = value
  3168. Invalidate()
  3169. End Set
  3170. End Property
  3171.  
  3172. Private _Color3 As Color = Color.FromArgb(0, 0, 0)
  3173. Public Property Color3() As Color
  3174. Get
  3175. Return _Color3
  3176. End Get
  3177. Set(ByVal value As Color)
  3178. _Color3 = value
  3179. Invalidate()
  3180. End Set
  3181. End Property
  3182.  
  3183. Sub New()
  3184. SetStyle(DirectCast(139286, ControlStyles), True)
  3185. SetStyle(ControlStyles.Selectable, False)
  3186.  
  3187. SizeMode = TabSizeMode.Fixed
  3188. Alignment = TabAlignment.Left
  3189. ItemSize = New Size(28, 115)
  3190. BackColor = _Color1
  3191. DrawMode = TabDrawMode.OwnerDrawFixed
  3192.  
  3193. Font = New Font("Segoe UI", 10)
  3194.  
  3195. SF1 = New StringFormat()
  3196. SF1.LineAlignment = StringAlignment.Center
  3197. End Sub
  3198.  
  3199. Protected Overrides Sub OnControlAdded(ByVal e As ControlEventArgs)
  3200. If TypeOf e.Control Is TabPage Then
  3201. e.Control.BackColor = _Color1
  3202. End If
  3203.  
  3204. MyBase.OnControlAdded(e)
  3205. End Sub
  3206.  
  3207. Private R1, R2 As Rectangle
  3208. Private TP1 As TabPage
  3209. Private SF1 As StringFormat
  3210. Private Offset, ItemHeight As Integer
  3211.  
  3212. Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  3213. G = e.Graphics
  3214.  
  3215. G.Clear(_Color1)
  3216.  
  3217. G.DrawLine(New Pen(_Color2), New Point(118, 0), New Point(118, Height))
  3218. For I As Integer = 0 To TabCount - 1
  3219. R1 = GetTabRect(I)
  3220. R1.Y += 2
  3221. R1.Height -= 3
  3222. R1.Width += 1
  3223. R1.X -= 1
  3224.  
  3225. TP1 = TabPages(I)
  3226. Offset = 0
  3227.  
  3228. If SelectedIndex = I Then
  3229. G.DrawLine(New Pen(_Color2), New Point(1, R1.Y), New Point(118, R1.Y))
  3230. G.DrawLine(New Pen(_Color2), New Point(1, R1.Y + R1.Height), New Point(118, R1.Y + R1.Height))
  3231. G.DrawLine(New Pen(_Color1), New Point(R1.X + R1.Width + 1, R1.Y + 1), New Point(R1.X + R1.Width + 1, R1.Y + R1.Height - 1))
  3232. End If
  3233. Offset += 10
  3234. R1.X += 5 + Offset
  3235.  
  3236. R2 = R1
  3237. R2.Y += 1
  3238. R2.X += 1
  3239.  
  3240. G.DrawString(TP1.Text, Font, New SolidBrush(_FontColor), R1, SF1)
  3241. Next
  3242.  
  3243. G.DrawRectangle(New Pen(_Color2), New Rectangle(0, 0, Width - 1, Height - 1))
  3244.  
  3245. G.FillPolygon(New SolidBrush(_Color3), {New Point(0, 8), New Point(0, 0), New Point(8, 0)})
  3246. G.FillPolygon(New SolidBrush(_Color3), {New Point(Width, 7), New Point(Width, 0), New Point(Width - 8, 0)})
  3247. G.FillPolygon(New SolidBrush(_Color3), {New Point(0, Height - 8), New Point(0, Height), New Point(8, Height)})
  3248. G.FillPolygon(New SolidBrush(_Color3), {New Point(Width, Height - 8), New Point(Width, Height), New Point(Width - 9, Height)})
  3249.  
  3250. G.DrawLine(New Pen(_Color2), New Point(0, 7), New Point(7, 0))
  3251. G.DrawLine(New Pen(_Color2), New Point(Width - 2, 6), New Point(Width - 8, 0))
  3252. G.DrawLine(New Pen(_Color2), New Point(0, Height - 8), New Point(8, Height))
  3253. G.DrawLine(New Pen(_Color2), New Point(Width - 1, Height - 8), New Point(Width - 8, Height - 1))
  3254.  
  3255. End Sub
  3256.  
  3257. End Class
  3258. <DefaultEvent("TextChanged")> _
  3259. Class FrostTextBox
  3260. Inherits ThemeControl154
  3261.  
  3262. Private _TextAlign As HorizontalAlignment = HorizontalAlignment.Left
  3263. Property TextAlign() As HorizontalAlignment
  3264. Get
  3265. Return _TextAlign
  3266. End Get
  3267. Set(ByVal value As HorizontalAlignment)
  3268. _TextAlign = value
  3269. If Base IsNot Nothing Then
  3270. Base.TextAlign = value
  3271. End If
  3272. End Set
  3273. End Property
  3274.  
  3275. Private _MaxLength As Integer = 32767
  3276. Property MaxLength() As Integer
  3277. Get
  3278. Return _MaxLength
  3279. End Get
  3280. Set(ByVal value As Integer)
  3281. _MaxLength = value
  3282. If Base IsNot Nothing Then
  3283. Base.MaxLength = value
  3284. End If
  3285. End Set
  3286. End Property
  3287.  
  3288. Private _ReadOnly As Boolean
  3289. Property [ReadOnly]() As Boolean
  3290. Get
  3291. Return _ReadOnly
  3292. End Get
  3293. Set(ByVal value As Boolean)
  3294. _ReadOnly = value
  3295. If Base IsNot Nothing Then
  3296. Base.ReadOnly = value
  3297. End If
  3298. End Set
  3299. End Property
  3300.  
  3301. Private _UseSystemPasswordChar As Boolean
  3302. Property UseSystemPasswordChar() As Boolean
  3303. Get
  3304. Return _UseSystemPasswordChar
  3305. End Get
  3306. Set(ByVal value As Boolean)
  3307. _UseSystemPasswordChar = value
  3308. If Base IsNot Nothing Then
  3309. Base.UseSystemPasswordChar = value
  3310. End If
  3311. End Set
  3312. End Property
  3313.  
  3314. Private _Multiline As Boolean
  3315. Property Multiline() As Boolean
  3316. Get
  3317. Return _Multiline
  3318. End Get
  3319. Set(ByVal value As Boolean)
  3320. _Multiline = value
  3321. If Base IsNot Nothing Then
  3322. Base.Multiline = value
  3323.  
  3324. If value Then
  3325. LockHeight = 0
  3326. Base.Height = Height - 11
  3327. Else
  3328. LockHeight = Base.Height + 11
  3329. End If
  3330. End If
  3331. End Set
  3332. End Property
  3333.  
  3334. Overrides Property Text As String
  3335. Get
  3336. Return MyBase.Text
  3337. End Get
  3338. Set(ByVal value As String)
  3339. MyBase.Text = value
  3340. If Base IsNot Nothing Then
  3341. Base.Text = value
  3342. End If
  3343. End Set
  3344. End Property
  3345.  
  3346. Overrides Property Font As Font
  3347. Get
  3348. Return MyBase.Font
  3349. End Get
  3350. Set(ByVal value As Font)
  3351. MyBase.Font = value
  3352. If Base IsNot Nothing Then
  3353. Base.Font = value
  3354. Base.Location = New Point(3, 5)
  3355. Base.Width = Width - 6
  3356.  
  3357. If Not _Multiline Then
  3358. LockHeight = Base.Height + 11
  3359. End If
  3360. End If
  3361. End Set
  3362. End Property
  3363.  
  3364. Protected Overrides Sub OnCreation()
  3365. If Not Controls.Contains(Base) Then
  3366. Controls.Add(Base)
  3367. End If
  3368. End Sub
  3369.  
  3370. Private _Color1 As Color = Color.FromArgb(0, 0, 0)
  3371. Public Property Color1() As Color
  3372. Get
  3373. Return _Color1
  3374. End Get
  3375. Set(ByVal value As Color)
  3376. _Color1 = value
  3377. Invalidate()
  3378. End Set
  3379. End Property
  3380.  
  3381. Private _Color2 As Color = Color.FromArgb(70, 70, 70)
  3382. Public Property Color2() As Color
  3383. Get
  3384. Return _Color2
  3385. End Get
  3386. Set(ByVal value As Color)
  3387. _Color2 = value
  3388. Invalidate()
  3389. End Set
  3390. End Property
  3391.  
  3392. Private _FontColor As Color = Color.FromArgb(132, 112, 255)
  3393. Public Property FontColor() As Color
  3394. Get
  3395. Return _FontColor
  3396. End Get
  3397. Set(ByVal value As Color)
  3398. _FontColor = value
  3399. Base.ForeColor = _FontColor
  3400. Invalidate()
  3401. End Set
  3402. End Property
  3403.  
  3404. Private Base As TextBox
  3405. Sub New()
  3406. Base = New TextBox
  3407. Font = New Font("Segoe UI", 10)
  3408. Base.Font = New Font("Segoe UI", 10)
  3409. Base.Text = Text
  3410. Base.MaxLength = _MaxLength
  3411. Base.Multiline = _Multiline
  3412. Base.ReadOnly = _ReadOnly
  3413. Base.UseSystemPasswordChar = _UseSystemPasswordChar
  3414. Base.BorderStyle = BorderStyle.None
  3415. Base.Location = New Point(5, 5)
  3416. Base.Width = Width - 10
  3417. BackColor = Color.FromArgb(35, 35, 35)
  3418. If _Multiline Then
  3419. Base.Height = Height - 11
  3420. Else
  3421. LockHeight = Base.Height + 11
  3422. End If
  3423. AddHandler Base.TextChanged, AddressOf OnBaseTextChanged
  3424. AddHandler Base.KeyDown, AddressOf OnBaseKeyDown
  3425. End Sub
  3426.  
  3427. Protected Overrides Sub ColorHook()
  3428. Base.ForeColor = _FontColor
  3429. Base.BackColor = BackColor
  3430. End Sub
  3431.  
  3432. Protected Overrides Sub PaintHook()
  3433. G.Clear(Base.BackColor)
  3434. G.DrawRectangle(New Pen(_Color1), New Rectangle(0, 0, Width - 1, Height - 1))
  3435. G.DrawRectangle(New Pen(_Color2), New Rectangle(1, 1, Width - 3, Height - 3))
  3436.  
  3437. End Sub
  3438. Private Sub OnBaseTextChanged(ByVal s As Object, ByVal e As EventArgs)
  3439. Text = Base.Text
  3440. End Sub
  3441. Private Sub OnBaseKeyDown(ByVal s As Object, ByVal e As KeyEventArgs)
  3442. If e.Control AndAlso e.KeyCode = Keys.A Then
  3443. Base.SelectAll()
  3444. e.SuppressKeyPress = True
  3445. End If
  3446. End Sub
  3447. Protected Overrides Sub OnResize(ByVal e As EventArgs)
  3448. Base.Location = New Point(5, 5)
  3449. Base.Width = Width - 10
  3450.  
  3451. If _Multiline Then
  3452. Base.Height = Height - 11
  3453. End If
  3454.  
  3455.  
  3456. MyBase.OnResize(e)
  3457. End Sub
  3458.  
  3459. End Class
  3460. Class FrostTheme
  3461. Inherits ThemeContainer154
  3462.  
  3463. Private _Color1 As Color = Color.FromArgb(21, 21, 21)
  3464. Public Property Color1() As Color
  3465. Get
  3466. Return _Color1
  3467. End Get
  3468. Set(ByVal value As Color)
  3469. _Color1 = value
  3470. Invalidate()
  3471. End Set
  3472. End Property
  3473.  
  3474. Private _Color2 As Color = Color.FromArgb(35, 35, 35)
  3475. Public Property Color2() As Color
  3476. Get
  3477. Return _Color2
  3478. End Get
  3479. Set(ByVal value As Color)
  3480. _Color2 = value
  3481. Invalidate()
  3482. End Set
  3483. End Property
  3484.  
  3485. Private _Color3 As Color = Color.FromArgb(9, 9, 9)
  3486. Public Property Color3() As Color
  3487. Get
  3488. Return _Color3
  3489. End Get
  3490. Set(ByVal value As Color)
  3491. _Color3 = value
  3492. Invalidate()
  3493. End Set
  3494. End Property
  3495.  
  3496. Private _Color4 As Color = Color.FromArgb(27, 28, 32)
  3497. Public Property Color4() As Color
  3498. Get
  3499. Return _Color4
  3500. End Get
  3501. Set(ByVal value As Color)
  3502. _Color4 = value
  3503. Invalidate()
  3504. End Set
  3505. End Property
  3506.  
  3507. Private _Color5 As Color = Color.FromArgb(42, 42, 42)
  3508. Public Property Color5() As Color
  3509. Get
  3510. Return _Color5
  3511. End Get
  3512. Set(ByVal value As Color)
  3513. _Color5 = value
  3514. Invalidate()
  3515. End Set
  3516. End Property
  3517.  
  3518. Private _Color6 As Color = Color.FromArgb(132, 112, 255)
  3519. Public Property Color6() As Color
  3520. Get
  3521. Return _Color6
  3522. End Get
  3523. Set(ByVal value As Color)
  3524. _Color6 = value
  3525. Invalidate()
  3526. End Set
  3527. End Property
  3528.  
  3529. Sub New()
  3530. BackColor = Color.Black
  3531. TransparencyKey = Color.Fuchsia
  3532. Font = New Font("Segoe UI", 10)
  3533. End Sub
  3534. Protected Overrides Sub ColorHook()
  3535. End Sub
  3536. Protected Overrides Sub PaintHook()
  3537. G.Clear(TransparencyKey)
  3538. G.FillRectangle(New SolidBrush(_Color6), New Rectangle(20, 4, Width - 40, Height - 8))
  3539. G.FillRectangle(New SolidBrush(_Color6), New Rectangle(4, 20, Width - 8, Height - 40))
  3540. G.FillRectangle(New SolidBrush(_Color1), New Rectangle(10, 10, Width - 20, Height - 20))
  3541. G.FillRectangle(New SolidBrush(_Color2), New Rectangle(10, 15, Width - 20, Height - 30))
  3542. G.FillRectangle(New SolidBrush(_Color2), New Rectangle(15, 10, Width - 30, Height - 20))
  3543. G.FillRectangle(New SolidBrush(BackColor), New Rectangle(15, 10, Width - 30, Height - 24))
  3544.  
  3545. 'corners
  3546. G.FillPolygon(New SolidBrush(_Color1), {New Point(20, 0), New Point(Width / 3, 0), New Point((Width / 3) + 10, 10), New Point(10, 10)})
  3547. G.FillPolygon(New SolidBrush(_Color2), {New Point(20, 5), New Point(Width / 3, 5), New Point((Width / 3) + 10, 10), New Point(10, 15)})
  3548. G.FillPolygon(New SolidBrush(_Color1), {New Point(0, 20), New Point(0, Height / 3), New Point(10, (Height / 3) + 10), New Point(10, 10)})
  3549. G.FillPolygon(New SolidBrush(_Color2), {New Point(5, 20), New Point(5, Height / 3), New Point(10, (Height / 3) + 10), New Point(10, 15)})
  3550.  
  3551. G.FillPolygon(New SolidBrush(_Color1), {New Point(Width - 20, 0), New Point(Width - (Width / 3), 0), New Point(Width - ((Width / 3) + 10), 10), New Point(Width - 10, 10)})
  3552. G.FillPolygon(New SolidBrush(_Color2), {New Point(Width - 20, 5), New Point(Width - (Width / 3), 5), New Point(Width - ((Width / 3) + 10), 10), New Point(Width - 10, 15)})
  3553. G.FillPolygon(New SolidBrush(_Color1), {New Point(Width, 20), New Point(Width, (Height / 3)), New Point(Width - 10, ((Height / 3) + 10)), New Point(Width - 10, 10)})
  3554. G.FillPolygon(New SolidBrush(_Color2), {New Point(Width - 5, 20), New Point(Width - 5, (Height / 3)), New Point(Width - 10, ((Height / 3) + 10)), New Point(Width - 10, 15)})
  3555.  
  3556. G.FillPolygon(New SolidBrush(_Color1), {New Point(Width - 20, Height), New Point(Width - (Width / 3), Height), New Point(Width - ((Width / 3) + 10), Height - 10), New Point(Width - 10, Height - 10)})
  3557. G.FillPolygon(New SolidBrush(_Color2), {New Point(Width - 20, Height - 5), New Point(Width - (Width / 3), Height - 5), New Point(Width - ((Width / 3) + 10), Height - 10), New Point(Width - 10, Height - 15)})
  3558. G.FillPolygon(New SolidBrush(_Color1), {New Point(Width, Height - 20), New Point(Width, Height - (Height / 3)), New Point(Width - 10, Height - ((Height / 3) + 10)), New Point(Width - 10, Height - 10)})
  3559. G.FillPolygon(New SolidBrush(_Color2), {New Point(Width - 5, Height - 20), New Point(Width - 5, Height - (Height / 3)), New Point(Width - 10, Height - ((Height / 3) + 10)), New Point(Width - 10, Height - 15)})
  3560.  
  3561. G.FillPolygon(New SolidBrush(_Color1), {New Point(20, Height), New Point(Width / 3, Height), New Point((Width / 3) + 10, Height - 10), New Point(10, Height - 10)})
  3562. G.FillPolygon(New SolidBrush(_Color2), {New Point(20, Height - 5), New Point(Width / 3, Height - 5), New Point((Width / 3) + 10, Height - 10), New Point(10, Height - 15)})
  3563. G.FillPolygon(New SolidBrush(_Color1), {New Point(0, Height - 20), New Point(0, Height - (Height / 3)), New Point(10, Height - ((Height / 3) + 10)), New Point(10, Height - 10)})
  3564. G.FillPolygon(New SolidBrush(_Color2), {New Point(5, Height - 20), New Point(5, Height - (Height / 3)), New Point(10, Height - ((Height / 3) + 10)), New Point(10, Height - 15)})
  3565.  
  3566. 'outer lines
  3567.  
  3568. G.DrawLine(New Pen(_Color1), New Point((Width / 3) + 9, 9), New Point(Width - ((Width / 3) + 9), 9))
  3569. G.DrawLine(New Pen(_Color1), New Point(9, (Height / 3) + 9), New Point(9, Height - ((Height / 3) + 9)))
  3570. G.DrawLine(New Pen(_Color1), New Point((Width / 3) + 9, Height - 10), New Point(Width - ((Width / 3) + 10), Height - 10))
  3571. G.DrawLine(New Pen(_Color1), New Point(Width - 10, (Height / 3) + 9), New Point(Width - 10, Height - ((Height / 3) + 9)))
  3572.  
  3573. G.FillRectangle(New SolidBrush(_Color2), New Rectangle(10, 36, Width - 20, 2))
  3574. G.DrawLine(New Pen(_Color5), New Point(10, 36), New Point(Width - 11, 36))
  3575.  
  3576. 'inner corners
  3577. G.DrawLine(New Pen(_Color2), New Point(15, 38), New Point(18, 38))
  3578. G.DrawLine(New Pen(_Color2), New Point(15, 39), New Point(16, 39))
  3579. G.DrawLine(New Pen(_Color2), New Point(15, 40), New Point(15, 41))
  3580.  
  3581. G.DrawLine(New Pen(_Color2), New Point(Width - 15, 38), New Point(Width - 18, 38))
  3582. G.DrawLine(New Pen(_Color2), New Point(Width - 15, 39), New Point(Width - 16, 39))
  3583. G.DrawLine(New Pen(_Color2), New Point(Width - 15, 40), New Point(Width - 15, 41))
  3584.  
  3585. G.DrawLine(New Pen(_Color2), New Point(10, Height - 15), New Point(18, Height - 15))
  3586. G.DrawLine(New Pen(_Color2), New Point(15, Height - 16), New Point(16, Height - 16))
  3587. G.DrawLine(New Pen(_Color2), New Point(15, Height - 17), New Point(15, Height - 18))
  3588.  
  3589. G.DrawLine(New Pen(_Color2), New Point(Width - 11, Height - 15), New Point(Width - 19, Height - 15))
  3590. G.DrawLine(New Pen(_Color2), New Point(Width - 16, Height - 16), New Point(Width - 17, Height - 16))
  3591. G.DrawLine(New Pen(_Color2), New Point(Width - 16, Height - 17), New Point(Width - 16, Height - 18))
  3592.  
  3593. G.FillRectangle(New SolidBrush(_Color4), New Rectangle(14, 11, Width - 29, 13))
  3594. G.FillRectangle(New SolidBrush(_Color3), New Rectangle(14, 24, Width - 29, 12))
  3595. G.DrawRectangle(New Pen(_Color5), New Rectangle(14, 11, Width - 29, 25))
  3596.  
  3597.  
  3598. G.DrawString(FindForm.Text, Font, New SolidBrush(_Color6), New Point(17, 13))
  3599. End Sub
  3600. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement