Advertisement
Marrand

Untitled

Nov 22nd, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 81.43 KB | None | 0 0
  1. TEMA VB NET 2018:
  2.  
  3. Option Strict On
  4.  
  5. Imports System.Drawing.Drawing2D
  6. Imports System.Drawing.Text
  7.  
  8. '<info>
  9. ' --------------------Fader Theme--------------------
  10. ' Creator - SaketSaket (HF)
  11. ' UID - 1869668
  12. ' Inspiration & Credits to all Theme creators of HF
  13. ' Version - 1.0
  14. ' Date Created - 1st December 2014
  15. ' Date Modified - 12th December 2014
  16. '
  17. '
  18. 'Special Thanks to Aeonhack for RoundRect Functions...
  19. 'AlertBox Control idea taken from iSynthesis' Flat UI theme
  20. '
  21. '
  22. ' For bugs & Constructive Criticism contact me on HF
  23. ' If you like it & want to DONATE then pm me on HF
  24. ' --------------------Fader Theme--------------------
  25. '<info>
  26.  
  27. 'Please Leave Credits in Source, Do not redistribute
  28.  
  29. Enum MouseState As Byte
  30. None = 0
  31. Over = 1
  32. Down = 2
  33. End Enum
  34.  
  35. Public Enum AlignmentStyle
  36. Center
  37. Left
  38. Right
  39. End Enum
  40.  
  41. Module Draw
  42. 'Special Thanks to Aeonhack for RoundRect Functions... ;)
  43. Public Function RoundRect(ByVal rectangle As Rectangle, ByVal curve As Integer) As GraphicsPath
  44. Dim p As GraphicsPath = New GraphicsPath()
  45. Dim arcRectangleWidth As Integer = curve * 2
  46. p.AddArc(New Rectangle(rectangle.X, rectangle.Y, arcRectangleWidth, arcRectangleWidth), -180, 90)
  47. p.AddArc(New Rectangle(rectangle.Width - arcRectangleWidth + rectangle.X, rectangle.Y, arcRectangleWidth, arcRectangleWidth), -90, 90)
  48. p.AddArc(New Rectangle(rectangle.Width - arcRectangleWidth + rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y, arcRectangleWidth, arcRectangleWidth), 0, 90)
  49. p.AddArc(New Rectangle(rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y, arcRectangleWidth, arcRectangleWidth), 90, 90)
  50. p.AddLine(New Point(rectangle.X, rectangle.Height - arcRectangleWidth + rectangle.Y), New Point(rectangle.X, curve + rectangle.Y))
  51. Return p
  52. End Function
  53. End Module
  54.  
  55. Public Class FaderTheme : Inherits ContainerControl
  56. Private _mousepos As Point = New Point(0, 0)
  57. Private _drag As Boolean = False
  58. Private _icon As Icon
  59.  
  60. Public Property Icon() As Icon
  61. Get
  62. Return _icon
  63. End Get
  64. Set(ByVal value As Icon)
  65. _icon = value
  66. Invalidate()
  67. End Set
  68. End Property
  69.  
  70. Private _showicon As Boolean = True
  71. Public Property ShowIcon As Boolean
  72. Get
  73. Return _showicon
  74. End Get
  75. Set(value As Boolean)
  76. _showicon = value
  77. Invalidate()
  78. End Set
  79. End Property
  80.  
  81. Private _showheader As Boolean = True
  82. Public Property ShowHeader As Boolean
  83. Get
  84. Return _showheader
  85. End Get
  86. Set(value As Boolean)
  87. _showheader = value
  88. Invalidate()
  89. End Set
  90. End Property
  91.  
  92. Private _headerAlignment As AlignmentStyle = AlignmentStyle.Center
  93. Public Property HeaderAlignment As AlignmentStyle
  94. Get
  95. Return _headerAlignment
  96. End Get
  97. Set(value As AlignmentStyle)
  98. _headerAlignment = value
  99. Invalidate()
  100. End Set
  101. End Property
  102.  
  103. Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  104. MyBase.OnMouseDown(e)
  105. If e.Button = Windows.Forms.MouseButtons.Left And New Rectangle(15, 10, Width - 31, 45).Contains(e.Location) Then
  106. _drag = True : _mousepos = e.Location
  107. End If
  108. End Sub
  109.  
  110. Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  111. MyBase.OnMouseUp(e)
  112. _drag = False
  113. End Sub
  114.  
  115. Protected Overrides Sub OnMouseMove(ByVal e As MouseEventArgs)
  116. MyBase.OnMouseMove(e)
  117. If _drag Then
  118. Parent.Location = New Point(MousePosition.X - _mousepos.X, MousePosition.Y - _mousepos.Y)
  119. End If
  120. End Sub
  121.  
  122. Sub New()
  123. MyBase.New()
  124. SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint, True)
  125. DoubleBuffered = True
  126. End Sub
  127.  
  128. Protected Overrides Sub OnCreateControl()
  129. MyBase.OnCreateControl()
  130. ParentForm.FormBorderStyle = FormBorderStyle.None
  131. ParentForm.TransparencyKey = Color.Fuchsia
  132. Dock = DockStyle.Fill
  133. End Sub
  134.  
  135. Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  136. Dim b As Bitmap = New Bitmap(Width, Height)
  137. Dim g As Graphics = Graphics.FromImage(b)
  138.  
  139. Dim bodyrect As Rectangle = New Rectangle(15, 10, Width - 31, Height - 21)
  140. Dim headerrect As Rectangle = New Rectangle(15, 10, Width - 31, 50)
  141. Dim footerrect As Rectangle = New Rectangle(15, Height - 25, Width - 31, 15)
  142. Dim leftborder As Rectangle = New Rectangle(0, 0, 15, Height - 1)
  143. Dim rightborder As Rectangle = New Rectangle(Width - 16, 0, 15, Height - 1)
  144.  
  145. MyBase.OnPaint(e)
  146. g.Clear(Color.Fuchsia)
  147.  
  148. Dim bodygb As New LinearGradientBrush(bodyrect, Color.FromArgb(61, 61, 61), Color.FromArgb(41, 41, 41), 90S)
  149. g.FillRectangle(bodygb, bodyrect)
  150. g.DrawRectangle(New Pen(Brushes.Black), bodyrect)
  151.  
  152. Dim headergb As New LinearGradientBrush(headerrect, Color.FromArgb(61, 61, 61), Color.FromArgb(41, 41, 41), 90S)
  153. g.FillRectangle(headergb, headerrect)
  154. g.DrawRectangle(New Pen(Brushes.Black), headerrect)
  155.  
  156. Dim footergb As New LinearGradientBrush(footerrect, Color.FromArgb(61, 61, 61), Color.FromArgb(41, 41, 41), 90S)
  157. g.FillRectangle(footergb, footerrect)
  158. g.DrawRectangle(New Pen(Brushes.Black), footerrect)
  159.  
  160. Dim leftbordergb As New LinearGradientBrush(leftborder, Color.FromArgb(53, 53, 53), Color.FromArgb(62, 62, 62), LinearGradientMode.Horizontal)
  161. g.FillPath(leftbordergb, RoundRect(leftborder, 7))
  162. g.DrawPath(New Pen(Brushes.Black), RoundRect(leftborder, 7))
  163.  
  164. Dim rightbordergb As New LinearGradientBrush(rightborder, Color.FromArgb(53, 53, 53), Color.FromArgb(62, 62, 62), LinearGradientMode.Horizontal)
  165. g.FillPath(rightbordergb, RoundRect(rightborder, 7))
  166. g.DrawPath(New Pen(Brushes.Black), RoundRect(rightborder, 7))
  167.  
  168. If ShowIcon = True Then
  169. Try
  170. g.DrawIcon(_icon, New Rectangle(20, 17, 38, 38))
  171. Catch : End Try
  172. End If
  173.  
  174. If ShowHeader = True Then
  175. Select Case _headerAlignment
  176. Case AlignmentStyle.Left
  177. g.DrawString(Text, New Font("Segoe UI", 15, FontStyle.Bold), New SolidBrush(Color.FromArgb(220, 220, 220)), New Rectangle(65, 10, Width - 31, 45), New StringFormat() With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Center})
  178. Case AlignmentStyle.Center
  179. g.DrawString(Text, New Font("Segoe UI", 15, FontStyle.Bold), New SolidBrush(Color.FromArgb(220, 220, 220)), headerrect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  180. Case AlignmentStyle.Right
  181. g.DrawString(Text, New Font("Segoe UI", 15, FontStyle.Bold), New SolidBrush(Color.FromArgb(220, 220, 220)), New Rectangle(0, 10, Width - 120, 45), New StringFormat() With {.Alignment = StringAlignment.Far, .LineAlignment = StringAlignment.Center})
  182. End Select
  183. End If
  184.  
  185. e.Graphics.DrawImage(b, New Point(0, 0))
  186. g.Dispose() : b.Dispose()
  187. End Sub
  188. End Class
  189.  
  190. Public Class FaderMinimalTheme : Inherits ContainerControl
  191. Private _mousepos As Point = New Point(0, 0)
  192. Private _drag As Boolean = False
  193.  
  194. Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  195. MyBase.OnMouseDown(e)
  196. If e.Button = Windows.Forms.MouseButtons.Left And New Rectangle(15, 10, Width - 31, 45).Contains(e.Location) Then
  197. _drag = True : _mousepos = e.Location
  198. End If
  199. End Sub
  200.  
  201. Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  202. MyBase.OnMouseUp(e)
  203. _drag = False
  204. End Sub
  205.  
  206. Protected Overrides Sub OnMouseMove(ByVal e As MouseEventArgs)
  207. MyBase.OnMouseMove(e)
  208. If _drag Then
  209. Parent.Location = New Point(MousePosition.X - _mousepos.X, MousePosition.Y - _mousepos.Y)
  210. End If
  211. End Sub
  212.  
  213. Sub New()
  214. MyBase.New()
  215. SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint, True)
  216. DoubleBuffered = True
  217. End Sub
  218.  
  219. Protected Overrides Sub OnCreateControl()
  220. MyBase.OnCreateControl()
  221. ParentForm.FormBorderStyle = FormBorderStyle.None
  222. ParentForm.TransparencyKey = Color.Fuchsia
  223. Dock = DockStyle.Fill
  224. End Sub
  225.  
  226. Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  227. Dim b As Bitmap = New Bitmap(Width, Height)
  228. Dim g As Graphics = Graphics.FromImage(b)
  229.  
  230. Dim bodyrect As Rectangle = New Rectangle(15, 10, Width - 31, Height - 21)
  231. Dim headerrect As Rectangle = New Rectangle(15, 10, Width - 31, 15)
  232. Dim footerrect As Rectangle = New Rectangle(15, Height - 25, Width - 31, 15)
  233. Dim leftborder As Rectangle = New Rectangle(0, 0, 15, Height - 1)
  234. Dim rightborder As Rectangle = New Rectangle(Width - 16, 0, 15, Height - 1)
  235.  
  236. MyBase.OnPaint(e)
  237. g.Clear(Color.Fuchsia)
  238.  
  239. Dim bodygb As New LinearGradientBrush(bodyrect, Color.FromArgb(61, 61, 61), Color.FromArgb(41, 41, 41), 90S)
  240. g.FillRectangle(bodygb, bodyrect)
  241. g.DrawRectangle(New Pen(Brushes.Black), bodyrect)
  242.  
  243. Dim headergb As New LinearGradientBrush(headerrect, Color.FromArgb(61, 61, 61), Color.FromArgb(41, 41, 41), 90S)
  244. g.FillRectangle(headergb, headerrect)
  245. g.DrawRectangle(New Pen(Brushes.Black), headerrect)
  246.  
  247. Dim footergb As New LinearGradientBrush(footerrect, Color.FromArgb(61, 61, 61), Color.FromArgb(41, 41, 41), 90S)
  248. g.FillRectangle(footergb, footerrect)
  249. g.DrawRectangle(New Pen(Brushes.Black), footerrect)
  250.  
  251. Dim leftbordergb As New LinearGradientBrush(leftborder, Color.FromArgb(53, 53, 53), Color.FromArgb(62, 62, 62), LinearGradientMode.Horizontal)
  252. g.FillPath(leftbordergb, RoundRect(leftborder, 7))
  253. g.DrawPath(New Pen(Brushes.Black), RoundRect(leftborder, 7))
  254.  
  255. Dim rightbordergb As New LinearGradientBrush(rightborder, Color.FromArgb(53, 53, 53), Color.FromArgb(62, 62, 62), LinearGradientMode.Horizontal)
  256. g.FillPath(rightbordergb, RoundRect(rightborder, 7))
  257. g.DrawPath(New Pen(Brushes.Black), RoundRect(rightborder, 7))
  258.  
  259. e.Graphics.DrawImage(b, New Point(0, 0))
  260. g.Dispose() : b.Dispose()
  261. End Sub
  262. End Class
  263.  
  264. Public Class FaderControlBox : Inherits Control
  265. Dim _state As MouseState = MouseState.None
  266. Dim _x As Integer
  267. ReadOnly _minrect As New Rectangle(5, 2, 24, 24)
  268. ReadOnly _maxrect As New Rectangle(32, 2, 24, 24)
  269. ReadOnly _closerect As New Rectangle(59, 2, 24, 24)
  270. ReadOnly _mintextrect As New Rectangle(5, 4, 24, 24)
  271. ReadOnly _maxtextrect As New Rectangle(32, 4, 24, 24)
  272. ReadOnly _closetextrect As New Rectangle(59, 4, 24, 24)
  273.  
  274. Private _minDisable As Boolean = False
  275. Public Property MinimumDisable As Boolean
  276. Get
  277. Return _minDisable
  278. End Get
  279. Set(value As Boolean)
  280. _minDisable = value
  281. Invalidate()
  282. End Set
  283. End Property
  284.  
  285. Private _maxDisable As Boolean = False
  286. Public Property MaximumDisable As Boolean
  287. Get
  288. Return _maxDisable
  289. End Get
  290. Set(value As Boolean)
  291. _maxDisable = value
  292. Invalidate()
  293. End Set
  294. End Property
  295.  
  296. Protected Overrides Sub OnMouseDown(ByVal e As Windows.Forms.MouseEventArgs)
  297. MyBase.OnMouseDown(e)
  298.  
  299. If _x > 5 AndAlso _x < 29 Then
  300. If MinimumDisable = False Then
  301. FindForm.WindowState = FormWindowState.Minimized
  302. End If
  303. ElseIf _x > 32 AndAlso _x < 56 Then
  304. If MaximumDisable = False Then
  305. If FindForm.WindowState = FormWindowState.Maximized Then
  306. FindForm.WindowState = FormWindowState.Minimized
  307. FindForm.WindowState = FormWindowState.Normal
  308. Else
  309. FindForm.WindowState = FormWindowState.Minimized
  310. FindForm.WindowState = FormWindowState.Maximized
  311. End If
  312. End If
  313. ElseIf _x > 59 AndAlso _x < 83 Then
  314. FindForm.Close()
  315. End If
  316.  
  317. _state = MouseState.Down : Invalidate()
  318. End Sub
  319.  
  320. Protected Overrides Sub OnMouseUp(ByVal e As Windows.Forms.MouseEventArgs)
  321. MyBase.OnMouseUp(e)
  322. _state = MouseState.Over : Invalidate()
  323. End Sub
  324.  
  325. Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
  326. MyBase.OnMouseEnter(e)
  327. _state = MouseState.Over : Invalidate()
  328. End Sub
  329.  
  330. Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
  331. MyBase.OnMouseLeave(e)
  332. _state = MouseState.None : Invalidate()
  333. End Sub
  334.  
  335. Protected Overrides Sub OnMouseMove(ByVal e As Windows.Forms.MouseEventArgs)
  336. MyBase.OnMouseMove(e)
  337. _x = e.Location.X
  338. Invalidate()
  339. End Sub
  340.  
  341. Sub New()
  342. MyBase.New()
  343. SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  344. DoubleBuffered = True
  345. BackColor = Color.Transparent
  346. Width = 85
  347. Height = 30
  348. Anchor = AnchorStyles.Top Or AnchorStyles.Right
  349. End Sub
  350.  
  351. Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  352. Dim b As Bitmap = New Bitmap(Width, Height)
  353. Dim g As Graphics = Graphics.FromImage(b)
  354.  
  355. MyBase.OnPaint(e)
  356. g.SmoothingMode = SmoothingMode.HighQuality
  357. g.FillRectangle(New SolidBrush(Color.FromArgb(161, 161, 161)), _minrect)
  358. g.DrawRectangle(Pens.Black, _minrect)
  359. g.FillRectangle(New SolidBrush(Color.FromArgb(161, 161, 161)), _maxrect)
  360. g.DrawRectangle(Pens.Black, _maxrect)
  361. g.FillRectangle(New SolidBrush(Color.FromArgb(161, 161, 161)), _closerect)
  362. g.DrawRectangle(Pens.Black, _closerect)
  363.  
  364. g.DrawString("0", New Font("Marlett", 11.5), New SolidBrush(Color.FromArgb(0, 0, 0)), _mintextrect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  365. If FindForm.WindowState = FormWindowState.Maximized Then
  366. g.DrawString("2", New Font("Marlett", 11.5), New SolidBrush(Color.FromArgb(0, 0, 0)), _maxtextrect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  367. Else
  368. g.DrawString("1", New Font("Marlett", 11.5), New SolidBrush(Color.FromArgb(0, 0, 0)), _maxtextrect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  369. End If
  370. g.DrawString("r", New Font("Marlett", 11.5), New SolidBrush(Color.FromArgb(0, 0, 0)), _closetextrect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  371.  
  372. Select Case _state
  373. Case MouseState.None
  374. g.FillRectangle(New SolidBrush(Color.FromArgb(161, 161, 161)), _minrect)
  375. g.DrawRectangle(Pens.Black, _minrect)
  376. g.FillRectangle(New SolidBrush(Color.FromArgb(161, 161, 161)), _maxrect)
  377. g.DrawRectangle(Pens.Black, _maxrect)
  378. g.FillRectangle(New SolidBrush(Color.FromArgb(161, 161, 161)), _closerect)
  379. g.DrawRectangle(Pens.Black, _closerect)
  380.  
  381. g.DrawString("0", New Font("Marlett", 11.5), New SolidBrush(Color.FromArgb(0, 0, 0)), _mintextrect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  382. If FindForm.WindowState = FormWindowState.Maximized Then
  383. g.DrawString("2", New Font("Marlett", 11.5), New SolidBrush(Color.FromArgb(0, 0, 0)), _maxtextrect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  384. Else
  385. g.DrawString("1", New Font("Marlett", 11.5), New SolidBrush(Color.FromArgb(0, 0, 0)), _maxtextrect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  386. End If
  387. g.DrawString("r", New Font("Marlett", 11.5), New SolidBrush(Color.FromArgb(0, 0, 0)), _closetextrect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  388.  
  389. Case MouseState.Over
  390. If _x > 5 AndAlso _x < 29 Then
  391. If MinimumDisable = False Then
  392. g.FillRectangle(New SolidBrush(Color.FromArgb(121, 121, 121)), _minrect)
  393. g.DrawRectangle(Pens.Black, _minrect)
  394. g.DrawString("0", New Font("Marlett", 11.5), New SolidBrush(Color.FromArgb(255, 255, 255)), _mintextrect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  395. End If
  396. ElseIf _x > 32 AndAlso _x < 56 Then
  397. If MaximumDisable = False Then
  398. g.FillRectangle(New SolidBrush(Color.FromArgb(121, 121, 121)), _maxrect)
  399. g.DrawRectangle(Pens.Black, _maxrect)
  400. End If
  401.  
  402. If FindForm.WindowState = FormWindowState.Maximized Then
  403. g.DrawString("2", New Font("Marlett", 11.5), New SolidBrush(Color.FromArgb(255, 255, 255)), _maxtextrect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  404. Else
  405. g.DrawString("1", New Font("Marlett", 11.5), New SolidBrush(Color.FromArgb(255, 255, 255)), _maxtextrect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  406. End If
  407. ElseIf _x > 59 AndAlso _x < 83 Then
  408. g.FillRectangle(New SolidBrush(Color.FromArgb(121, 121, 121)), _closerect)
  409. g.DrawRectangle(Pens.Black, _closerect)
  410. g.DrawString("r", New Font("Marlett", 11.5), New SolidBrush(Color.FromArgb(255, 255, 255)), _closetextrect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  411. End If
  412. Case Else
  413. If MinimumDisable = False Then
  414. g.FillRectangle(New SolidBrush(Color.FromArgb(81, 81, 81)), _minrect)
  415. g.DrawRectangle(Pens.Black, _minrect)
  416. End If
  417.  
  418. If MaximumDisable = False Then
  419. g.FillRectangle(New SolidBrush(Color.FromArgb(81, 81, 81)), _maxrect)
  420. g.DrawRectangle(Pens.Black, _maxrect)
  421. End If
  422. g.FillRectangle(New SolidBrush(Color.FromArgb(81, 81, 81)), _closerect)
  423. g.DrawRectangle(Pens.Black, _closerect)
  424.  
  425. g.DrawString("0", New Font("Marlett", 11.5), New SolidBrush(Color.FromArgb(0, 0, 0)), _mintextrect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  426. If FindForm.WindowState = FormWindowState.Maximized Then
  427. g.DrawString("2", New Font("Marlett", 11.5), New SolidBrush(Color.FromArgb(0, 0, 0)), _maxtextrect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  428. Else
  429. g.DrawString("1", New Font("Marlett", 11.5), New SolidBrush(Color.FromArgb(0, 0, 0)), _maxtextrect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  430. End If
  431. g.DrawString("r", New Font("Marlett", 11.5), New SolidBrush(Color.FromArgb(0, 0, 0)), _closetextrect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  432. End Select
  433.  
  434. e.Graphics.DrawImage(b, New Point(0, 0))
  435. g.Dispose() : b.Dispose()
  436. End Sub
  437. End Class
  438.  
  439. Public Class FaderRadioButton : Inherits Control
  440. Dim _state As MouseState = MouseState.None
  441. Private _check As Boolean
  442. Public Property Checked As Boolean
  443. Get
  444. Return _check
  445. End Get
  446. Set(value As Boolean)
  447. _check = value
  448. Invalidate()
  449. End Set
  450. End Property
  451.  
  452. Sub New()
  453. MyBase.New()
  454. SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  455. BackColor = Color.Transparent
  456. DoubleBuffered = True
  457. Size = New Size(180, 25)
  458. End Sub
  459.  
  460. Protected Overrides Sub OnTextChanged(ByVal e As EventArgs)
  461. MyBase.OnTextChanged(e)
  462. Invalidate()
  463. End Sub
  464.  
  465. Protected Overrides Sub OnClick(ByVal e As EventArgs)
  466. If Not Checked Then Checked = True
  467. For Each ctrl As FaderRadioButton In From ctrl1 In Parent.Controls.OfType(Of FaderRadioButton)() Where ctrl1.Handle <> Handle Where ctrl1.Enabled
  468. ctrl.Checked = False
  469. Next
  470. MyBase.OnClick(e)
  471. End Sub
  472.  
  473. Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
  474. MyBase.OnMouseDown(e)
  475. _state = MouseState.Down : Invalidate()
  476. End Sub
  477. Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
  478. MyBase.OnMouseUp(e)
  479. _state = MouseState.Over : Invalidate()
  480. End Sub
  481. Protected Overrides Sub OnMouseEnter(e As EventArgs)
  482. MyBase.OnMouseEnter(e)
  483. _state = MouseState.Over : Invalidate()
  484. End Sub
  485. Protected Overrides Sub OnMouseLeave(e As EventArgs)
  486. MyBase.OnMouseLeave(e)
  487. _state = MouseState.None : Invalidate()
  488. End Sub
  489.  
  490. Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  491. Dim b As Bitmap = New Bitmap(Width, Height)
  492. Dim g As Graphics = Graphics.FromImage(b)
  493.  
  494. Dim selectionrect As Rectangle = New Rectangle(3, 3, 18, 18)
  495. Dim innerselectionrect As Rectangle = New Rectangle(4, 4, 17, 17)
  496. Dim selectrect As Rectangle = New Rectangle(8, 8, 8, 8)
  497.  
  498. MyBase.OnPaint(e)
  499. g.SmoothingMode = SmoothingMode.HighQuality
  500. g.InterpolationMode = InterpolationMode.HighQualityBicubic
  501. g.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
  502. g.Clear(BackColor)
  503.  
  504. Select Case _state
  505. Case MouseState.Over
  506. selectionrect.Inflate(1, 1)
  507. Case MouseState.Down
  508. selectionrect.Inflate(-1, -1)
  509. End Select
  510.  
  511. g.DrawString(Text, New Font("Segoe UI", 11, FontStyle.Bold), New SolidBrush(Color.FromArgb(245, 245, 245)), New Rectangle(25, 4, Width, 16), New StringFormat() With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Center})
  512.  
  513. If Checked Then
  514. g.FillEllipse(New SolidBrush(Color.FromArgb(0, 0, 0)), selectionrect)
  515. g.FillEllipse(New SolidBrush(Color.FromArgb(40, 37, 33)), innerselectionrect)
  516. g.FillEllipse(New SolidBrush(Color.FromArgb(245, 245, 245)), selectrect)
  517. Else
  518. g.FillEllipse(New SolidBrush(Color.FromArgb(0, 0, 0)), selectionrect)
  519. g.FillEllipse(New SolidBrush(Color.FromArgb(40, 37, 33)), innerselectionrect)
  520. End If
  521.  
  522. e.Graphics.DrawImage(b, New Point(0, 0))
  523. g.Dispose() : b.Dispose()
  524. End Sub
  525. End Class
  526.  
  527. Public Class FaderCheckBox : Inherits Control
  528. Dim _state As MouseState = MouseState.None
  529.  
  530. Private _check As Boolean
  531. Public Property Checked As Boolean
  532. Get
  533. Return _check
  534. End Get
  535. Set(value As Boolean)
  536. _check = value
  537. Invalidate()
  538. End Set
  539. End Property
  540.  
  541. Sub New()
  542. MyBase.New()
  543. SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  544. BackColor = Color.Transparent
  545. DoubleBuffered = True
  546. Size = New Size(180, 25)
  547. End Sub
  548.  
  549. Protected Overrides Sub OnTextChanged(ByVal e As EventArgs)
  550. MyBase.OnTextChanged(e)
  551. Invalidate()
  552. End Sub
  553.  
  554. Protected Overrides Sub OnClick(ByVal e As EventArgs)
  555. If Not Checked Then Checked = True Else Checked = False
  556. MyBase.OnClick(e)
  557. End Sub
  558.  
  559. Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
  560. MyBase.OnMouseDown(e)
  561. _state = MouseState.Down : Invalidate()
  562. End Sub
  563. Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
  564. MyBase.OnMouseUp(e)
  565. _state = MouseState.Over : Invalidate()
  566. End Sub
  567. Protected Overrides Sub OnMouseEnter(e As EventArgs)
  568. MyBase.OnMouseEnter(e)
  569. _state = MouseState.Over : Invalidate()
  570. End Sub
  571. Protected Overrides Sub OnMouseLeave(e As EventArgs)
  572. MyBase.OnMouseLeave(e)
  573. _state = MouseState.None : Invalidate()
  574. End Sub
  575.  
  576. Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  577. Dim b As Bitmap = New Bitmap(Width, Height)
  578. Dim g As Graphics = Graphics.FromImage(b)
  579.  
  580. Dim selectionrect As Rectangle = New Rectangle(3, 3, 18, 18)
  581. Dim innerselectionrect As Rectangle = New Rectangle(4, 4, 17, 17)
  582. Dim selectrect As Rectangle = New Rectangle(6, 6, 15, 15)
  583.  
  584. MyBase.OnPaint(e)
  585. g.SmoothingMode = SmoothingMode.HighQuality
  586. g.InterpolationMode = InterpolationMode.HighQualityBicubic
  587. g.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
  588. g.Clear(BackColor)
  589.  
  590. Select Case _state
  591. Case MouseState.Over
  592. selectionrect.Inflate(1, 1)
  593. Case MouseState.Down
  594. selectionrect.Inflate(-1, -1)
  595. End Select
  596.  
  597. g.DrawString(Text, New Font("Segoe UI", 11, FontStyle.Bold), New SolidBrush(Color.FromArgb(245, 245, 245)), New Rectangle(25, 4, Width, 16), New StringFormat() With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Center})
  598.  
  599. If Checked Then
  600. g.FillRectangle(New SolidBrush(Color.FromArgb(0, 0, 0)), selectionrect)
  601. g.FillRectangle(New SolidBrush(Color.FromArgb(40, 37, 33)), innerselectionrect)
  602. g.DrawString("b", New Font("Marlett", 15, FontStyle.Regular), New SolidBrush(Color.FromArgb(245, 245, 245)), selectrect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  603. Else
  604. g.FillRectangle(New SolidBrush(Color.FromArgb(0, 0, 0)), selectionrect)
  605. g.FillRectangle(New SolidBrush(Color.FromArgb(40, 37, 33)), innerselectionrect)
  606. End If
  607.  
  608. e.Graphics.DrawImage(b, New Point(0, 0))
  609. g.Dispose() : b.Dispose()
  610. End Sub
  611. End Class
  612.  
  613. Public Class FaderButton : Inherits Control
  614. Dim _state As MouseState
  615. Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  616. MyBase.OnMouseDown(e)
  617. _state = MouseState.Down
  618. Invalidate()
  619. End Sub
  620.  
  621. Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  622. MyBase.OnMouseUp(e)
  623. _state = MouseState.Over
  624. Invalidate()
  625. End Sub
  626.  
  627. Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
  628. MyBase.OnMouseEnter(e)
  629. _state = MouseState.Over
  630. Invalidate()
  631. End Sub
  632.  
  633. Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
  634. MyBase.OnMouseLeave(e)
  635. _state = MouseState.None
  636. Invalidate()
  637. End Sub
  638.  
  639. Sub New()
  640. SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  641. BackColor = Color.Transparent
  642. DoubleBuffered = True
  643. Size = New Size(160, 35)
  644. _state = MouseState.None
  645. End Sub
  646.  
  647. Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  648. Dim b As Bitmap = New Bitmap(Width, Height)
  649. Dim g As Graphics = Graphics.FromImage(b)
  650.  
  651. Dim bodyrect As Rectangle = New Rectangle(1, 5, Width - 3, Height - 11)
  652. Dim topborderrect As Rectangle = New Rectangle(0, 0, Width - 1, 5)
  653. Dim bottomborderrect As Rectangle = New Rectangle(0, Height - 6, Width - 1, 5)
  654. Dim btnfont As New Font("Segoe UI", 11, FontStyle.Bold)
  655.  
  656. MyBase.OnPaint(e)
  657. g.SmoothingMode = SmoothingMode.HighQuality
  658. g.InterpolationMode = InterpolationMode.HighQualityBicubic
  659. g.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
  660. g.Clear(BackColor)
  661.  
  662. Dim bodyrectgb As New LinearGradientBrush(bodyrect, Color.FromArgb(61, 61, 61), Color.FromArgb(41, 41, 41), LinearGradientMode.Vertical)
  663. g.FillRectangle(bodyrectgb, bodyrect)
  664. g.DrawRectangle(New Pen(Brushes.Black), bodyrect)
  665.  
  666. Dim topborderrectgb As New LinearGradientBrush(topborderrect, Color.FromArgb(53, 53, 53), Color.FromArgb(62, 62, 62), LinearGradientMode.Vertical)
  667. g.FillRectangle(topborderrectgb, topborderrect)
  668. g.DrawRectangle(New Pen(Brushes.Black), topborderrect)
  669.  
  670. Dim bottomborderrectgb As New LinearGradientBrush(bottomborderrect, Color.FromArgb(53, 53, 53), Color.FromArgb(62, 62, 62), LinearGradientMode.Vertical)
  671. g.FillRectangle(bottomborderrectgb, bottomborderrect)
  672. g.DrawRectangle(New Pen(Brushes.Black), bottomborderrect)
  673.  
  674. Select Case _state
  675. Case MouseState.None
  676. Dim bodyrectnonegb As New LinearGradientBrush(bodyrect, Color.FromArgb(61, 61, 61), Color.FromArgb(41, 41, 41), LinearGradientMode.Vertical)
  677. g.FillRectangle(bodyrectnonegb, bodyrect)
  678. g.DrawRectangle(New Pen(Brushes.Black), bodyrect)
  679.  
  680. Dim topborderrectnonegb As New LinearGradientBrush(topborderrect, Color.FromArgb(53, 53, 53), Color.FromArgb(62, 62, 62), LinearGradientMode.Vertical)
  681. g.FillRectangle(topborderrectnonegb, topborderrect)
  682. g.DrawRectangle(New Pen(Brushes.Black), topborderrect)
  683.  
  684. Dim bottomborderrectnonegb As New LinearGradientBrush(bottomborderrect, Color.FromArgb(53, 53, 53), Color.FromArgb(62, 62, 62), LinearGradientMode.Vertical)
  685. g.FillRectangle(bottomborderrectnonegb, bottomborderrect)
  686. g.DrawRectangle(New Pen(Brushes.Black), bottomborderrect)
  687. g.DrawString(Text, btnfont, New SolidBrush(Color.FromArgb(245, 245, 245)), bodyrect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  688. Case MouseState.Down
  689. g.TranslateTransform(1, 1)
  690. g.DrawString(Text, btnfont, New SolidBrush(Color.FromArgb(245, 245, 245)), bodyrect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  691. Case MouseState.Over
  692. Dim bodyrectovergb As New LinearGradientBrush(bodyrect, Color.FromArgb(41, 41, 41), Color.FromArgb(61, 61, 61), LinearGradientMode.Vertical)
  693. g.FillRectangle(bodyrectovergb, bodyrect)
  694. g.DrawRectangle(New Pen(Brushes.Black), bodyrect)
  695. g.DrawString(Text, btnfont, New SolidBrush(Color.FromArgb(245, 245, 245)), bodyrect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  696. End Select
  697.  
  698. e.Graphics.DrawImage(b, New Point(0, 0))
  699. g.Dispose() : b.Dispose()
  700. End Sub
  701. End Class
  702.  
  703. Public Class FaderPanel : Inherits ContainerControl
  704.  
  705. Protected Overrides Sub OnResize(ByVal e As EventArgs)
  706. MyBase.OnResize(e)
  707. Invalidate()
  708. End Sub
  709.  
  710. Sub New()
  711. MyBase.New()
  712. SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  713. BackColor = Color.Transparent
  714. DoubleBuffered = True
  715. Size = New Size(240, 160)
  716. End Sub
  717.  
  718. Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  719. Dim b As Bitmap = New Bitmap(Width, Height)
  720. Dim g As Graphics = Graphics.FromImage(b)
  721.  
  722. Dim rect As Rectangle = New Rectangle(0, 0, Width - 1, Height - 1)
  723.  
  724. MyBase.OnPaint(e)
  725. g.SmoothingMode = SmoothingMode.HighQuality
  726. g.InterpolationMode = InterpolationMode.HighQualityBicubic
  727. g.Clear(BackColor)
  728.  
  729. Dim panelgb As New LinearGradientBrush(rect, Color.FromArgb(61, 61, 61), Color.FromArgb(41, 41, 41), 90S)
  730. g.FillRectangle(panelgb, rect)
  731. g.DrawRectangle(New Pen(Brushes.Black, 2), rect)
  732.  
  733. e.Graphics.DrawImage(b, New Point(0, 0))
  734. g.Dispose() : b.Dispose()
  735. End Sub
  736. End Class
  737.  
  738. Public Class FaderGroupBox : Inherits ContainerControl
  739. Private _showHeader As Boolean = True
  740. Public Property ShowHeader() As Boolean
  741. Get
  742. Return _showHeader
  743. End Get
  744. Set(ByVal v As Boolean)
  745. _showHeader = v
  746. Invalidate()
  747. End Set
  748. End Property
  749.  
  750. Protected Overrides Sub OnResize(ByVal e As EventArgs)
  751. MyBase.OnResize(e)
  752. Invalidate()
  753. End Sub
  754.  
  755. Sub New()
  756. MyBase.New()
  757. SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  758. BackColor = Color.Transparent
  759. DoubleBuffered = True
  760. Size = New Size(240, 160)
  761. End Sub
  762.  
  763. Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  764. Dim b As Bitmap = New Bitmap(Width, Height)
  765. Dim g As Graphics = Graphics.FromImage(b)
  766.  
  767. Dim underlinepen As New Pen(Color.FromArgb(255, 255, 255), 2)
  768. Dim rect As Rectangle = New Rectangle(0, 0, Width - 1, Height - 1)
  769.  
  770. MyBase.OnPaint(e)
  771. g.SmoothingMode = SmoothingMode.HighQuality
  772. g.InterpolationMode = InterpolationMode.HighQualityBicubic
  773. g.Clear(BackColor)
  774.  
  775. Dim groupgb As New LinearGradientBrush(rect, Color.FromArgb(61, 61, 61), Color.FromArgb(41, 41, 41), 90S)
  776. g.FillRectangle(groupgb, rect)
  777. g.DrawRectangle(New Pen(Brushes.Black, 2), rect)
  778.  
  779. If _showHeader Then
  780. g.DrawString(Text, New Font("Segoe UI", 11, FontStyle.Bold), New SolidBrush(Color.FromArgb(245, 245, 245)), New Rectangle(0, 3, Width - 1, 30), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  781. g.DrawLine(underlinepen, 10, 30, Width - 11, 30)
  782. End If
  783.  
  784. e.Graphics.DrawImage(b, New Point(0, 0))
  785. g.Dispose() : b.Dispose()
  786. End Sub
  787. End Class
  788.  
  789. Public Class FaderProgressBar : Inherits Control
  790. Private _val As Integer
  791. Public Property Value() As Integer
  792. Get
  793. Return _val
  794. End Get
  795. Set(ByVal v As Integer)
  796. If v > _max Then
  797. _val = _max
  798. ElseIf v < 0 Then
  799. _val = 0
  800. Else
  801. _val = v
  802. End If
  803. Invalidate()
  804. End Set
  805. End Property
  806.  
  807. Private _max As Integer
  808. Public Property Maximum() As Integer
  809. Get
  810. Return _max
  811. End Get
  812. Set(ByVal v As Integer)
  813. If v < 1 Then
  814. _max = 1
  815. Else
  816. _max = v
  817. End If
  818. If v < _val Then
  819. _val = _max
  820. End If
  821. Invalidate()
  822. End Set
  823. End Property
  824.  
  825. Private _showPercentage As Boolean = False
  826. Public Property ShowPercentage() As Boolean
  827. Get
  828. Return _showPercentage
  829. End Get
  830. Set(ByVal v As Boolean)
  831. _showPercentage = v
  832. Invalidate()
  833. End Set
  834. End Property
  835.  
  836. Sub New()
  837. MyBase.New()
  838. SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  839. BackColor = Color.Transparent
  840. Size = New Size(250, 20)
  841. DoubleBuffered = True
  842. _max = 100
  843. End Sub
  844.  
  845. Protected Overrides Sub OnPaint(e As Windows.Forms.PaintEventArgs)
  846. Dim b As Bitmap = New Bitmap(Width, Height)
  847. Dim g As Graphics = Graphics.FromImage(b)
  848.  
  849. Dim percent As Integer = CInt((Width - 1) * (_val / _max))
  850. Dim outerrect As Rectangle = New Rectangle(0, 0, Width - 1, Height - 1)
  851. Dim innerrect As Rectangle = New Rectangle(4, 4, percent - 9, Height - 9)
  852.  
  853. MyBase.OnPaint(e)
  854. g.Clear(BackColor)
  855. g.SmoothingMode = SmoothingMode.HighQuality
  856. g.FillPath(New SolidBrush(Color.FromArgb(41, 41, 41)), RoundRect(outerrect, 5))
  857. g.DrawPath(New Pen(Color.FromArgb(0, 0, 0), 2), RoundRect(outerrect, 5))
  858.  
  859. If percent <> 0 Then
  860. g.FillPath(New SolidBrush(Color.FromArgb(128, 128, 128)), RoundRect(innerrect, 7))
  861. End If
  862.  
  863. If _showPercentage Then
  864. g.DrawString(String.Format("{0}%", _val), New Font("Segoe UI", 10, FontStyle.Bold), New SolidBrush(Color.FromArgb(245, 245, 245)), New Rectangle(10, 1, Width - 1, Height - 1), New StringFormat With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  865. End If
  866.  
  867. e.Graphics.DrawImage(b, New Point(0, 0))
  868. g.Dispose() : b.Dispose()
  869. End Sub
  870. End Class
  871.  
  872. Public Class FaderLabel : Inherits Control
  873. Private _border As Boolean = True
  874. Public Property Border As Boolean
  875. Get
  876. Return _border
  877. End Get
  878. Set(value As Boolean)
  879. _border = value
  880. Invalidate()
  881. End Set
  882. End Property
  883.  
  884. Sub New()
  885. SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  886. BackColor = Color.Transparent
  887. DoubleBuffered = True
  888. Size = New Size(150, 30)
  889. End Sub
  890.  
  891. Protected Overrides Sub OnPaint(ByVal e As Windows.Forms.PaintEventArgs)
  892. Dim b As Bitmap = New Bitmap(Width, Height)
  893. Dim g As Graphics = Graphics.FromImage(b)
  894.  
  895. Dim rect As Rectangle = New Rectangle(0, 0, Width - 1, Height - 1)
  896.  
  897. MyBase.OnPaint(e)
  898. g.Clear(BackColor)
  899. g.SmoothingMode = SmoothingMode.HighQuality
  900. g.InterpolationMode = InterpolationMode.HighQualityBicubic
  901. g.FillPath(New SolidBrush(Color.FromArgb(41, 41, 41)), RoundRect(rect, 5))
  902.  
  903. If Border = True Then
  904. g.FillPath(New SolidBrush(Color.FromArgb(41, 41, 41)), RoundRect(rect, 5))
  905. g.DrawPath(New Pen(Color.FromArgb(21, 21, 21), 2), RoundRect(rect, 5))
  906. End If
  907.  
  908. g.DrawString(Text, New Font("Segoe UI", 11, FontStyle.Regular), New SolidBrush(Color.FromArgb(255, 255, 255)), rect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  909.  
  910. e.Graphics.DrawImage(b, New Point(0, 0))
  911. g.Dispose() : b.Dispose()
  912. End Sub
  913. End Class
  914.  
  915. Public Class FaderToggle : Inherits Control
  916. Private _check As Boolean
  917. Public Property Checked As Boolean
  918. Get
  919. Return _check
  920. End Get
  921. Set(value As Boolean)
  922. _check = value
  923. Invalidate()
  924. End Set
  925. End Property
  926.  
  927. Sub New()
  928. MyBase.New()
  929. SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  930. DoubleBuffered = True
  931. BackColor = Color.Transparent
  932. Size = New Size(80, 25)
  933. End Sub
  934.  
  935. Protected Overrides Sub OnClick(ByVal e As EventArgs)
  936. If Not Checked Then Checked = True Else Checked = False
  937. MyBase.OnClick(e)
  938. End Sub
  939.  
  940. Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  941. Dim b As Bitmap = New Bitmap(Width, Height)
  942. Dim g As Graphics = Graphics.FromImage(b)
  943.  
  944. Dim outerrect As Rectangle = New Rectangle(0, 0, Width - 1, Height - 1)
  945.  
  946. MyBase.OnPaint(e)
  947. g.Clear(BackColor)
  948. g.SmoothingMode = SmoothingMode.HighQuality
  949. g.InterpolationMode = InterpolationMode.HighQualityBicubic
  950. g.FillPath(New SolidBrush(Color.FromArgb(41, 41, 41)), RoundRect(outerrect, 5))
  951. g.DrawPath(New Pen(Color.FromArgb(0, 0, 0), 2), RoundRect(outerrect, 5))
  952.  
  953. If Checked Then
  954. g.FillPath(New SolidBrush(Color.FromArgb(128, 128, 128)), RoundRect(New Rectangle(3, 3, CInt((Width / 2) - 3), Height - 7), 3))
  955. g.DrawString("ON", New Font("Segoe UI", 11, FontStyle.Bold), New SolidBrush(Color.FromArgb(0, 0, 0)), New Rectangle(2, 3, CInt((Width / 2) - 1), Height - 5), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  956. Else
  957. g.FillPath(New SolidBrush(Color.FromArgb(128, 128, 128)), RoundRect(New Rectangle(CInt((Width / 2) - 2), 3, CInt((Width / 2) - 2), Height - 7), 3))
  958. g.DrawString("OFF", New Font("Segoe UI", 11, FontStyle.Bold), New SolidBrush(Color.FromArgb(0, 0, 0)), New Rectangle(CInt((Width / 2) - 2), 3, CInt((Width / 2) - 1), Height - 5), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  959. End If
  960.  
  961. e.Graphics.DrawImage(b, New Point(0, 0))
  962. g.Dispose() : b.Dispose()
  963. End Sub
  964. End Class
  965.  
  966. Public Class FaderVerticalProgressBar : Inherits Control
  967. Private _val As Integer
  968. Public Property Value() As Integer
  969. Get
  970. Return _val
  971. End Get
  972. Set(ByVal v As Integer)
  973. If v > _max Then
  974. _val = _max
  975. ElseIf v < 0 Then
  976. _val = 0
  977. Else
  978. _val = v
  979. End If
  980. Invalidate()
  981. End Set
  982. End Property
  983.  
  984. Private _max As Integer
  985. Public Property Maximum() As Integer
  986. Get
  987. Return _max
  988. End Get
  989. Set(ByVal v As Integer)
  990. If v < 1 Then
  991. _max = 1
  992. Else
  993. _max = v
  994. End If
  995. If v < _val Then
  996. _val = _max
  997. End If
  998. Invalidate()
  999. End Set
  1000. End Property
  1001.  
  1002. Private _showPercentage As Boolean = False
  1003. Public Property ShowPercentage() As Boolean
  1004. Get
  1005. Return _showPercentage
  1006. End Get
  1007. Set(ByVal v As Boolean)
  1008. _showPercentage = v
  1009. Invalidate()
  1010. End Set
  1011. End Property
  1012.  
  1013. Sub New()
  1014. MyBase.New()
  1015. SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  1016. BackColor = Color.Transparent
  1017. Size = New Size(20, 250)
  1018. DoubleBuffered = True
  1019. _max = 100
  1020. End Sub
  1021.  
  1022. Protected Overrides Sub OnPaint(e As Windows.Forms.PaintEventArgs)
  1023. Dim b As Bitmap = New Bitmap(Width, Height)
  1024. Dim g As Graphics = Graphics.FromImage(b)
  1025.  
  1026. Dim percent As Integer = CInt((Height - 1) * (_val / _max))
  1027. Dim outerrect As Rectangle = New Rectangle(0, 0, Width - 1, Height - 1)
  1028. Dim innerrect As Rectangle = New Rectangle(4, (Height - percent) + 4, Width - 9, percent - 9)
  1029.  
  1030. MyBase.OnPaint(e)
  1031. g.Clear(BackColor)
  1032. g.SmoothingMode = SmoothingMode.HighQuality
  1033. g.FillPath(New SolidBrush(Color.FromArgb(41, 41, 41)), RoundRect(outerrect, 5))
  1034. g.DrawPath(New Pen(Color.FromArgb(0, 0, 0)), RoundRect(outerrect, 5))
  1035.  
  1036. If percent <> 0 Then
  1037. Try
  1038. g.FillPath(New SolidBrush(Color.FromArgb(128, 128, 128)), RoundRect(innerrect, 7))
  1039. Catch : End Try
  1040. End If
  1041.  
  1042. If _showPercentage Then
  1043. g.DrawString(String.Format("{0}%", _val), New Font("Segoe UI", 8, FontStyle.Bold), New SolidBrush(Color.FromArgb(245, 245, 245)), outerrect, New StringFormat With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  1044. End If
  1045.  
  1046. e.Graphics.DrawImage(b, New Point(0, 0))
  1047. g.Dispose() : b.Dispose()
  1048. End Sub
  1049. End Class
  1050.  
  1051. Public Class FaderHorizontalSeperator : Inherits Control
  1052. Sub New()
  1053. SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  1054. DoubleBuffered = True
  1055. BackColor = Color.Transparent
  1056. Size = New Size(200, 3)
  1057. End Sub
  1058.  
  1059. Protected Overrides Sub OnResize(ByVal e As EventArgs)
  1060. MyBase.OnResize(e)
  1061. Height = 3
  1062. End Sub
  1063.  
  1064. Protected Overrides Sub OnPaint(e As PaintEventArgs)
  1065. Dim b As Bitmap = New Bitmap(Width, Height)
  1066. Dim g As Graphics = Graphics.FromImage(b)
  1067.  
  1068. Dim rect As Rectangle = New Rectangle(0, 0, Width - 1, Height - 1)
  1069.  
  1070. MyBase.OnPaint(e)
  1071. g.Clear(BackColor)
  1072. g.SmoothingMode = SmoothingMode.HighQuality
  1073. g.InterpolationMode = InterpolationMode.HighQualityBicubic
  1074. g.FillPath(New SolidBrush(Color.FromArgb(41, 41, 41)), RoundRect(rect, 2))
  1075. g.DrawPath(New Pen(Color.FromArgb(0, 0, 0)), RoundRect(rect, 2))
  1076.  
  1077. e.Graphics.DrawImage(b, New Point(0, 0))
  1078. g.Dispose() : b.Dispose()
  1079. End Sub
  1080. End Class
  1081.  
  1082. Public Class FaderVerticalSeperator : Inherits Control
  1083. Sub New()
  1084. SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  1085. DoubleBuffered = True
  1086. BackColor = Color.Transparent
  1087. Size = New Size(3, 200)
  1088. End Sub
  1089.  
  1090. Protected Overrides Sub OnResize(ByVal e As EventArgs)
  1091. MyBase.OnResize(e)
  1092. Width = 3
  1093. End Sub
  1094.  
  1095. Protected Overrides Sub OnPaint(e As PaintEventArgs)
  1096. Dim b As Bitmap = New Bitmap(Width, Height)
  1097. Dim g As Graphics = Graphics.FromImage(b)
  1098.  
  1099. Dim rect As Rectangle = New Rectangle(0, 0, Width - 1, Height - 1)
  1100.  
  1101. MyBase.OnPaint(e)
  1102. g.Clear(BackColor)
  1103. g.SmoothingMode = SmoothingMode.HighQuality
  1104. g.InterpolationMode = InterpolationMode.HighQualityBicubic
  1105. g.FillPath(New SolidBrush(Color.FromArgb(41, 41, 41)), RoundRect(rect, 2))
  1106. g.DrawPath(New Pen(Color.FromArgb(0, 0, 0)), RoundRect(rect, 2))
  1107.  
  1108. e.Graphics.DrawImage(b, New Point(0, 0))
  1109. g.Dispose() : b.Dispose()
  1110. End Sub
  1111. End Class
  1112.  
  1113. Public Class FaderProgressButton : Inherits Control
  1114. Dim _state As MouseState
  1115. Private _val As Integer
  1116. Public Property Value() As Integer
  1117. Get
  1118. Return _val
  1119. End Get
  1120. Set(ByVal v As Integer)
  1121. If v > _max Then
  1122. _val = _max
  1123. ElseIf v < 0 Then
  1124. _val = 0
  1125. Else
  1126. _val = v
  1127. End If
  1128. Invalidate()
  1129. End Set
  1130. End Property
  1131.  
  1132. Private _max As Integer
  1133. Public Property Maximum() As Integer
  1134. Get
  1135. Return _max
  1136. End Get
  1137. Set(ByVal v As Integer)
  1138. If v < 1 Then
  1139. _max = 1
  1140. Else
  1141. _max = v
  1142. End If
  1143. If v < _val Then
  1144. _val = _max
  1145. End If
  1146. Invalidate()
  1147. End Set
  1148. End Property
  1149.  
  1150. Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  1151. MyBase.OnMouseDown(e)
  1152. _state = MouseState.Down
  1153. Invalidate()
  1154. End Sub
  1155.  
  1156. Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  1157. MyBase.OnMouseUp(e)
  1158. _state = MouseState.Over
  1159. Invalidate()
  1160. End Sub
  1161.  
  1162. Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
  1163. MyBase.OnMouseEnter(e)
  1164. _state = MouseState.Over
  1165. Invalidate()
  1166. End Sub
  1167.  
  1168. Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
  1169. MyBase.OnMouseLeave(e)
  1170. _state = MouseState.None
  1171. Invalidate()
  1172. End Sub
  1173. Sub New()
  1174. MyBase.New()
  1175. SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  1176. BackColor = Color.Transparent
  1177. Size = New Size(160, 50)
  1178. DoubleBuffered = True
  1179. _max = 100
  1180. End Sub
  1181.  
  1182. Protected Overrides Sub OnPaint(e As Windows.Forms.PaintEventArgs)
  1183. Dim b As Bitmap = New Bitmap(Width, Height)
  1184. Dim g As Graphics = Graphics.FromImage(b)
  1185.  
  1186. Dim percent As Integer = CInt((Width - 1) * (_val / _max))
  1187. Dim bodyrect As Rectangle = New Rectangle(1, 5, Width - 3, Height - 11)
  1188. Dim topborderrect As Rectangle = New Rectangle(0, 0, Width - 1, 5)
  1189. Dim bottomborderrect As Rectangle = New Rectangle(0, Height - 6, Width - 1, 5)
  1190. Dim progressinnerrect As Rectangle = New Rectangle(1, 5, percent - 3, Height - 11)
  1191. Dim btnfont As New Font("Segoe UI", 11, FontStyle.Bold)
  1192.  
  1193. MyBase.OnPaint(e)
  1194. g.SmoothingMode = SmoothingMode.HighQuality
  1195. g.InterpolationMode = InterpolationMode.HighQualityBicubic
  1196. g.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
  1197. g.Clear(BackColor)
  1198.  
  1199. Dim bodyrectgb As New LinearGradientBrush(bodyrect, Color.FromArgb(61, 61, 61), Color.FromArgb(41, 41, 41), LinearGradientMode.Vertical)
  1200. g.FillRectangle(bodyrectgb, bodyrect)
  1201. g.DrawRectangle(New Pen(Brushes.Black), bodyrect)
  1202.  
  1203. Dim topborderrectgb As New LinearGradientBrush(topborderrect, Color.FromArgb(53, 53, 53), Color.FromArgb(62, 62, 62), LinearGradientMode.Vertical)
  1204. g.FillRectangle(topborderrectgb, topborderrect)
  1205. g.DrawRectangle(New Pen(Brushes.Black), topborderrect)
  1206.  
  1207. Dim bottomborderrectgb As New LinearGradientBrush(bottomborderrect, Color.FromArgb(53, 53, 53), Color.FromArgb(62, 62, 62), LinearGradientMode.Vertical)
  1208. g.FillRectangle(bottomborderrectgb, bottomborderrect)
  1209. g.DrawRectangle(New Pen(Brushes.Black), bottomborderrect)
  1210.  
  1211. Select Case _state
  1212. Case MouseState.None
  1213. Dim bodyrectnonegb As New LinearGradientBrush(bodyrect, Color.FromArgb(61, 61, 61), Color.FromArgb(41, 41, 41), LinearGradientMode.Vertical)
  1214. g.FillRectangle(bodyrectnonegb, bodyrect)
  1215. g.DrawRectangle(New Pen(Brushes.Black), bodyrect)
  1216.  
  1217. Dim topborderrectnonegb As New LinearGradientBrush(topborderrect, Color.FromArgb(53, 53, 53), Color.FromArgb(62, 62, 62), LinearGradientMode.Vertical)
  1218. g.FillRectangle(topborderrectnonegb, topborderrect)
  1219. g.DrawRectangle(New Pen(Brushes.Black), topborderrect)
  1220.  
  1221. Dim bottomborderrectnonegb As New LinearGradientBrush(bottomborderrect, Color.FromArgb(53, 53, 53), Color.FromArgb(62, 62, 62), LinearGradientMode.Vertical)
  1222. g.FillRectangle(bottomborderrectnonegb, bottomborderrect)
  1223. g.DrawRectangle(New Pen(Brushes.Black), bottomborderrect)
  1224.  
  1225. g.DrawString(Text, btnfont, Brushes.White, bodyrect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  1226. Case MouseState.Down
  1227. g.TranslateTransform(1, 1)
  1228. g.DrawString(Text, btnfont, Brushes.White, bodyrect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  1229. Case MouseState.Over
  1230. Dim bodyrectovergb As New LinearGradientBrush(bodyrect, Color.FromArgb(41, 41, 41), Color.FromArgb(61, 61, 61), LinearGradientMode.Vertical)
  1231. g.FillRectangle(bodyrectovergb, bodyrect)
  1232. g.DrawRectangle(New Pen(Brushes.Black), bodyrect)
  1233. g.DrawString(Text, btnfont, Brushes.White, bodyrect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  1234. End Select
  1235.  
  1236. If percent <> 0 Then
  1237. Dim progressgb As New LinearGradientBrush(progressinnerrect, Color.FromArgb(61, 61, 61), Color.FromArgb(41, 41, 41), 180S)
  1238. g.FillPath(progressgb, RoundRect(progressinnerrect, 3))
  1239. g.DrawPath(New Pen(Color.FromArgb(0, 0, 0)), RoundRect(progressinnerrect, 3))
  1240. g.DrawString(Text, btnfont, Brushes.White, bodyrect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  1241. End If
  1242.  
  1243. e.Graphics.DrawImage(b, New Point(0, 0))
  1244. g.Dispose() : b.Dispose()
  1245. End Sub
  1246. End Class
  1247.  
  1248. Public Class FaderTabControl : Inherits TabControl
  1249.  
  1250. Sub New()
  1251. SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  1252. BackColor = Color.Transparent
  1253. DoubleBuffered = True
  1254. ItemSize = New Size(100, 35)
  1255. End Sub
  1256.  
  1257. Protected Overrides Sub OnPaint(ByVal e As Windows.Forms.PaintEventArgs)
  1258. Dim b As Bitmap = New Bitmap(Width, Height)
  1259. Dim g As Graphics = Graphics.FromImage(b)
  1260.  
  1261. Dim rect As Rectangle = New Rectangle(0, 0, Width - 1, Height - 1)
  1262. Dim selectedtabgb As New LinearGradientBrush(rect, Color.FromArgb(61, 61, 61), Color.FromArgb(41, 41, 41), 90S)
  1263. Dim nonselectedtabgb As New LinearGradientBrush(rect, Color.FromArgb(81, 81, 81), Color.FromArgb(61, 61, 61), 90S)
  1264.  
  1265. Try : SelectedTab.BackColor = Color.FromArgb(61, 61, 61) : Catch : End Try
  1266.  
  1267. MyBase.OnPaint(e)
  1268. g.Clear(BackColor)
  1269. g.FillRectangle(selectedtabgb, rect)
  1270. g.DrawRectangle(New Pen(Brushes.Black, 2), rect)
  1271.  
  1272. For i = 0 To TabCount - 1
  1273. Dim textRectangle As Rectangle = New Rectangle(New Point(GetTabRect(i).Location.X + 1, GetTabRect(i).Location.Y), New Size(GetTabRect(i).Width - 1, GetTabRect(i).Height))
  1274. If i = SelectedIndex Then
  1275. Dim tabrect As Rectangle = New Rectangle(New Point(GetTabRect(i).Location.X + 1, GetTabRect(i).Location.Y + 1), New Size(GetTabRect(i).Width - 1, GetTabRect(i).Height - 2))
  1276. g.FillPath(selectedtabgb, RoundRect(tabrect, 2))
  1277. g.DrawPath(New Pen(Brushes.Black), RoundRect(tabrect, 2))
  1278. g.DrawString(TabPages(i).Text, New Font("Segoe UI", 10, FontStyle.Bold), New SolidBrush(Color.FromArgb(245, 245, 245)), textRectangle, New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
  1279. Else
  1280. Dim tabrect As Rectangle = New Rectangle(New Point(GetTabRect(i).Location.X + 1, GetTabRect(i).Location.Y + 4), New Size(GetTabRect(i).Width - 1, GetTabRect(i).Height - 5))
  1281. g.FillPath(nonselectedtabgb, RoundRect(tabrect, 2))
  1282. g.DrawPath(New Pen(Brushes.Black), RoundRect(tabrect, 2))
  1283. g.DrawString(TabPages(i).Text, New Font("Segoe UI", 10, FontStyle.Regular), New SolidBrush(Color.FromArgb(245, 245, 245)), textRectangle, New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
  1284. End If
  1285. Next
  1286.  
  1287. e.Graphics.DrawImage(b, New Point(0, 0))
  1288. g.Dispose() : b.Dispose()
  1289. End Sub
  1290. End Class
  1291.  
  1292. Public Class FaderVerticalTabControl : Inherits TabControl
  1293.  
  1294. Sub New()
  1295. SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  1296. BackColor = Color.Transparent
  1297. DoubleBuffered = True
  1298. SizeMode = TabSizeMode.Fixed
  1299. Alignment = TabAlignment.Left
  1300. ItemSize = New Size(35, 100)
  1301. End Sub
  1302.  
  1303. Protected Overrides Sub OnPaint(ByVal e As Windows.Forms.PaintEventArgs)
  1304. Dim b As Bitmap = New Bitmap(Width, Height)
  1305. Dim g As Graphics = Graphics.FromImage(b)
  1306.  
  1307. Dim rect As Rectangle = New Rectangle(0, 0, Width - 1, Height - 1)
  1308. Dim selectedtabgb As New LinearGradientBrush(rect, Color.FromArgb(61, 61, 61), Color.FromArgb(41, 41, 41), 90S)
  1309. Dim nonselectedtabgb As New LinearGradientBrush(rect, Color.FromArgb(81, 81, 81), Color.FromArgb(61, 61, 61), 90S)
  1310.  
  1311. Try : SelectedTab.BackColor = Color.FromArgb(61, 61, 61) : Catch : End Try
  1312.  
  1313. MyBase.OnPaint(e)
  1314. g.Clear(BackColor)
  1315. g.FillRectangle(selectedtabgb, rect)
  1316. g.DrawRectangle(New Pen(Brushes.Black, 2), rect)
  1317.  
  1318. For i = 0 To TabCount - 1
  1319. Dim textRectangle As Rectangle = New Rectangle(New Point(GetTabRect(i).Location.X + 1, GetTabRect(i).Location.Y), New Size(GetTabRect(i).Width - 1, GetTabRect(i).Height))
  1320. If i = SelectedIndex Then
  1321. Dim tabrect As Rectangle = New Rectangle(New Point(GetTabRect(i).Location.X + 1, GetTabRect(i).Location.Y + 1), New Size(GetTabRect(i).Width - 1, GetTabRect(i).Height - 1))
  1322. g.FillPath(selectedtabgb, RoundRect(tabrect, 2))
  1323. g.DrawPath(New Pen(Brushes.Black), RoundRect(tabrect, 2))
  1324. g.DrawString(TabPages(i).Text, New Font("Segoe UI", 10, FontStyle.Bold), New SolidBrush(Color.FromArgb(245, 245, 245)), textRectangle, New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
  1325. Else
  1326. Dim tabrect As Rectangle = New Rectangle(New Point(GetTabRect(i).Location.X + 4, GetTabRect(i).Location.Y + 1), New Size(GetTabRect(i).Width - 4, GetTabRect(i).Height - 1))
  1327. g.FillPath(nonselectedtabgb, RoundRect(tabrect, 2))
  1328. g.DrawPath(New Pen(Brushes.Black), RoundRect(tabrect, 2))
  1329. g.DrawString(TabPages(i).Text, New Font("Segoe UI", 10, FontStyle.Regular), New SolidBrush(Color.FromArgb(245, 245, 245)), textRectangle, New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
  1330. End If
  1331. Next
  1332.  
  1333. e.Graphics.DrawImage(b, New Point(0, 0))
  1334. g.Dispose() : b.Dispose()
  1335. End Sub
  1336. End Class
  1337.  
  1338. Public Class FaderTextBox : Inherits Control
  1339. Dim WithEvents _tb As New TextBox
  1340. Private _allowpassword As Boolean = False
  1341. Public Shadows Property UseSystemPasswordChar() As Boolean
  1342. Get
  1343. Return _allowpassword
  1344. End Get
  1345. Set(ByVal value As Boolean)
  1346. _tb.UseSystemPasswordChar = UseSystemPasswordChar
  1347. _allowpassword = value
  1348. Invalidate()
  1349. End Set
  1350. End Property
  1351.  
  1352. Private _maxChars As Integer = 32767
  1353. Public Shadows Property MaxLength() As Integer
  1354. Get
  1355. Return _maxChars
  1356. End Get
  1357. Set(ByVal value As Integer)
  1358. _maxChars = value
  1359. _tb.MaxLength = MaxLength
  1360. Invalidate()
  1361. End Set
  1362. End Property
  1363.  
  1364. Private _textAlignment As HorizontalAlignment
  1365. Public Shadows Property TextAlign() As HorizontalAlignment
  1366. Get
  1367. Return _textAlignment
  1368. End Get
  1369. Set(ByVal value As HorizontalAlignment)
  1370. _textAlignment = value
  1371. Invalidate()
  1372. End Set
  1373. End Property
  1374.  
  1375. Private _multiLine As Boolean = False
  1376. Public Shadows Property MultiLine() As Boolean
  1377. Get
  1378. Return _multiLine
  1379. End Get
  1380. Set(ByVal value As Boolean)
  1381. _multiLine = value
  1382. _tb.Multiline = value
  1383. OnResize(EventArgs.Empty)
  1384. Invalidate()
  1385. End Set
  1386. End Property
  1387.  
  1388. Private _readOnly As Boolean = False
  1389. Public Shadows Property [ReadOnly]() As Boolean
  1390. Get
  1391. Return _readOnly
  1392. End Get
  1393. Set(ByVal value As Boolean)
  1394. _readOnly = value
  1395. If _tb IsNot Nothing Then
  1396. _tb.ReadOnly = value
  1397. End If
  1398. End Set
  1399. End Property
  1400.  
  1401. Protected Overrides Sub OnTextChanged(ByVal e As EventArgs)
  1402. MyBase.OnTextChanged(e)
  1403. Invalidate()
  1404. End Sub
  1405.  
  1406. Protected Overrides Sub OnBackColorChanged(ByVal e As EventArgs)
  1407. MyBase.OnBackColorChanged(e)
  1408. Invalidate()
  1409. End Sub
  1410.  
  1411. Protected Overrides Sub OnForeColorChanged(ByVal e As EventArgs)
  1412. MyBase.OnForeColorChanged(e)
  1413. _tb.ForeColor = ForeColor
  1414. Invalidate()
  1415. End Sub
  1416.  
  1417. Protected Overrides Sub OnFontChanged(ByVal e As EventArgs)
  1418. MyBase.OnFontChanged(e)
  1419. _tb.Font = Font
  1420. End Sub
  1421.  
  1422. Protected Overrides Sub OnGotFocus(ByVal e As EventArgs)
  1423. MyBase.OnGotFocus(e)
  1424. _tb.Focus()
  1425. End Sub
  1426.  
  1427. Private Sub TextChangeTb() Handles _tb.TextChanged
  1428. Text = _tb.Text
  1429. End Sub
  1430.  
  1431. Private Sub TextChng() Handles MyBase.TextChanged
  1432. _tb.Text = Text
  1433. End Sub
  1434.  
  1435. Public Sub NewTextBox()
  1436. With _tb
  1437. .Text = String.Empty
  1438. .BackColor = Color.FromArgb(61, 61, 61)
  1439. .ForeColor = ForeColor
  1440. .TextAlign = HorizontalAlignment.Center
  1441. .BorderStyle = BorderStyle.None
  1442. .Location = New Point(3, 3)
  1443. .Font = New Font("Segoe UI", 11, FontStyle.Regular)
  1444. .Size = New Size(Width - 3, Height - 3)
  1445. .UseSystemPasswordChar = UseSystemPasswordChar
  1446. End With
  1447. End Sub
  1448.  
  1449. Sub New()
  1450. MyBase.New()
  1451. NewTextBox()
  1452. Controls.Add(_tb)
  1453. SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  1454. DoubleBuffered = True
  1455. BackColor = Color.FromArgb(61, 61, 61)
  1456. ForeColor = Color.FromArgb(245, 245, 245)
  1457. Font = New Font("Segoe UI", 11, FontStyle.Regular)
  1458. Size = New Size(200, 30)
  1459. End Sub
  1460.  
  1461. Protected Overrides Sub OnPaint(ByVal e As Windows.Forms.PaintEventArgs)
  1462. Dim b As Bitmap = New Bitmap(Width, Height)
  1463. Dim g As Graphics = Graphics.FromImage(b)
  1464.  
  1465. Dim rect As Rectangle = New Rectangle(0, 0, Width - 1, Height - 1)
  1466.  
  1467. MyBase.OnPaint(e)
  1468. g.SmoothingMode = SmoothingMode.HighQuality
  1469. g.InterpolationMode = InterpolationMode.HighQualityBicubic
  1470. g.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
  1471.  
  1472. With _tb
  1473. .TextAlign = TextAlign
  1474. .UseSystemPasswordChar = UseSystemPasswordChar
  1475. End With
  1476.  
  1477. g.FillPath(New SolidBrush(Color.FromArgb(61, 61, 61)), RoundRect(rect, 1))
  1478. g.DrawPath(New Pen(Brushes.Black, 2), RoundRect(rect, 1))
  1479.  
  1480. e.Graphics.DrawImage(b, New Point(0, 0))
  1481. g.Dispose() : b.Dispose()
  1482. End Sub
  1483.  
  1484. Protected Overrides Sub OnResize(e As EventArgs)
  1485. MyBase.OnResize(e)
  1486. If Not MultiLine Then
  1487. Dim tbheight As Integer = _tb.Height
  1488. _tb.Location = New Point(10, CType(((Height / 2) - (tbheight / 2) - 1), Integer))
  1489. _tb.Size = New Size(Width - 20, tbheight)
  1490. Else
  1491. _tb.Location = New Point(10, 10)
  1492. _tb.Size = New Size(Width - 20, Height - 20)
  1493. End If
  1494. End Sub
  1495. End Class
  1496.  
  1497. Public Class FaderComboBox : Inherits ComboBox
  1498. Private _startIndex As Integer = 0
  1499. Private Property StartIndex As Integer
  1500. Get
  1501. Return _startIndex
  1502. End Get
  1503. Set(ByVal value As Integer)
  1504. _startIndex = value
  1505. Try
  1506. SelectedIndex = value
  1507. Catch
  1508. End Try
  1509. Invalidate()
  1510. End Set
  1511. End Property
  1512.  
  1513. Sub ReplaceItem(ByVal sender As System.Object, ByVal e As Windows.Forms.DrawItemEventArgs) Handles Me.DrawItem
  1514. e.DrawBackground()
  1515. Dim sitemrect As New LinearGradientBrush(New Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height), Color.FromArgb(61, 61, 61), Color.FromArgb(41, 41, 41), 90S)
  1516. Dim itemrect As New LinearGradientBrush(New Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height), Color.FromArgb(81, 81, 81), Color.FromArgb(61, 61, 61), 90S)
  1517.  
  1518. Try
  1519. If (e.State And DrawItemState.Selected) = DrawItemState.Selected Then
  1520. e.Graphics.FillPath(sitemrect, RoundRect(New Rectangle(e.Bounds.X + 3, e.Bounds.Y, e.Bounds.Width - 7, e.Bounds.Height), 2))
  1521. e.Graphics.DrawPath(New Pen(Brushes.Black), RoundRect(New Rectangle(e.Bounds.X + 3, e.Bounds.Y, e.Bounds.Width - 7, e.Bounds.Height), 2))
  1522. Else
  1523. e.Graphics.FillPath(itemrect, RoundRect(New Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height), 2))
  1524. e.Graphics.DrawPath(New Pen(Brushes.Black), RoundRect(New Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height), 2))
  1525. End If
  1526. e.Graphics.DrawString(GetItemText(Items(e.Index)), e.Font, New SolidBrush(Color.FromArgb(245, 245, 245)), New Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  1527. Catch : End Try
  1528. End Sub
  1529.  
  1530. Sub New()
  1531. MyBase.New()
  1532. SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  1533. DrawMode = Windows.Forms.DrawMode.OwnerDrawFixed
  1534. BackColor = Color.Transparent
  1535. DropDownStyle = ComboBoxStyle.DropDownList
  1536. StartIndex = 0
  1537. ItemHeight = 25
  1538. DoubleBuffered = True
  1539. Width = 200
  1540. End Sub
  1541.  
  1542. Protected Overrides Sub OnResize(e As EventArgs)
  1543. MyBase.OnResize(e)
  1544. Height = 20
  1545. End Sub
  1546.  
  1547. Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  1548. Dim b As Bitmap = New Bitmap(Width, Height)
  1549. Dim g As Graphics = Graphics.FromImage(b)
  1550.  
  1551. Dim rect As Rectangle = New Rectangle(0, 0, Width - 1, Height - 1)
  1552.  
  1553. MyBase.OnPaint(e)
  1554. g.Clear(BackColor)
  1555.  
  1556. Dim rectgb As New LinearGradientBrush(rect, Color.FromArgb(61, 61, 61), Color.FromArgb(41, 41, 41), 90S)
  1557. g.FillPath(rectgb, RoundRect(rect, 3))
  1558. g.DrawPath(New Pen(Brushes.Black, 2), RoundRect(rect, 3))
  1559. g.SetClip(RoundRect(rect, 3))
  1560. g.FillPath(rectgb, RoundRect(rect, 3))
  1561. g.DrawPath(New Pen(Brushes.Black, 2), RoundRect(rect, 3))
  1562. g.ResetClip()
  1563.  
  1564. g.DrawLine(New Pen(Color.FromArgb(245, 245, 245)), Width - 9, 10, Width - 22, 10)
  1565. g.DrawLine(New Pen(Color.FromArgb(245, 245, 245)), Width - 9, 11, Width - 22, 11)
  1566. g.DrawLine(New Pen(Color.FromArgb(245, 245, 245)), Width - 9, 15, Width - 22, 15)
  1567. g.DrawLine(New Pen(Color.FromArgb(245, 245, 245)), Width - 9, 16, Width - 22, 16)
  1568. g.DrawLine(New Pen(Color.FromArgb(245, 245, 245)), Width - 9, 20, Width - 22, 20)
  1569. g.DrawLine(New Pen(Color.FromArgb(245, 245, 245)), Width - 9, 21, Width - 22, 21)
  1570. g.DrawLine(New Pen(Color.FromArgb(245, 245, 245)), New Point(Width - 29, 7), New Point(Width - 29, Height - 7))
  1571. g.DrawLine(New Pen(Color.FromArgb(245, 245, 245)), New Point(Width - 30, 7), New Point(Width - 30, Height - 7))
  1572.  
  1573. Try
  1574. g.DrawString(Text, New Font("Segoe UI", 11, FontStyle.Bold), New SolidBrush(Color.FromArgb(245, 245, 245)), rect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  1575. Catch : End Try
  1576.  
  1577. e.Graphics.DrawImage(b, New Point(0, 0))
  1578. g.Dispose() : b.Dispose()
  1579. End Sub
  1580. End Class
  1581.  
  1582. Public Class FaderListBox : Inherits ListBox
  1583. Sub New()
  1584. SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or _
  1585. ControlStyles.SupportsTransparentBackColor, True)
  1586. BackColor = Color.Transparent
  1587. DoubleBuffered = True
  1588. DrawMode = Windows.Forms.DrawMode.OwnerDrawFixed
  1589. ForeColor = Color.White
  1590. BackColor = Color.FromArgb(61, 61, 61)
  1591. BorderStyle = Windows.Forms.BorderStyle.None
  1592. ItemHeight = 20
  1593. End Sub
  1594. Protected Overrides Sub OnPaint(e As PaintEventArgs)
  1595. Dim b As Bitmap = New Bitmap(Width, Height)
  1596. Dim g As Graphics = Graphics.FromImage(b)
  1597.  
  1598. Dim rect As Rectangle = New Rectangle(0, 0, Width - 1, Height - 1)
  1599.  
  1600. MyBase.OnPaint(e)
  1601. g.Clear(Color.Transparent)
  1602. g.FillPath(New SolidBrush(Color.FromArgb(61, 61, 61)), RoundRect(rect, 3))
  1603. g.DrawPath(New Pen(Color.Black, 2), RoundRect(rect, 3))
  1604.  
  1605. e.Graphics.DrawImage(b, New Point(0, 0))
  1606. g.Dispose() : b.Dispose()
  1607. End Sub
  1608. Protected Overrides Sub OnDrawItem(e As DrawItemEventArgs)
  1609. Dim b As Bitmap = New Bitmap(Width, Height)
  1610. Dim g As Graphics = Graphics.FromImage(b)
  1611.  
  1612. g.TextRenderingHint = TextRenderingHint.AntiAlias
  1613. g.SmoothingMode = SmoothingMode.HighQuality
  1614.  
  1615. g.SetClip(RoundRect(New Rectangle(0, 0, Width, Height), 3))
  1616. g.Clear(Color.Transparent)
  1617. g.FillRectangle(New SolidBrush(BackColor), New Rectangle(e.Bounds.X, e.Bounds.Y - 1, e.Bounds.Width, e.Bounds.Height + 3))
  1618.  
  1619. If e.State.ToString().Contains("Selected,") Then
  1620. Dim selectgb As New LinearGradientBrush(New Rectangle(e.Bounds.X, e.Bounds.Y + 1, e.Bounds.Width, e.Bounds.Height), Color.FromArgb(61, 61, 61), Color.FromArgb(41, 41, 31), 90S)
  1621. g.FillRectangle(selectgb, New Rectangle(e.Bounds.X, e.Bounds.Y + 1, e.Bounds.Width, e.Bounds.Height))
  1622. g.DrawRectangle(New Pen(Color.FromArgb(128, 128, 128)), New Rectangle(e.Bounds.X, e.Bounds.Y + 1, e.Bounds.Width, e.Bounds.Height))
  1623. Try
  1624. g.DrawString(Items(e.Index).ToString(), New Font("Segoe UI", 10, FontStyle.Bold), New SolidBrush(Color.FromArgb(245, 245, 245)), New Rectangle(e.Bounds.X + 3, e.Bounds.Y + 1, e.Bounds.Width, e.Bounds.Height), New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
  1625. Catch : End Try
  1626. Else
  1627. Dim nonselectgb As New LinearGradientBrush(New Rectangle(e.Bounds.X, e.Bounds.Y + 1, e.Bounds.Width, e.Bounds.Height), Color.FromArgb(81, 81, 81), Color.FromArgb(61, 61, 61), 90S)
  1628. g.FillRectangle(nonselectgb, e.Bounds)
  1629. Try
  1630. g.DrawString(Items(e.Index).ToString(), New Font("Segoe UI", 10, FontStyle.Regular), New SolidBrush(Color.FromArgb(245, 245, 245)), New Rectangle(e.Bounds.X + 3, e.Bounds.Y + 1, e.Bounds.Width, e.Bounds.Height), New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
  1631. Catch : End Try
  1632. End If
  1633.  
  1634. g.DrawPath(New Pen(Color.FromArgb(61, 61, 61), 2), RoundRect(New Rectangle(0, 0, Width - 1, Height - 1), 1))
  1635.  
  1636. e.Graphics.DrawImage(b, New Point(0, 0))
  1637. g.Dispose() : b.Dispose()
  1638. End Sub
  1639. End Class
  1640.  
  1641. Public Class FaderAlertBox : Inherits Control
  1642. Dim WithEvents _mytimer As Windows.Forms.Timer
  1643.  
  1644. Enum AlertStyle
  1645. [Info]
  1646. [Success]
  1647. [Error]
  1648. End Enum
  1649.  
  1650. Private _style As AlertStyle
  1651. Public Property Style As AlertStyle
  1652. Get
  1653. Return _style
  1654. End Get
  1655. Set(value As AlertStyle)
  1656. _style = value
  1657. End Set
  1658. End Property
  1659.  
  1660. Private _text As String
  1661. Overrides Property Text As String
  1662. Get
  1663. Return MyBase.Text
  1664. End Get
  1665. Set(ByVal value As String)
  1666. MyBase.Text = value
  1667. If _text IsNot Nothing Then
  1668. _text = value
  1669. End If
  1670. End Set
  1671. End Property
  1672.  
  1673. Shadows Property Visible As Boolean
  1674. Get
  1675. Return MyBase.Visible = False
  1676. End Get
  1677. Set(value As Boolean)
  1678. MyBase.Visible = value
  1679. End Set
  1680. End Property
  1681.  
  1682. Protected Overrides Sub OnTextChanged(e As EventArgs)
  1683. MyBase.OnTextChanged(e) : Invalidate()
  1684. End Sub
  1685.  
  1686. Public Sub ShowAlertBox(mystyle As AlertStyle, str As String, interval As Integer)
  1687. _style = mystyle
  1688. Text = str
  1689. Visible = True
  1690. _mytimer.Interval = interval
  1691. _mytimer.Enabled = True
  1692. End Sub
  1693.  
  1694. Sub New()
  1695. MyBase.New()
  1696. SetStyle(ControlStyles.UserPaint Or ControlStyles.ResizeRedraw Or ControlStyles.SupportsTransparentBackColor, True)
  1697. BackColor = Color.Transparent
  1698. Size = New Size(500, 30)
  1699. DoubleBuffered = True
  1700. _mytimer = New Timer()
  1701. End Sub
  1702.  
  1703. Protected Overrides Sub OnPaint(e As PaintEventArgs)
  1704. Dim b As Bitmap = New Bitmap(Width, Height)
  1705. Dim g As Graphics = Graphics.FromImage(b)
  1706.  
  1707. Dim rect As New Rectangle(0, 0, Width - 1, Height - 1)
  1708. Dim textrect As New Rectangle(20, 5, Width - 21, Height - 11)
  1709. Dim logorect As New Rectangle(7, 7, 20, 20)
  1710. Dim logocirclerect As New Rectangle(5, 5, 20, 20)
  1711.  
  1712. g.TextRenderingHint = TextRenderingHint.AntiAlias
  1713. g.SmoothingMode = SmoothingMode.HighQuality
  1714. g.Clear(Color.Transparent)
  1715.  
  1716. MyBase.OnPaint(e)
  1717. Select Case _style
  1718. Case AlertStyle.Success
  1719. g.FillRectangle(New SolidBrush(Color.FromArgb(30, 0, 255, 0)), rect)
  1720. g.DrawRectangle(New Pen(Color.FromArgb(0, 0, 0)), rect)
  1721. g.DrawString(Text, New Font("Segoe UI", 11, FontStyle.Regular), New SolidBrush(Color.FromArgb(245, 245, 245)), textrect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  1722. g.DrawString("ü", New Font("Wingdings", 14), New SolidBrush(Color.FromArgb(245, 245, 245)), logorect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  1723. Case AlertStyle.Error
  1724. g.FillRectangle(New SolidBrush(Color.FromArgb(30, 255, 0, 0)), rect)
  1725. g.DrawRectangle(New Pen(Color.FromArgb(0, 0, 0)), rect)
  1726. g.DrawString(Text, New Font("Segoe UI", 11, FontStyle.Regular), New SolidBrush(Color.FromArgb(245, 245, 245)), textrect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  1727. g.DrawString("r", New Font("Marlett", 10), New SolidBrush(Color.FromArgb(245, 245, 245)), logorect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  1728. Case AlertStyle.Info
  1729. g.FillRectangle(New SolidBrush(Color.FromArgb(30, 0, 0, 255)), rect)
  1730. g.DrawRectangle(New Pen(Color.FromArgb(0, 0, 0)), rect)
  1731. g.DrawString(Text, New Font("Segoe UI", 11, FontStyle.Regular), New SolidBrush(Color.FromArgb(245, 245, 245)), textrect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  1732. g.DrawString("i", New Font("Segoe UI", 12), New SolidBrush(Color.FromArgb(245, 245, 245)), logorect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  1733. End Select
  1734.  
  1735. g.DrawEllipse(New Pen(Color.FromArgb(255, 255, 255)), logocirclerect)
  1736.  
  1737. e.Graphics.DrawImage(b, New Point(0, 0))
  1738. g.Dispose() : b.Dispose()
  1739. End Sub
  1740.  
  1741. Private Sub MyTimer_Tick(ByVal sender As Object, ByVal e As EventArgs) Handles _mytimer.Tick
  1742. Visible = False
  1743. _mytimer.Enabled = False
  1744. End Sub
  1745. End Class
  1746.  
  1747. Public Class FaderNotifyButton : Inherits Control
  1748. Dim _state As MouseState
  1749.  
  1750. Private _showNotification As Boolean = True
  1751. Public Property ShowNotification As Boolean
  1752. Get
  1753. Return _showNotification
  1754. End Get
  1755. Set(value As Boolean)
  1756. _showNotification = value
  1757. Invalidate()
  1758. End Set
  1759. End Property
  1760.  
  1761. Private _notifyValue As UInteger = 0
  1762. Public Property NotifyValue As UInteger
  1763. Get
  1764. Return _notifyValue
  1765. End Get
  1766. Set(value As UInteger)
  1767. _notifyValue = value
  1768. Invalidate()
  1769. End Set
  1770. End Property
  1771. Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
  1772. MyBase.OnMouseDown(e)
  1773. _state = MouseState.Down
  1774. Invalidate()
  1775. End Sub
  1776.  
  1777. Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
  1778. MyBase.OnMouseUp(e)
  1779. _state = MouseState.Over
  1780. Invalidate()
  1781. End Sub
  1782.  
  1783. Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
  1784. MyBase.OnMouseEnter(e)
  1785. _state = MouseState.Over
  1786. Invalidate()
  1787. End Sub
  1788.  
  1789. Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
  1790. MyBase.OnMouseLeave(e)
  1791. _state = MouseState.None
  1792. Invalidate()
  1793. End Sub
  1794.  
  1795. Sub New()
  1796. SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.OptimizedDoubleBuffer Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  1797. BackColor = Color.Transparent
  1798. DoubleBuffered = True
  1799. Size = New Size(160, 40)
  1800. _state = MouseState.None
  1801. End Sub
  1802.  
  1803. Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  1804. Dim b As Bitmap = New Bitmap(Width, Height)
  1805. Dim g As Graphics = Graphics.FromImage(b)
  1806.  
  1807. Dim rect As Rectangle = New Rectangle(0, 10, Width - 1, Height - 11)
  1808. Dim btnfont As New Font("Segoe UI", 11, FontStyle.Bold)
  1809.  
  1810. MyBase.OnPaint(e)
  1811. g.SmoothingMode = SmoothingMode.HighQuality
  1812. g.InterpolationMode = InterpolationMode.HighQualityBicubic
  1813. g.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
  1814. g.Clear(BackColor)
  1815.  
  1816. Dim rectgb As New LinearGradientBrush(rect, Color.FromArgb(61, 61, 61), Color.FromArgb(41, 41, 41), LinearGradientMode.Vertical)
  1817. g.FillRectangle(rectgb, rect)
  1818. g.DrawRectangle(New Pen(Brushes.Black), rect)
  1819.  
  1820. Select Case _state
  1821. Case MouseState.None
  1822. Dim rectnonegb As New LinearGradientBrush(rect, Color.FromArgb(61, 61, 61), Color.FromArgb(41, 41, 41), LinearGradientMode.Vertical)
  1823. g.FillRectangle(rectnonegb, rect)
  1824. g.DrawRectangle(New Pen(Brushes.Black), rect)
  1825. g.DrawString(Text, btnfont, New SolidBrush(Color.FromArgb(245, 245, 245)), rect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  1826. Case MouseState.Down
  1827. g.TranslateTransform(1, 1)
  1828. g.DrawString(Text, btnfont, New SolidBrush(Color.FromArgb(245, 245, 245)), rect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  1829. Case MouseState.Over
  1830. Dim rectovergb As New LinearGradientBrush(rect, Color.FromArgb(41, 41, 41), Color.FromArgb(61, 61, 61), LinearGradientMode.Vertical)
  1831. g.FillRectangle(rectovergb, rect)
  1832. g.DrawRectangle(New Pen(Brushes.Black), rect)
  1833. g.DrawString(Text, btnfont, New SolidBrush(Color.FromArgb(245, 245, 245)), rect, New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  1834. End Select
  1835.  
  1836. If ShowNotification Then
  1837. Select Case NotifyValue
  1838. Case 0 To 9
  1839. g.FillEllipse(New SolidBrush(Color.FromArgb(81, 81, 81)), New Rectangle(Width - 25, 0, 20, 20))
  1840. g.DrawEllipse(New Pen(Brushes.Black), New Rectangle(Width - 25, 0, 20, 20))
  1841. g.DrawString(NotifyValue.ToString(), btnfont, New SolidBrush(Color.FromArgb(245, 245, 245)), New Rectangle(Width - 25, 0, 20, 20), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  1842. Case 10 To 99
  1843. g.FillEllipse(New SolidBrush(Color.FromArgb(81, 81, 81)), New Rectangle(Width - 45, 0, 40, 20))
  1844. g.DrawEllipse(New Pen(Brushes.Black), New Rectangle(Width - 45, 0, 40, 20))
  1845. g.DrawString(NotifyValue.ToString(), btnfont, New SolidBrush(Color.FromArgb(245, 245, 245)), New Rectangle(Width - 45, 0, 40, 20), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  1846. Case 100 To 999
  1847. g.FillEllipse(New SolidBrush(Color.FromArgb(81, 81, 81)), New Rectangle(Width - 65, 0, 60, 20))
  1848. g.DrawEllipse(New Pen(Brushes.Black), New Rectangle(Width - 65, 0, 60, 20))
  1849. g.DrawString(NotifyValue.ToString(), btnfont, New SolidBrush(Color.FromArgb(245, 245, 245)), New Rectangle(Width - 65, 0, 60, 20), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  1850. End Select
  1851. End If
  1852.  
  1853. e.Graphics.DrawImage(b, New Point(0, 0))
  1854. g.Dispose() : b.Dispose()
  1855. End Sub
  1856. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement