Astekk

Greywash VB theme

Dec 29th, 2014
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 39.92 KB | None | 0 0
  1. Imports System.Drawing
  2. Imports System.Drawing.Drawing2D
  3. Imports System.ComponentModel
  4. Imports System.Drawing.Text
  5.  
  6. #Region "Properties"
  7.  
  8. #Region " Mouse States"
  9.  
  10. Enum MouseState As Byte
  11. None = 0
  12. Over = 1
  13. Down = 2
  14. Block = 3
  15. End Enum
  16.  
  17. #End Region
  18.  
  19. #End Region
  20.  
  21. Module DrawHelpers
  22.  
  23. #Region "Functions"
  24.  
  25. Dim Height As Integer
  26. Dim Width As Integer
  27.  
  28. Public Function RoundRec(ByVal Rectangle As Rectangle, ByVal Curve As Integer) As GraphicsPath
  29. Dim P As GraphicsPath = New GraphicsPath()
  30. Dim ArcRectangleWidth As Integer = Curve * 2
  31. P.AddArc(New Rectangle(Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -180, 90)
  32. P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -90, 90)
  33. P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 0, 90)
  34. P.AddArc(New Rectangle(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 90, 90)
  35. P.AddLine(New Point(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y), New Point(Rectangle.X, Curve + Rectangle.Y))
  36. Return P
  37. End Function
  38.  
  39. Public Function RoundRect(ByVal x!, ByVal y!, ByVal w!, ByVal h!, Optional ByVal r! = 0.3, Optional ByVal TL As Boolean = True, Optional ByVal TR As Boolean = True, Optional ByVal BR As Boolean = True, Optional ByVal BL As Boolean = True) As GraphicsPath
  40. Dim d! = Math.Min(w, h) * r, xw = x + w, yh = y + h
  41. RoundRect = New GraphicsPath
  42.  
  43. With RoundRect
  44. If TL Then .AddArc(x, y, d, d, 180, 90) Else .AddLine(x, y, x, y)
  45. If TR Then .AddArc(xw - d, y, d, d, 270, 90) Else .AddLine(xw, y, xw, y)
  46. If BR Then .AddArc(xw - d, yh - d, d, d, 0, 90) Else .AddLine(xw, yh, xw, yh)
  47. If BL Then .AddArc(x, yh - d, d, d, 90, 90) Else .AddLine(x, yh, x, yh)
  48.  
  49. .CloseFigure()
  50. End With
  51. End Function
  52.  
  53. #End Region
  54.  
  55. End Module
  56.  
  57. 'Controls
  58.  
  59. Class GreywashClose
  60. Inherits Control
  61.  
  62. #Region " Declarations "
  63. Private State As MouseState = MouseState.None
  64. #End Region
  65.  
  66. #Region " MouseStates "
  67.  
  68. Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
  69. MyBase.OnMouseEnter(e)
  70. State = MouseState.Over : Invalidate()
  71. End Sub
  72.  
  73. Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  74. MyBase.OnMouseDown(e)
  75. State = MouseState.Down : Invalidate()
  76. End Sub
  77.  
  78. Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
  79. MyBase.OnMouseLeave(e)
  80. State = MouseState.None : Invalidate()
  81. End Sub
  82.  
  83. Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  84. MyBase.OnMouseUp(e)
  85. State = MouseState.Over : Invalidate()
  86. End Sub
  87.  
  88. Protected Overrides Sub OnMouseMove(ByVal e As MouseEventArgs)
  89. MyBase.OnMouseMove(e)
  90. End Sub
  91.  
  92. Protected Overrides Sub OnClick(ByVal e As EventArgs)
  93. MyBase.OnClick(e)
  94. Environment.Exit(0)
  95. End Sub
  96.  
  97. #End Region
  98.  
  99. #Region " Properties "
  100.  
  101. Protected Overrides Sub OnResize(ByVal e As EventArgs)
  102. MyBase.OnResize(e)
  103. Size = New Size(16, 16)
  104. End Sub
  105.  
  106. #End Region
  107.  
  108. Sub New()
  109. SetStyle(ControlStyles.SupportsTransparentBackColor, True)
  110. SetStyle(ControlStyles.Opaque, True)
  111. Anchor = AnchorStyles.Top Or AnchorStyles.Right
  112. End Sub
  113.  
  114. Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  115. Dim G = e.Graphics
  116. G.Clear(Color.LightGray)
  117. G.SmoothingMode = SmoothingMode.HighQuality
  118. G.FillEllipse(New SolidBrush(Color.FromArgb(100, Color.Red)), New Rectangle(2, 2, 11, 11))
  119.  
  120. Select Case State
  121. Case MouseState.Over
  122. G.FillEllipse(New SolidBrush(Color.FromArgb(80, Color.White)), New Rectangle(2, 2, 11, 11))
  123. Case MouseState.Down
  124. G.FillEllipse(New SolidBrush(Color.FromArgb(80, Color.Black)), New Rectangle(2, 2, 11, 11))
  125. End Select
  126.  
  127. MyBase.OnPaint(e)
  128. G.Dispose()
  129. End Sub
  130.  
  131. End Class
  132.  
  133. Class GreywashMax
  134. Inherits Control
  135.  
  136. #Region " Declarations "
  137. Private State As MouseState = MouseState.None
  138. #End Region
  139.  
  140. #Region " MouseStates"
  141.  
  142. Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
  143. MyBase.OnMouseEnter(e)
  144. State = MouseState.Over : Invalidate()
  145. End Sub
  146.  
  147. Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  148. MyBase.OnMouseDown(e)
  149. State = MouseState.Down : Invalidate()
  150. End Sub
  151.  
  152. Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
  153. MyBase.OnMouseLeave(e)
  154. State = MouseState.None : Invalidate()
  155. End Sub
  156.  
  157. Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  158. MyBase.OnMouseUp(e)
  159. State = MouseState.Over : Invalidate()
  160. End Sub
  161.  
  162. Protected Overrides Sub OnMouseMove(ByVal e As MouseEventArgs)
  163. MyBase.OnMouseMove(e)
  164. End Sub
  165.  
  166. Protected Overrides Sub OnClick(ByVal e As EventArgs)
  167. MyBase.OnClick(e)
  168. Select Case FindForm.WindowState
  169. Case FormWindowState.Maximized
  170. FindForm.WindowState = FormWindowState.Normal
  171. Case FormWindowState.Normal
  172. FindForm.WindowState = FormWindowState.Maximized
  173. End Select
  174. End Sub
  175.  
  176. #End Region
  177.  
  178. #Region " Properties "
  179.  
  180. Protected Overrides Sub OnResize(ByVal e As EventArgs)
  181. MyBase.OnResize(e)
  182. Size = New Size(16, 16)
  183. End Sub
  184.  
  185. #End Region
  186.  
  187. Sub New()
  188. SetStyle(ControlStyles.SupportsTransparentBackColor, True)
  189. SetStyle(ControlStyles.Opaque, True)
  190. Anchor = AnchorStyles.Top Or AnchorStyles.Right
  191. End Sub
  192.  
  193. Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  194. Dim G = e.Graphics
  195. G.Clear(Color.LightGray)
  196. G.SmoothingMode = SmoothingMode.HighQuality
  197. G.FillEllipse(New SolidBrush(Color.DarkGray), New Rectangle(2, 2, 11, 11))
  198.  
  199. Select Case State
  200. Case MouseState.Over
  201. G.FillEllipse(New SolidBrush(Color.FromArgb(80, Color.White)), New Rectangle(2, 2, 11, 11))
  202. Case MouseState.Down
  203. G.FillEllipse(New SolidBrush(Color.FromArgb(80, Color.Black)), New Rectangle(2, 2, 11, 11))
  204. End Select
  205.  
  206. MyBase.OnPaint(e)
  207. G.Dispose()
  208. End Sub
  209. End Class
  210.  
  211. Class GreywashMini
  212. Inherits Control
  213.  
  214. #Region " Declarations "
  215. Private State As MouseState = MouseState.None
  216. #End Region
  217.  
  218. #Region " MouseStates"
  219.  
  220. Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
  221. MyBase.OnMouseEnter(e)
  222. State = MouseState.Over : Invalidate()
  223. End Sub
  224.  
  225. Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  226. MyBase.OnMouseDown(e)
  227. State = MouseState.Down : Invalidate()
  228. End Sub
  229.  
  230. Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
  231. MyBase.OnMouseLeave(e)
  232. State = MouseState.None : Invalidate()
  233. End Sub
  234.  
  235. Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  236. MyBase.OnMouseUp(e)
  237. State = MouseState.Over : Invalidate()
  238. End Sub
  239.  
  240. Protected Overrides Sub OnMouseMove(ByVal e As MouseEventArgs)
  241. MyBase.OnMouseMove(e)
  242. End Sub
  243.  
  244. Protected Overrides Sub OnClick(ByVal e As EventArgs)
  245. MyBase.OnClick(e)
  246. Select Case FindForm.WindowState
  247. Case FormWindowState.Normal
  248. FindForm.WindowState = FormWindowState.Minimized
  249. Case FormWindowState.Maximized
  250. FindForm.WindowState = FormWindowState.Minimized
  251. End Select
  252. End Sub
  253.  
  254. #End Region
  255.  
  256. #Region " Properties "
  257.  
  258. Protected Overrides Sub OnResize(ByVal e As EventArgs)
  259. MyBase.OnResize(e)
  260. Size = New Size(16, 16)
  261. End Sub
  262.  
  263. #End Region
  264.  
  265. Sub New()
  266. SetStyle(ControlStyles.SupportsTransparentBackColor, True)
  267. SetStyle(ControlStyles.Opaque, True)
  268. Anchor = AnchorStyles.Top Or AnchorStyles.Right
  269. End Sub
  270.  
  271. Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  272. Dim G = e.Graphics
  273. G.Clear(Color.LightGray)
  274. G.SmoothingMode = SmoothingMode.HighQuality
  275. G.FillEllipse(New SolidBrush(Color.DarkGray), New Rectangle(2, 2, 11, 11))
  276.  
  277. Select Case State
  278. Case MouseState.Over
  279. G.FillEllipse(New SolidBrush(Color.FromArgb(80, Color.White)), New Rectangle(2, 2, 11, 11))
  280. Case MouseState.Down
  281. G.FillEllipse(New SolidBrush(Color.FromArgb(80, Color.Black)), New Rectangle(2, 2, 11, 11))
  282. End Select
  283.  
  284. MyBase.OnPaint(e)
  285. G.Dispose()
  286. End Sub
  287. End Class
  288.  
  289. 'Theme
  290.  
  291. Class GreywashTheme
  292. Inherits ContainerControl
  293.  
  294. #Region " Declarations "
  295. Public Shared _Header As Integer = 38
  296. Public Shared _SubHeader As Integer = 35
  297. Private _Down As Boolean = False
  298. Private _MousePoint As Point
  299. #End Region
  300.  
  301. #Region " MouseStates "
  302.  
  303. Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  304. MyBase.OnMouseUp(e)
  305. _Down = False
  306. End Sub
  307.  
  308. Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  309. MyBase.OnMouseDown(e)
  310. If e.Location.Y < _Header AndAlso e.Button = Windows.Forms.MouseButtons.Left Then
  311. _Down = True
  312. _MousePoint = e.Location
  313. End If
  314. End Sub
  315.  
  316. Protected Overrides Sub OnMouseMove(ByVal e As MouseEventArgs)
  317. MyBase.OnMouseMove(e)
  318. If _Down = True Then
  319. ParentForm.Location = MousePosition - _MousePoint
  320. End If
  321. End Sub
  322.  
  323. #End Region
  324.  
  325. #Region " Properties "
  326.  
  327. Private _Center As Boolean = True
  328. Public Property _TitleCenter() As Boolean
  329. Get
  330. Return _Center
  331. End Get
  332. Set(ByVal value As Boolean)
  333. _Center = value
  334. End Set
  335. End Property
  336.  
  337. Public Property _HeaderSize() As Integer
  338. Get
  339. Return _Header
  340. End Get
  341. Set(ByVal value As Integer)
  342. _Header = value
  343. End Set
  344. End Property
  345.  
  346. Private _SubHeaderVisable As Boolean = False
  347. Public Property _SubHeaderShow() As Boolean
  348. Get
  349. Return _SubHeaderVisable
  350. End Get
  351. Set(ByVal value As Boolean)
  352. _SubHeaderVisable = value
  353. End Set
  354. End Property
  355.  
  356. Public Property _SubHeaderSize() As Integer
  357. Get
  358. Return _SubHeader
  359. End Get
  360. Set(ByVal value As Integer)
  361. _SubHeader = value
  362. End Set
  363. End Property
  364.  
  365. #End Region
  366.  
  367. Protected Overrides Sub OnCreateControl()
  368. MyBase.OnCreateControl()
  369. ParentForm.FormBorderStyle = FormBorderStyle.None
  370. ParentForm.TransparencyKey = Color.Fuchsia
  371. Dock = DockStyle.Fill
  372. Invalidate()
  373. End Sub
  374.  
  375. Sub New()
  376. BackColor = Color.LightGray
  377. End Sub
  378.  
  379. Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  380. MyBase.OnPaint(e)
  381. Dim G = e.Graphics
  382. G.Clear(Color.LightGray)
  383. G.FillRectangle(New SolidBrush(Color.White), New Rectangle(0, _Header, Width, Height - _Header))
  384. G.DrawRectangle(New Pen(Brushes.LightGray), New Rectangle(0, 0, Width - 1, Height - 1))
  385. G.FillRectangle(Brushes.Fuchsia, New Rectangle(0, 0, 1, 1))
  386. G.FillRectangle(Brushes.Fuchsia, New Rectangle(1, 0, 1, 1))
  387. G.FillRectangle(Brushes.Fuchsia, New Rectangle(0, 1, 1, 1))
  388. G.FillRectangle(Brushes.Fuchsia, New Rectangle(Width - 1, 0, 1, 1))
  389. G.FillRectangle(Brushes.Fuchsia, New Rectangle(Width - 2, 0, 1, 1))
  390. G.FillRectangle(Brushes.Fuchsia, New Rectangle(Width - 1, 1, 1, 1))
  391. Dim _StringF As New StringFormat
  392. If _Center = True Then
  393. _StringF.Alignment = StringAlignment.Center
  394. _StringF.LineAlignment = StringAlignment.Center
  395. G.DrawString(Text, New Font("Segoe UI", 12), Brushes.White, New RectangleF(0, 0, Width, _Header), _StringF)
  396. Else
  397. _StringF.Alignment = StringAlignment.Near
  398. _StringF.LineAlignment = StringAlignment.Center
  399. G.DrawString(Text, New Font("Segoe UI", 12), Brushes.White, New RectangleF(0, 0, Width, _Header), _StringF)
  400. End If
  401.  
  402. If _SubHeaderVisable = True Then
  403. G.FillRectangle(New SolidBrush(Color.LightGray), New Rectangle(0, _Header, Width, _SubHeader))
  404. Else
  405.  
  406. End If
  407.  
  408. End Sub
  409.  
  410. End Class
  411.  
  412. Class GreywashGroupBox
  413. Inherits ContainerControl
  414.  
  415. Sub New()
  416. Size = New Size(200, 100)
  417. BackColor = Color.White
  418. End Sub
  419.  
  420. Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  421. MyBase.OnPaint(e)
  422. Dim G = e.Graphics
  423. G.Clear(BackColor)
  424. G.DrawRectangle(New Pen(Color.LightGray), New Rectangle(0, 0, Width - 1, Height - 1))
  425. G.FillRectangle(New SolidBrush(Color.DarkGray), New Rectangle(0, 0, Width, 30))
  426. Dim _StringF As New StringFormat
  427. _StringF.Alignment = StringAlignment.Center
  428. _StringF.LineAlignment = StringAlignment.Center
  429. G.DrawString(Text, New Font("Segoe UI", 10), Brushes.White, New RectangleF(0, 0, Width, 30), _StringF)
  430. End Sub
  431.  
  432. End Class
  433.  
  434. <DefaultEvent("TextChanged")>
  435. Class GreywashTextBox
  436. Inherits Control
  437.  
  438. #Region " Declarations "
  439. Private WithEvents _TextBox As Windows.Forms.TextBox
  440. #End Region
  441.  
  442. #Region " Properties "
  443.  
  444. Private _TextAlign As HorizontalAlignment = HorizontalAlignment.Left
  445. <Category("Options")> _
  446. Property TextAlign() As HorizontalAlignment
  447. Get
  448. Return _TextAlign
  449. End Get
  450. Set(ByVal value As HorizontalAlignment)
  451. _TextAlign = value
  452. If _TextBox IsNot Nothing Then
  453. _TextBox.TextAlign = value
  454. End If
  455. End Set
  456. End Property
  457. Private _MaxLength As Integer = 32767
  458. <Category("Options")> _
  459. Property MaxLength() As Integer
  460. Get
  461. Return _MaxLength
  462. End Get
  463. Set(ByVal value As Integer)
  464. _MaxLength = value
  465. If _TextBox IsNot Nothing Then
  466. _TextBox.MaxLength = value
  467. End If
  468. End Set
  469. End Property
  470. Private _ReadOnly As Boolean
  471. <Category("Options")> _
  472. Property [ReadOnly]() As Boolean
  473. Get
  474. Return _ReadOnly
  475. End Get
  476. Set(ByVal value As Boolean)
  477. _ReadOnly = value
  478. If _TextBox IsNot Nothing Then
  479. _TextBox.ReadOnly = value
  480. End If
  481. End Set
  482. End Property
  483. Private _UseSystemPasswordChar As Boolean
  484. <Category("Options")> _
  485. Property UseSystemPasswordChar() As Boolean
  486. Get
  487. Return _UseSystemPasswordChar
  488. End Get
  489. Set(ByVal value As Boolean)
  490. _UseSystemPasswordChar = value
  491. If _TextBox IsNot Nothing Then
  492. _TextBox.UseSystemPasswordChar = value
  493. End If
  494. End Set
  495. End Property
  496. Private _Multiline As Boolean
  497. <Category("Options")> _
  498. Property Multiline() As Boolean
  499. Get
  500. Return _Multiline
  501. End Get
  502. Set(ByVal value As Boolean)
  503. _Multiline = value
  504. If _TextBox IsNot Nothing Then
  505. _TextBox.Multiline = value
  506.  
  507. If value Then
  508. _TextBox.Height = Height - 11
  509. Else
  510. Height = _TextBox.Height + 11
  511. End If
  512.  
  513. End If
  514. End Set
  515. End Property
  516. <Category("Options")> _
  517. Overrides Property Text As String
  518. Get
  519. Return MyBase.Text
  520. End Get
  521. Set(ByVal value As String)
  522. MyBase.Text = value
  523. If _TextBox IsNot Nothing Then
  524. _TextBox.Text = value
  525. End If
  526. End Set
  527. End Property
  528. <Category("Options")> _
  529. Overrides Property Font As Font
  530. Get
  531. Return MyBase.Font
  532. End Get
  533. Set(ByVal value As Font)
  534. MyBase.Font = value
  535. If _TextBox IsNot Nothing Then
  536. _TextBox.Font = value
  537. _TextBox.Location = New Point(3, 5)
  538. _TextBox.Width = Width - 6
  539.  
  540. If Not _Multiline Then
  541. Height = _TextBox.Height + 11
  542. End If
  543. End If
  544. End Set
  545. End Property
  546.  
  547. Protected Overrides Sub OnCreateControl()
  548. MyBase.OnCreateControl()
  549. If Not Controls.Contains(_TextBox) Then
  550. Controls.Add(_TextBox)
  551. End If
  552. End Sub
  553. Private Sub OnBaseTextChanged(ByVal s As Object, ByVal e As EventArgs)
  554. Text = _TextBox.Text
  555. End Sub
  556. Private Sub OnBaseKeyDown(ByVal s As Object, ByVal e As KeyEventArgs)
  557. If e.Control AndAlso e.KeyCode = Keys.A Then
  558. _TextBox.SelectAll()
  559. e.SuppressKeyPress = True
  560. End If
  561. If e.Control AndAlso e.KeyCode = Keys.C Then
  562. _TextBox.Copy()
  563. e.SuppressKeyPress = True
  564. End If
  565. End Sub
  566. Protected Overrides Sub OnResize(ByVal e As EventArgs)
  567. _TextBox.Location = New Point(5, 5)
  568. _TextBox.Width = Width - 10
  569.  
  570. If _Multiline Then
  571. _TextBox.Height = Height - 11
  572. Else
  573. Height = _TextBox.Height + 11
  574. End If
  575. MyBase.OnResize(e)
  576. End Sub
  577.  
  578. #End Region
  579.  
  580. Sub New()
  581. SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or _
  582. ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer Or _
  583. ControlStyles.SupportsTransparentBackColor, True)
  584. DoubleBuffered = True
  585.  
  586. BackColor = Color.Transparent
  587.  
  588. _TextBox = New Windows.Forms.TextBox
  589. _TextBox.Font = New Font("Segoe UI", 10)
  590. _TextBox.Text = Text
  591. _TextBox.BackColor = Color.White
  592. _TextBox.ForeColor = Color.Gray
  593. _TextBox.MaxLength = _MaxLength
  594. _TextBox.Multiline = _Multiline
  595. _TextBox.ReadOnly = _ReadOnly
  596. _TextBox.UseSystemPasswordChar = _UseSystemPasswordChar
  597. _TextBox.BorderStyle = BorderStyle.None
  598. _TextBox.Location = New Point(5, 5)
  599. _TextBox.Width = Width - 10
  600.  
  601. _TextBox.Cursor = Cursors.IBeam
  602.  
  603. If _Multiline Then
  604. _TextBox.Height = Height - 11
  605. Else
  606. Height = _TextBox.Height + 11
  607. End If
  608.  
  609. AddHandler _TextBox.TextChanged, AddressOf OnBaseTextChanged
  610. AddHandler _TextBox.KeyDown, AddressOf OnBaseKeyDown
  611. End Sub
  612.  
  613. Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  614. MyBase.OnPaint(e)
  615. Dim G = e.Graphics
  616. Dim GP, GP1 As New GraphicsPath
  617. Dim Base As New Rectangle(0, 0, Width - 1, Height - 1)
  618. Dim BorderBase As New Rectangle(0, 0, Width - 1, Height - 1)
  619. GP = DrawHelpers.RoundRec(Base, 1)
  620. GP1 = DrawHelpers.RoundRec(BorderBase, 1)
  621. G.FillPath(New SolidBrush(Color.White), GP)
  622. G.DrawPath(New Pen(Color.LightGray), GP1)
  623. End Sub
  624.  
  625. End Class
  626.  
  627. Public Class GreywashButton
  628. Inherits Control
  629.  
  630. #Region " Declarations "
  631. Private State As MouseState = MouseState.None
  632. Private _MainColour As Color = Color.DarkGray
  633. Private _TextColour As Color = Color.White
  634. Private _HoverColour As Color = Color.LightGray
  635. #End Region
  636.  
  637. #Region " MouseStates "
  638.  
  639. Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  640. MyBase.OnMouseDown(e)
  641. State = MouseState.Down : Invalidate()
  642. End Sub
  643.  
  644. Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  645. MyBase.OnMouseUp(e)
  646. State = MouseState.Over : Invalidate()
  647. End Sub
  648.  
  649. Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
  650. MyBase.OnMouseEnter(e)
  651. State = MouseState.Over : Invalidate()
  652. End Sub
  653.  
  654. Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
  655. MyBase.OnMouseLeave(e)
  656. State = MouseState.None : Invalidate()
  657. End Sub
  658.  
  659. #End Region
  660.  
  661. #Region " Properties "
  662.  
  663. <Category("Colours"), Description("Background Colour Selection")> _
  664. Public Property BackgroundColour As Color
  665. Get
  666. Return _MainColour
  667. End Get
  668. Set(ByVal value As Color)
  669. _MainColour = value
  670. End Set
  671. End Property
  672.  
  673. <Category("Colours"), Description("Text Colour Selection")> _
  674. Public Property TextColour As Color
  675. Get
  676. Return _TextColour
  677. End Get
  678. Set(ByVal value As Color)
  679. _TextColour = value
  680. End Set
  681. End Property
  682.  
  683. #End Region
  684.  
  685. Sub New()
  686. SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or _
  687. ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer Or _
  688. ControlStyles.SupportsTransparentBackColor, True)
  689. DoubleBuffered = True
  690. Size = New Size(135, 29)
  691. BackColor = Color.Transparent
  692. Font = New Font("Segoe UI", 10)
  693. End Sub
  694.  
  695. Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  696. Dim B As New Bitmap(Width, Height)
  697. Dim G = Graphics.FromImage(B)
  698. Dim GP, GP1 As New GraphicsPath
  699. Dim Base As New Rectangle(0, 0, Width - 1, Height - 1)
  700. With G
  701. .TextRenderingHint = TextRenderingHint.ClearTypeGridFit
  702. .SmoothingMode = SmoothingMode.HighQuality
  703. .PixelOffsetMode = PixelOffsetMode.HighQuality
  704. .Clear(BackColor)
  705. Select Case State
  706. Case MouseState.None
  707. GP = DrawHelpers.RoundRec(Base, 1)
  708. .FillPath(New SolidBrush(_MainColour), GP)
  709. .DrawString(Text, Font, New SolidBrush(_TextColour), Base, New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
  710. Case MouseState.Over
  711. GP = DrawHelpers.RoundRec(Base, 1)
  712. .FillPath(New SolidBrush(_HoverColour), GP)
  713. .DrawString(Text, Font, New SolidBrush(_TextColour), Base, New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
  714. Case MouseState.Down
  715. GP = DrawHelpers.RoundRec(Base, 1)
  716. .FillPath(New SolidBrush(_HoverColour), GP)
  717. .DrawString(Text, Font, New SolidBrush(_TextColour), Base, New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
  718. GP1 = DrawHelpers.RoundRec(New Rectangle(0, 0, Width, Height), 3)
  719. '.DrawPath(New Pen(New SolidBrush(Color.Gray), 2), GP1)
  720. End Select
  721. End With
  722. MyBase.OnPaint(e)
  723. e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic
  724. e.Graphics.DrawImageUnscaled(B, 0, 0)
  725. B.Dispose()
  726. End Sub
  727.  
  728. End Class
  729.  
  730. Class GreywashProgressBar
  731. Inherits Control
  732.  
  733. #Region " Properties "
  734.  
  735. Private _Maximum As Integer
  736. Public Property Maximum As Integer
  737. Get
  738. Return _Maximum
  739. End Get
  740. Set(ByVal value As Integer)
  741. _Maximum = value
  742. Invalidate()
  743. End Set
  744. End Property
  745.  
  746. Private _Minimum As Integer
  747. Public Property Minimum As Integer
  748. Get
  749. Return _Minimum
  750. End Get
  751. Set(ByVal value As Integer)
  752. _Minimum = value
  753. Invalidate()
  754. End Set
  755. End Property
  756.  
  757. Private _Value As Integer
  758. Public Property Value As Integer
  759. Get
  760. Return _Value
  761. End Get
  762. Set(ByVal value As Integer)
  763. _Value = value
  764. Invalidate()
  765. End Set
  766. End Property
  767.  
  768. #End Region
  769.  
  770. Sub New()
  771. Maximum = 100
  772. Minimum = 0
  773. Value = 0
  774. End Sub
  775.  
  776. Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  777. MyBase.OnPaint(e)
  778. Dim G = e.Graphics
  779. G.DrawRectangle(New Pen(Color.DarkGray), New Rectangle(0, 0, Width - 1, Height - 1))
  780. G.FillRectangle(New SolidBrush(Color.DarkGray), New Rectangle(0, 0, Width - 1, Height - 1))
  781. Select Case _Value
  782. Case Is > 2
  783. G.FillRectangle(New SolidBrush(Color.LightGray), New Rectangle(0, 0, CInt(Value / Maximum * Width), Height))
  784. G.FillRectangle(New SolidBrush(Color.FromArgb(100, Color.Red)), New Rectangle(0, 0, CInt(Value / Maximum * Width), Height))
  785. Case Is > 0
  786. G.FillRectangle(New SolidBrush(Color.LightGray), New Rectangle(0, 0, CInt(Value / Maximum * Width), Height))
  787. G.FillRectangle(New SolidBrush(Color.FromArgb(100, Color.Red)), New Rectangle(0, 0, CInt(Value / Maximum * Width), Height))
  788. End Select
  789. End Sub
  790.  
  791. End Class
  792.  
  793. Public Class GreywashComboBox
  794. Inherits ComboBox
  795.  
  796. #Region " Declarations "
  797. Private _StartIndex As Integer = 0
  798. Private _BorderColour As Color = Color.LightGray
  799. Private _BaseColour As Color = Color.White
  800. Private _FontColour As Color = Color.Gray
  801. Private _LineColour As Color = Color.White
  802. Private _SqaureColour As Color = Color.DarkGray
  803. Private _SqaureHoverColour As Color = Color.LightGray
  804. Private State As MouseState = MouseState.None
  805. #End Region
  806.  
  807. #Region " Properties "
  808.  
  809. <Category("Colours")>
  810. Public Property LineColour As Color
  811. Get
  812. Return _LineColour
  813. End Get
  814. Set(ByVal value As Color)
  815. _LineColour = value
  816. End Set
  817. End Property
  818.  
  819. <Category("Colours")>
  820. Public Property SqaureColour As Color
  821. Get
  822. Return _SqaureColour
  823. End Get
  824. Set(ByVal value As Color)
  825. _SqaureColour = value
  826. End Set
  827. End Property
  828.  
  829. <Category("Colours")>
  830. Public Property SqaureHoverColour As Color
  831. Get
  832. Return _SqaureHoverColour
  833. End Get
  834. Set(ByVal value As Color)
  835. _SqaureHoverColour = value
  836. End Set
  837. End Property
  838.  
  839. Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
  840. MyBase.OnMouseEnter(e)
  841. State = MouseState.Over : Invalidate()
  842. End Sub
  843.  
  844. Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
  845. MyBase.OnMouseLeave(e)
  846. State = MouseState.None : Invalidate()
  847. End Sub
  848.  
  849. <Category("Colours")>
  850. Public Property BorderColour As Color
  851. Get
  852. Return _BorderColour
  853. End Get
  854. Set(ByVal value As Color)
  855. _BorderColour = value
  856. End Set
  857. End Property
  858.  
  859. <Category("Colours")>
  860. Public Property BaseColour As Color
  861. Get
  862. Return _BaseColour
  863. End Get
  864. Set(ByVal value As Color)
  865. _BaseColour = value
  866. End Set
  867. End Property
  868.  
  869. <Category("Colours")>
  870. Public Property FontColour As Color
  871. Get
  872. Return _FontColour
  873. End Get
  874. Set(ByVal value As Color)
  875. _FontColour = value
  876. End Set
  877. End Property
  878.  
  879. Public Property StartIndex As Integer
  880. Get
  881. Return _StartIndex
  882. End Get
  883. Set(ByVal value As Integer)
  884. _StartIndex = value
  885. Try
  886. MyBase.SelectedIndex = value
  887. Catch
  888. End Try
  889. Invalidate()
  890. End Set
  891. End Property
  892.  
  893. Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
  894. MyBase.OnTextChanged(e)
  895. Invalidate()
  896. End Sub
  897.  
  898. Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  899. Invalidate()
  900. OnMouseClick(e)
  901. End Sub
  902.  
  903. Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
  904. Invalidate()
  905. MyBase.OnMouseUp(e)
  906. End Sub
  907.  
  908. #End Region
  909.  
  910. Sub ReplaceItem(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles Me.DrawItem
  911. e.DrawBackground()
  912. Dim Rect As New Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height)
  913. Try
  914. With e.Graphics
  915. If (e.State And DrawItemState.Selected) = DrawItemState.Selected Then
  916. .FillRectangle(New SolidBrush(_SqaureColour), Rect)
  917. .DrawString(MyBase.GetItemText(MyBase.Items(e.Index)), Font, New SolidBrush(_FontColour), 1, e.Bounds.Top + 2)
  918. Else
  919. .FillRectangle(New SolidBrush(_BaseColour), Rect)
  920. .DrawString(MyBase.GetItemText(MyBase.Items(e.Index)), Font, New SolidBrush(_FontColour), 1, e.Bounds.Top + 2)
  921. End If
  922. End With
  923. Catch
  924. End Try
  925. e.DrawFocusRectangle()
  926. Invalidate()
  927.  
  928. End Sub
  929.  
  930. Sub New()
  931. SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or _
  932. ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer Or _
  933. ControlStyles.SupportsTransparentBackColor, True)
  934. DoubleBuffered = True
  935. BackColor = Color.Transparent
  936. DrawMode = Windows.Forms.DrawMode.OwnerDrawFixed
  937. DropDownStyle = ComboBoxStyle.DropDownList
  938. Width = 163
  939. Font = New Font("Segoe UI", 10)
  940. End Sub
  941.  
  942. Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  943. Dim B As New Bitmap(Width, Height)
  944. Dim G = Graphics.FromImage(B)
  945. With G
  946. .Clear(BackColor)
  947. Try
  948. Dim Square As New Rectangle(Width - 25, 0, Width, Height)
  949. .FillRectangle(New SolidBrush(_BaseColour), New Rectangle(0, 0, Width - 25, Height))
  950. .DrawLine(New Pen(_LineColour), New Point(Width - 26, 1), New Point(Width - 26, Height))
  951. Try
  952. .DrawString(Text, Font, New SolidBrush(_FontColour), New Rectangle(3, 0, Width - 20, Height), New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Near})
  953. Catch : End Try
  954. .DrawRectangle(New Pen(_BorderColour, 2), New Rectangle(0, 0, Width, Height))
  955. Select Case State
  956. Case MouseState.None
  957. .FillRectangle(New SolidBrush(_SqaureColour), Square)
  958. Case MouseState.Over
  959. .FillRectangle(New SolidBrush(_SqaureHoverColour), Square)
  960. End Select
  961. Catch
  962. End Try
  963. End With
  964. MyBase.OnPaint(e)
  965. G.Dispose()
  966. e.Graphics.InterpolationMode = 7
  967. e.Graphics.DrawImageUnscaled(B, 0, 0)
  968. B.Dispose()
  969. End Sub
  970.  
  971. End Class
  972.  
  973. Class GreywashTabControl
  974. Inherits Windows.Forms.TabControl
  975.  
  976. #Region " Declarations "
  977. Dim LightColor As Color = Color.DarkGray
  978. Dim DarkColor As Color = Color.LightGray
  979. Dim LightBrush As New SolidBrush(LightColor)
  980. Dim DarkBrush As New SolidBrush(DarkColor)
  981. Dim NotSelectedColor As New SolidBrush(Color.LightGray)
  982. Dim SelectedColor As New SolidBrush(Color.DarkGray)
  983. #End Region
  984.  
  985. Sub New()
  986. SetStyle(ControlStyles.UserPaint Or ControlStyles.Opaque Or ControlStyles.ResizeRedraw Or ControlStyles.AllPaintingInWmPaint Or ControlStyles.Opaque, True)
  987. SetStyle(ControlStyles.Selectable, False)
  988. Dock = DockStyle.None
  989. SizeMode = TabSizeMode.Fixed
  990. Alignment = TabAlignment.Left
  991. ItemSize = New Size(25, 120)
  992. DrawMode = TabDrawMode.OwnerDrawFixed
  993. Font = New Font("Segoe UI", 10)
  994. End Sub
  995.  
  996. Protected Overrides Sub CreateHandle()
  997. MyBase.CreateHandle()
  998. Alignment = TabAlignment.Left
  999. End Sub
  1000.  
  1001. Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  1002. Dim bm As New Bitmap(Width, Height)
  1003. Dim g As Graphics = Graphics.FromImage(bm)
  1004. g.Clear(DarkColor)
  1005.  
  1006. For i = 0 To TabCount - 1
  1007. Dim TabRectangle As Rectangle = GetTabRect(i)
  1008. If i = SelectedIndex Then
  1009. g.FillRectangle(LightBrush, TabRectangle)
  1010. g.FillRectangle(SelectedColor, New Rectangle(TabRectangle.Location.X + 2, TabRectangle.Location.Y + 2, 3, TabRectangle.Height - 4))
  1011. Else
  1012. g.FillRectangle(DarkBrush, TabRectangle)
  1013. g.FillRectangle(NotSelectedColor, New Rectangle(TabRectangle.Location.X + 2, TabRectangle.Location.Y + 2, 3, TabRectangle.Height - 4))
  1014. End If
  1015. g.DrawString(TabPages(i).Text, Font, Brushes.White, TabRectangle, New StringFormat With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  1016. Next
  1017.  
  1018. e.Graphics.DrawImage(bm.Clone, 0, 0)
  1019. g.Dispose() : bm.Dispose()
  1020. MyBase.OnPaint(e)
  1021. End Sub
  1022.  
  1023. End Class
  1024.  
  1025. <DefaultEvent("CheckedChanged")>
  1026. Class GreywashCheckBox
  1027. Inherits Control
  1028.  
  1029. #Region " Declarations "
  1030. Private _Checked As Boolean
  1031. #End Region
  1032.  
  1033. #Region " Properties "
  1034. Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
  1035. MyBase.OnTextChanged(e)
  1036. Invalidate()
  1037. End Sub
  1038.  
  1039. Property Checked() As Boolean
  1040. Get
  1041. Return _Checked
  1042. End Get
  1043. Set(ByVal value As Boolean)
  1044. _Checked = value
  1045. Invalidate()
  1046. End Set
  1047. End Property
  1048.  
  1049. Event CheckedChanged(ByVal sender As Object)
  1050. Protected Overrides Sub OnClick(ByVal e As System.EventArgs)
  1051. If Not _Checked Then
  1052. Checked = True
  1053. Else
  1054. Checked = False
  1055. End If
  1056. RaiseEvent CheckedChanged(Me)
  1057. MyBase.OnClick(e)
  1058. End Sub
  1059.  
  1060. Protected Overrides Sub OnResize(ByVal e As EventArgs)
  1061. MyBase.OnResize(e)
  1062. Height = 16
  1063. End Sub
  1064.  
  1065. #End Region
  1066.  
  1067. Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  1068. MyBase.OnPaint(e)
  1069. Dim G = e.Graphics
  1070.  
  1071. If Parent.BackColor = Color.LightGray Then
  1072. G.Clear(BackColor)
  1073. G.FillRectangle(New SolidBrush(Color.DarkGray), New Rectangle(0, 0, 15, 15))
  1074. G.DrawString(Text, New Font("Segoe UI", 10), Brushes.White, New Point(18, -2))
  1075. Else
  1076. G.Clear(Color.White)
  1077. G.FillRectangle(New SolidBrush(Color.DarkGray), New Rectangle(0, 0, 15, 15))
  1078. G.DrawString(Text, New Font("Segoe UI", 10), Brushes.Gray, New Point(18, -2))
  1079. End If
  1080. If Checked Then
  1081. G.FillRectangle(New SolidBrush(Color.LightGray), New Rectangle(4, 4, 7, 7))
  1082. G.FillRectangle(New SolidBrush(Color.FromArgb(100, Color.Red)), New Rectangle(4, 4, 7, 7))
  1083. End If
  1084.  
  1085. End Sub
  1086. End Class
  1087.  
  1088. Class GreywashListBox
  1089. Inherits Control
  1090.  
  1091. #Region " Declarations "
  1092. Private WithEvents ListB As New ListBox
  1093. Private _Items As String() = {""}
  1094. Private _BaseColour As Color = Color.White
  1095. Private _SelectedColour As Color = Color.DarkGray
  1096. Private _ListBaseColour As Color = Color.White
  1097. Private _TextColour As Color = Color.Gray
  1098. Private _BorderColour As Color = Color.LightGray
  1099. #End Region
  1100.  
  1101. #Region " Properties "
  1102.  
  1103. <Category("Control")> _
  1104. Public Property Items As String()
  1105. Get
  1106. Return _Items
  1107. End Get
  1108. Set(ByVal value As String())
  1109. _Items = value
  1110. ListB.Items.Clear()
  1111. ListB.Items.AddRange(value)
  1112. Invalidate()
  1113. End Set
  1114. End Property
  1115.  
  1116. <Category("Colours")> _
  1117. Public Property BorderColour As Color
  1118. Get
  1119. Return _BorderColour
  1120. End Get
  1121. Set(ByVal value As Color)
  1122. _BorderColour = value
  1123. End Set
  1124. End Property
  1125.  
  1126. <Category("Colours")> _
  1127. Public Property SelectedColour As Color
  1128. Get
  1129. Return _SelectedColour
  1130. End Get
  1131. Set(ByVal value As Color)
  1132. _SelectedColour = value
  1133. End Set
  1134. End Property
  1135.  
  1136. <Category("Colours")> _
  1137. Public Property BaseColour As Color
  1138. Get
  1139. Return _BaseColour
  1140. End Get
  1141. Set(ByVal value As Color)
  1142. _BaseColour = value
  1143. End Set
  1144. End Property
  1145.  
  1146. <Category("Colours")> _
  1147. Public Property ListBaseColour As Color
  1148. Get
  1149. Return _ListBaseColour
  1150. End Get
  1151. Set(ByVal value As Color)
  1152. _ListBaseColour = value
  1153. End Set
  1154. End Property
  1155.  
  1156. <Category("Colours")> _
  1157. Public Property TextColour As Color
  1158. Get
  1159. Return _TextColour
  1160. End Get
  1161. Set(ByVal value As Color)
  1162. _TextColour = value
  1163. End Set
  1164. End Property
  1165.  
  1166. Public ReadOnly Property SelectedItem() As String
  1167. Get
  1168. Return ListB.SelectedItem
  1169. End Get
  1170. End Property
  1171.  
  1172. Public ReadOnly Property SelectedIndex() As Integer
  1173. Get
  1174. Return ListB.SelectedIndex
  1175. If ListB.SelectedIndex < 0 Then Exit Property
  1176. End Get
  1177. End Property
  1178.  
  1179. Public Sub Clear()
  1180. ListB.Items.Clear()
  1181. End Sub
  1182.  
  1183. Public Sub ClearSelected()
  1184. For i As Integer = (ListB.SelectedItems.Count - 1) To 0 Step -1
  1185. ListB.Items.Remove(ListB.SelectedItems(i))
  1186. Next
  1187. End Sub
  1188.  
  1189. Protected Overrides Sub OnCreateControl()
  1190. MyBase.OnCreateControl()
  1191. If Not Controls.Contains(ListB) Then
  1192. Controls.Add(ListB)
  1193. End If
  1194. End Sub
  1195.  
  1196. Sub AddRange(ByVal items As Object())
  1197. ListB.Items.Remove("")
  1198. ListB.Items.AddRange(items)
  1199. End Sub
  1200.  
  1201. Sub AddItem(ByVal item As Object)
  1202. ListB.Items.Remove("")
  1203. ListB.Items.Add(item)
  1204. End Sub
  1205.  
  1206. #End Region
  1207.  
  1208. Sub Drawitem(ByVal sender As Object, ByVal e As DrawItemEventArgs) Handles ListB.DrawItem
  1209. If e.Index < 0 Then Exit Sub
  1210. e.DrawBackground()
  1211. e.DrawFocusRectangle()
  1212. With e.Graphics
  1213. If InStr(e.State.ToString, "Selected,") > 0 Then
  1214. .FillRectangle(New SolidBrush(_SelectedColour), New Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height))
  1215. .DrawString(" " & ListB.Items(e.Index).ToString(), New Font("Segoe UI", 10), New SolidBrush(Color.White), e.Bounds.X, e.Bounds.Y + 2)
  1216. Else
  1217. .FillRectangle(New SolidBrush(_ListBaseColour), New Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height))
  1218. .DrawString(" " & ListB.Items(e.Index).ToString(), New Font("Segoe UI", 10), New SolidBrush(_TextColour), e.Bounds.X, e.Bounds.Y + 2)
  1219. End If
  1220. .Dispose()
  1221. End With
  1222. End Sub
  1223.  
  1224. Sub New()
  1225. SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or _
  1226. ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer, True)
  1227. DoubleBuffered = True
  1228. ListB.DrawMode = Windows.Forms.DrawMode.OwnerDrawFixed
  1229. ListB.ScrollAlwaysVisible = False
  1230. ListB.HorizontalScrollbar = False
  1231. ListB.BorderStyle = BorderStyle.None
  1232. ListB.BackColor = _BaseColour
  1233. ListB.Location = New Point(3, 3)
  1234. ListB.Font = New Font("Segoe UI", 10)
  1235. ListB.ItemHeight = 20
  1236. ListB.Items.Clear()
  1237. ListB.IntegralHeight = False
  1238. Size = New Size(130, 100)
  1239. End Sub
  1240.  
  1241. Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  1242. Dim B As New Bitmap(Width, Height)
  1243. Dim G = Graphics.FromImage(B)
  1244. Dim Base As New Rectangle(0, 0, Width, Height)
  1245. With G
  1246. .Clear(BackColor)
  1247. ListB.Size = New Size(Width - 6, Height - 5)
  1248. .FillRectangle(New SolidBrush(_BaseColour), Base)
  1249. .DrawRectangle(New Pen(_BorderColour, -1), New Rectangle(0, 0, Width - 1, Height - 1))
  1250. End With
  1251. MyBase.OnPaint(e)
  1252. G.Dispose()
  1253. e.Graphics.DrawImageUnscaled(B, 0, 0)
  1254. B.Dispose()
  1255. End Sub
  1256.  
  1257. End Class
Add Comment
Please, Sign In to add comment