Dev

Strafe Theme [VB] (By Naywyn)

Dev
May 1st, 2017
38,124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 38.39 KB | None | 0 0
  1. ' Strafe Theme.
  2. ' Made by AeroRev9.
  3. ' uid=2203026
  4.  
  5. Imports System.ComponentModel
  6. Imports System.Drawing.Drawing2D
  7. Imports System.Drawing.Text
  8.  
  9. Public Module Helpers
  10.  
  11. Public Enum MouseState As Byte
  12. None = 0
  13. Over = 1
  14. Down = 2
  15. End Enum
  16.  
  17. Public Enum RoundingStyle As Byte
  18. All = 0
  19. Top = 1
  20. Bottom = 2
  21. Left = 3
  22. Right = 4
  23. TopRight = 5
  24. BottomRight = 6
  25. End Enum
  26.  
  27. Public Sub CenterString(G As Graphics, T As String, F As Font, C As Color, R As Rectangle)
  28. Dim TS As SizeF = G.MeasureString(T, F)
  29.  
  30. Using B As New SolidBrush(C)
  31. G.DrawString(T, F, B, New Point(R.X + R.Width / 2 - (TS.Width / 2), R.Y + R.Height / 2 - (TS.Height / 2)))
  32. End Using
  33. End Sub
  34.  
  35. Public Function ColorFromHex(Hex As String) As Color
  36. Return Color.FromArgb(Long.Parse(String.Format("FFFFFFFFFF{0}", Hex.Substring(1)), Globalization.NumberStyles.HexNumber))
  37. End Function
  38.  
  39. Public Function FullRectangle(S As Size, Subtract As Boolean) As Rectangle
  40.  
  41. If Subtract Then
  42. Return New Rectangle(0, 0, S.Width - 1, S.Height - 1)
  43. Else
  44. Return New Rectangle(0, 0, S.Width, S.Height)
  45. End If
  46.  
  47. End Function
  48.  
  49. Public Function RoundRect(ByVal Rect As Rectangle, ByVal Rounding As Integer, Optional ByVal Style As RoundingStyle = RoundingStyle.All) As GraphicsPath
  50.  
  51. Dim GP As New GraphicsPath()
  52. Dim AW As Integer = Rounding * 2
  53.  
  54. GP.StartFigure()
  55.  
  56. If Rounding = 0 Then
  57. GP.AddRectangle(Rect)
  58. GP.CloseAllFigures()
  59. Return GP
  60. End If
  61.  
  62. Select Case Style
  63. Case RoundingStyle.All
  64. GP.AddArc(New Rectangle(Rect.X, Rect.Y, AW, AW), -180, 90)
  65. GP.AddArc(New Rectangle(Rect.Width - AW + Rect.X, Rect.Y, AW, AW), -90, 90)
  66. GP.AddArc(New Rectangle(Rect.Width - AW + Rect.X, Rect.Height - AW + Rect.Y, AW, AW), 0, 90)
  67. GP.AddArc(New Rectangle(Rect.X, Rect.Height - AW + Rect.Y, AW, AW), 90, 90)
  68. Case RoundingStyle.Top
  69. GP.AddArc(New Rectangle(Rect.X, Rect.Y, AW, AW), -180, 90)
  70. GP.AddArc(New Rectangle(Rect.Width - AW + Rect.X, Rect.Y, AW, AW), -90, 90)
  71. GP.AddLine(New Point(Rect.X + Rect.Width, Rect.Y + Rect.Height), New Point(Rect.X, Rect.Y + Rect.Height))
  72. Case RoundingStyle.Bottom
  73. GP.AddLine(New Point(Rect.X, Rect.Y), New Point(Rect.X + Rect.Width, Rect.Y))
  74. GP.AddArc(New Rectangle(Rect.Width - AW + Rect.X, Rect.Height - AW + Rect.Y, AW, AW), 0, 90)
  75. GP.AddArc(New Rectangle(Rect.X, Rect.Height - AW + Rect.Y, AW, AW), 90, 90)
  76. Case RoundingStyle.Left
  77. GP.AddArc(New Rectangle(Rect.X, Rect.Y, AW, AW), -180, 90)
  78. GP.AddLine(New Point(Rect.X + Rect.Width, Rect.Y), New Point(Rect.X + Rect.Width, Rect.Y + Rect.Height))
  79. GP.AddArc(New Rectangle(Rect.X, Rect.Height - AW + Rect.Y, AW, AW), 90, 90)
  80. Case RoundingStyle.Right
  81. GP.AddLine(New Point(Rect.X, Rect.Y + Rect.Height), New Point(Rect.X, Rect.Y))
  82. GP.AddArc(New Rectangle(Rect.Width - AW + Rect.X, Rect.Y, AW, AW), -90, 90)
  83. GP.AddArc(New Rectangle(Rect.Width - AW + Rect.X, Rect.Height - AW + Rect.Y, AW, AW), 0, 90)
  84. Case RoundingStyle.TopRight
  85. GP.AddLine(New Point(Rect.X, Rect.Y + 1), New Point(Rect.X, Rect.Y))
  86. GP.AddArc(New Rectangle(Rect.Width - AW + Rect.X, Rect.Y, AW, AW), -90, 90)
  87. GP.AddLine(New Point(Rect.X + Rect.Width, Rect.Y + Rect.Height - 1), New Point(Rect.X + Rect.Width, Rect.Y + Rect.Height))
  88. GP.AddLine(New Point(Rect.X + 1, Rect.Y + Rect.Height), New Point(Rect.X, Rect.Y + Rect.Height))
  89. Case RoundingStyle.BottomRight
  90. GP.AddLine(New Point(Rect.X, Rect.Y + 1), New Point(Rect.X, Rect.Y))
  91. GP.AddLine(New Point(Rect.X + Rect.Width - 1, Rect.Y), New Point(Rect.X + Rect.Width, Rect.Y))
  92. GP.AddArc(New Rectangle(Rect.Width - AW + Rect.X, Rect.Height - AW + Rect.Y, AW, AW), 0, 90)
  93. GP.AddLine(New Point(Rect.X + 1, Rect.Y + Rect.Height), New Point(Rect.X, Rect.Y + Rect.Height))
  94. End Select
  95.  
  96. GP.CloseAllFigures()
  97.  
  98. Return GP
  99.  
  100. End Function
  101.  
  102. End Module
  103.  
  104. Namespace Base
  105.  
  106. Public MustInherit Class LeftTabControl
  107. Inherits TabControl
  108.  
  109. Public BaseRect As Rectangle
  110. Public OverRect As Rectangle
  111. Public ItemWidth As Integer = 180
  112.  
  113. Private _OverIndex As Integer = -1
  114.  
  115. Public ReadOnly Property Hovering As Boolean
  116. Get
  117. Return Not OverIndex = -1
  118. End Get
  119. End Property
  120.  
  121. Public Property OverIndex As Integer
  122. Get
  123. Return _OverIndex
  124. End Get
  125. Set(value As Integer)
  126. _OverIndex = value
  127.  
  128. If Not _OverIndex = -1 Then
  129. OverRect = New Rectangle(GetTabRect(OverIndex).X, GetTabRect(OverIndex).Y, GetTabRect(OverIndex).Width, GetTabRect(OverIndex).Height)
  130. End If
  131.  
  132. Invalidate()
  133. End Set
  134. End Property
  135.  
  136. Protected Overrides Sub OnCreateControl()
  137. MyBase.OnCreateControl()
  138. SetStyle(ControlStyles.UserPaint, True)
  139. End Sub
  140.  
  141. Protected Overrides Sub OnControlAdded(e As ControlEventArgs)
  142. MyBase.OnControlAdded(e)
  143. e.Control.BackColor = Color.White
  144. e.Control.ForeColor = ColorFromHex("#72778D")
  145. e.Control.Font = New Font("Segoe UI", 9)
  146. End Sub
  147.  
  148. Sub New()
  149. DoubleBuffered = True
  150. Alignment = TabAlignment.Left
  151. ItemSize = New Size(40, ItemWidth)
  152. SizeMode = TabSizeMode.Fixed
  153. Font = New Font("Segoe UI", 9)
  154. End Sub
  155.  
  156. Protected Overrides Sub OnMouseMove(e As MouseEventArgs)
  157.  
  158. For I As Integer = 0 To TabPages.Count - 1
  159. If GetTabRect(I).Contains(e.Location) And Not SelectedIndex = I Then
  160. OverIndex = I
  161. Exit For
  162. Else
  163. OverIndex = -1
  164. End If
  165. Next
  166.  
  167. MyBase.OnMouseMove(e)
  168.  
  169. End Sub
  170.  
  171. Protected Overrides Sub OnMouseLeave(e As EventArgs)
  172. MyBase.OnMouseLeave(e)
  173. OverIndex = -1
  174. End Sub
  175.  
  176. End Class
  177.  
  178. Public MustInherit Class TopTabControl
  179. Inherits TabControl
  180.  
  181. Public BaseRect As Rectangle
  182. Public OverRect As Rectangle
  183. Public ItemWidth As Integer = 20
  184.  
  185. Private _OverIndex As Integer = -1
  186.  
  187. Public ReadOnly Property Hovering As Boolean
  188. Get
  189. Return Not OverIndex = -1
  190. End Get
  191. End Property
  192.  
  193. Public Property OverIndex As Integer
  194. Get
  195. Return _OverIndex
  196. End Get
  197. Set(value As Integer)
  198. _OverIndex = value
  199.  
  200. If Not _OverIndex = -1 Then
  201. OverRect = New Rectangle(GetTabRect(OverIndex).X, GetTabRect(OverIndex).Y, GetTabRect(OverIndex).Width, GetTabRect(OverIndex).Height)
  202. End If
  203.  
  204. Invalidate()
  205. End Set
  206. End Property
  207.  
  208. Protected Overrides Sub OnCreateControl()
  209. MyBase.OnCreateControl()
  210. SetStyle(ControlStyles.UserPaint, True)
  211. End Sub
  212.  
  213. Protected Overrides Sub OnControlAdded(e As ControlEventArgs)
  214. MyBase.OnControlAdded(e)
  215. e.Control.BackColor = Color.White
  216. e.Control.ForeColor = ColorFromHex("#72778D")
  217. e.Control.Font = New Font("Segoe UI", 9)
  218. End Sub
  219.  
  220. Sub New()
  221. DoubleBuffered = True
  222. Alignment = TabAlignment.Top
  223. ItemSize = New Size(15, 15)
  224. SizeMode = TabSizeMode.Fixed
  225. Font = New Font("Segoe UI", 9)
  226. End Sub
  227.  
  228. Protected Overrides Sub OnMouseMove(e As MouseEventArgs)
  229.  
  230. For I As Integer = 0 To TabPages.Count - 1
  231. If GetTabRect(I).Contains(e.Location) And Not SelectedIndex = I Then
  232. OverIndex = I
  233. Exit For
  234. Else
  235. OverIndex = -1
  236. End If
  237. Next
  238.  
  239. MyBase.OnMouseMove(e)
  240.  
  241. End Sub
  242.  
  243. Protected Overrides Sub OnMouseLeave(e As EventArgs)
  244. MyBase.OnMouseLeave(e)
  245. OverIndex = -1
  246. End Sub
  247.  
  248. End Class
  249.  
  250. Public MustInherit Class CheckControl
  251. Inherits Control
  252.  
  253. Public Event CheckedChanged(sender As Object, e As EventArgs)
  254. Public State As MouseState
  255.  
  256. Private IsEnabled As Boolean
  257. Private IsChecked As Boolean
  258.  
  259. Public Shadows Property Enabled As Boolean
  260. Get
  261. Return EnabledCalc
  262. End Get
  263. Set(value As Boolean)
  264. IsEnabled = value
  265.  
  266. If Enabled Then
  267. Cursor = Cursors.Hand
  268. Else
  269. Cursor = Cursors.Default
  270. End If
  271.  
  272. Invalidate()
  273. End Set
  274. End Property
  275.  
  276. <DisplayName("Enabled")>
  277. Public Property EnabledCalc As Boolean
  278. Get
  279. Return IsEnabled
  280. End Get
  281. Set(value As Boolean)
  282. Enabled = value
  283. Invalidate()
  284. End Set
  285. End Property
  286.  
  287. Public Property Checked As Boolean
  288. Get
  289. Return IsChecked
  290. End Get
  291. Set(value As Boolean)
  292. IsChecked = value
  293. Invalidate()
  294. End Set
  295. End Property
  296.  
  297. Sub New()
  298. Enabled = True
  299. DoubleBuffered = True
  300. End Sub
  301.  
  302. Protected Overrides Sub OnMouseEnter(e As EventArgs)
  303. MyBase.OnMouseEnter(e)
  304. State = MouseState.Over : Invalidate()
  305. End Sub
  306.  
  307. Protected Overrides Sub OnMouseLeave(e As EventArgs)
  308. MyBase.OnMouseLeave(e)
  309. State = MouseState.None : Invalidate()
  310. End Sub
  311.  
  312. Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
  313. MyBase.OnMouseUp(e)
  314. State = MouseState.Over : Invalidate()
  315.  
  316. If Enabled Then
  317. Checked = Not Checked
  318. RaiseEvent CheckedChanged(Me, e)
  319. End If
  320.  
  321. End Sub
  322.  
  323. Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
  324. MyBase.OnMouseDown(e)
  325. State = MouseState.Down : Invalidate()
  326. End Sub
  327.  
  328. End Class
  329.  
  330. Public MustInherit Class RadioButtonBase
  331. Inherits Control
  332.  
  333. Public Event CheckedChanged(sender As Object, e As EventArgs)
  334. Public State As MouseState
  335.  
  336. Private IsEnabled As Boolean
  337. Private IsChecked As Boolean
  338.  
  339. Public Shadows Property Enabled As Boolean
  340. Get
  341. Return EnabledCalc
  342. End Get
  343. Set(value As Boolean)
  344. IsEnabled = value
  345.  
  346. If Enabled Then
  347. Cursor = Cursors.Hand
  348. Else
  349. Cursor = Cursors.Default
  350. End If
  351.  
  352. Invalidate()
  353. End Set
  354. End Property
  355.  
  356. <DisplayName("Enabled")>
  357. Public Property EnabledCalc As Boolean
  358. Get
  359. Return IsEnabled
  360. End Get
  361. Set(value As Boolean)
  362. Enabled = value
  363. Invalidate()
  364. End Set
  365. End Property
  366.  
  367. Public Property Checked As Boolean
  368. Get
  369. Return IsChecked
  370. End Get
  371. Set(value As Boolean)
  372. IsChecked = value
  373. Invalidate()
  374. End Set
  375. End Property
  376.  
  377. Sub New()
  378. Enabled = True
  379. DoubleBuffered = True
  380. End Sub
  381.  
  382. Protected Overrides Sub OnMouseEnter(e As EventArgs)
  383. MyBase.OnMouseEnter(e)
  384. State = MouseState.Over : Invalidate()
  385. End Sub
  386.  
  387. Protected Overrides Sub OnMouseLeave(e As EventArgs)
  388. MyBase.OnMouseLeave(e)
  389. State = MouseState.None : Invalidate()
  390. End Sub
  391.  
  392. Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
  393. MyBase.OnMouseUp(e)
  394. State = MouseState.Over : Invalidate()
  395.  
  396. If Enabled Then
  397.  
  398. If Not Checked Then
  399.  
  400. For Each C As Control In Parent.Controls
  401. If TypeOf C Is RadioButtonBase Then
  402. DirectCast(C, RadioButtonBase).Checked = False
  403. End If
  404. Next
  405.  
  406. End If
  407.  
  408. Checked = True
  409. RaiseEvent CheckedChanged(Me, e)
  410. End If
  411.  
  412. End Sub
  413.  
  414. Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
  415. MyBase.OnMouseDown(e)
  416. State = MouseState.Down : Invalidate()
  417. End Sub
  418.  
  419. End Class
  420.  
  421. Public MustInherit Class ButtonBase
  422. Inherits Control
  423.  
  424. Public Shadows Event Click(sender As Object, e As EventArgs)
  425.  
  426. Public State As MouseState
  427. Private IsEnabled As Boolean
  428.  
  429. Public Shadows Property Enabled As Boolean
  430. Get
  431. Return EnabledCalc
  432. End Get
  433. Set(value As Boolean)
  434. IsEnabled = value
  435.  
  436. If Enabled Then
  437. Cursor = Cursors.Hand
  438. Else
  439. Cursor = Cursors.Default
  440. End If
  441.  
  442. Invalidate()
  443. End Set
  444. End Property
  445.  
  446. <DisplayName("Enabled")>
  447. Public Property EnabledCalc As Boolean
  448. Get
  449. Return IsEnabled
  450. End Get
  451. Set(value As Boolean)
  452. Enabled = value
  453. Invalidate()
  454. End Set
  455. End Property
  456.  
  457. Sub New()
  458. DoubleBuffered = True
  459. Enabled = True
  460. End Sub
  461.  
  462. Protected Overrides Sub OnMouseEnter(e As EventArgs)
  463. MyBase.OnMouseEnter(e)
  464. State = MouseState.Over : Invalidate()
  465. End Sub
  466.  
  467. Protected Overrides Sub OnMouseLeave(e As EventArgs)
  468. MyBase.OnMouseLeave(e)
  469. State = MouseState.None : Invalidate()
  470. End Sub
  471.  
  472. Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
  473. MyBase.OnMouseUp(e)
  474. State = MouseState.Over : Invalidate()
  475.  
  476. If Enabled Then
  477. RaiseEvent Click(Me, e)
  478. End If
  479.  
  480. End Sub
  481.  
  482. Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
  483. MyBase.OnMouseDown(e)
  484. State = MouseState.Down : Invalidate()
  485. End Sub
  486.  
  487. End Class
  488.  
  489. End Namespace
  490.  
  491. Public Class StrafeTabControl
  492. Inherits Base.LeftTabControl
  493.  
  494. Private G As Graphics
  495. Private B64Arrow As String = "iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAQAAAAnOwc2AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAAmJLR0QA/4ePzL8AAAAHdElNRQffDAEGGjYp6p3OAAAAgklEQVQI122OwQnCQBRE319jmvBgS3rwJFpYKjCxBfsRPCWgSfZPcD1sCArO3AYe80wY6cYY93dtA28AFISflFS3q2QeHAfP81lJzbBukU0QGVEh/KikS18+iYbnFsIPSqpGegv8yw9e9+Ur48vRdSg73KYvpaZblGyWj757aDPLfwAb/2J7O2+WigAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxNS0xMi0wMVQwNjoyNjo1NC0wNTowMCb0KyoAAAAldEVYdGRhdGU6bW9kaWZ5ADIwMTUtMTItMDFUMDY6MjY6NTQtMDU6MDBXqZOWAAAAAElFTkSuQmCC"
  496.  
  497. Protected Overrides Sub OnPaint(e As PaintEventArgs)
  498.  
  499. G = e.Graphics
  500. G.SmoothingMode = SmoothingMode.HighQuality
  501. G.TextRenderingHint = TextRenderingHint.ClearTypeGridFit
  502.  
  503. G.Clear(ColorFromHex("#2E3243"))
  504.  
  505. For I As Integer = 0 To TabPages.Count - 1
  506.  
  507. BaseRect = GetTabRect(I)
  508.  
  509. If SelectedIndex = I Then
  510.  
  511. Using Background As New SolidBrush(ColorFromHex("#272938")), TextColor As New SolidBrush(ColorFromHex("#E4E4E5")), TextFont As New Font("Segoe UI semibold", 9)
  512. G.FillRectangle(Background, BaseRect.X - 6, BaseRect.Y + 1, BaseRect.Width + 9, BaseRect.Height - 1)
  513. G.DrawString(TabPages(I).Text, TextFont, TextColor, New Point(BaseRect.X + 55, BaseRect.Y + 11))
  514. End Using
  515.  
  516. Using RectBack As New SolidBrush(ColorFromHex("#2E3243")), RectBorder As New Pen(ColorFromHex("#232532")), LeftArrow As Image = Image.FromStream(New IO.MemoryStream(Convert.FromBase64String(B64Arrow)))
  517. G.FillPath(RectBack, RoundRect(New Rectangle(BaseRect.X + 148, BaseRect.Y + 11, 17, 17), 3))
  518. G.DrawPath(RectBorder, RoundRect(New Rectangle(BaseRect.X + 148, BaseRect.Y + 11, 17, 17), 3))
  519. G.DrawImage(LeftArrow, New Point(BaseRect.X + 153, BaseRect.Y + 15))
  520. End Using
  521.  
  522. Else
  523.  
  524. Using TextColor As New SolidBrush(ColorFromHex("#848AA0")), TextFont As New Font("Segoe UI semibold", 9)
  525. G.DrawString(TabPages(I).Text, TextFont, TextColor, New Point(BaseRect.X + 55, BaseRect.Y + 11))
  526. End Using
  527.  
  528. End If
  529.  
  530. If Not String.IsNullOrEmpty(TabPages(I).Tag) Then
  531.  
  532. Try
  533. Using Border As New Pen(ColorFromHex(TabPages(I).Tag)) With {
  534. .Width = 3}
  535. G.DrawPath(Border, RoundRect(New Rectangle(BaseRect.X + 35, BaseRect.Y + 15, 9, 9), 2))
  536. End Using
  537. Catch
  538. End Try
  539.  
  540. End If
  541.  
  542. Next
  543.  
  544. MyBase.OnPaint(e)
  545. End Sub
  546.  
  547. End Class
  548.  
  549. Public Class StrafeSelector
  550. Inherits Base.TopTabControl
  551.  
  552. Private G As Graphics
  553.  
  554. Protected Overrides Sub OnPaint(e As PaintEventArgs)
  555. G = e.Graphics
  556. G.SmoothingMode = SmoothingMode.HighQuality
  557. G.TextRenderingHint = TextRenderingHint.ClearTypeGridFit
  558.  
  559. G.Clear(Parent.BackColor)
  560.  
  561. For I As Integer = 0 To TabPages.Count - 1
  562.  
  563. BaseRect = GetTabRect(I)
  564.  
  565. If SelectedIndex = I Then
  566.  
  567. If String.IsNullOrEmpty(TabPages(I).Tag) Then
  568.  
  569. Using DefColor As New SolidBrush(ColorFromHex("#40B1D0")) ', DefBorder As New Pen(ColorFromHex("#3CA3C3"))
  570. G.FillEllipse(DefColor, New Rectangle(BaseRect.X + 5, BaseRect.Y + 5, 9, 9))
  571. End Using
  572.  
  573. ElseIf TabPages(I).Tag.ToString.Length = 7
  574.  
  575. Using DefColor As New SolidBrush(ColorFromHex(TabPages(I).Tag))
  576. G.FillEllipse(DefColor, New Rectangle(BaseRect.X + 5, BaseRect.Y + 5, 9, 9))
  577. End Using
  578.  
  579. End If
  580.  
  581. Else
  582.  
  583. Using DefColor As New SolidBrush(ColorFromHex("#C8C8C8")), DefBorder As New Pen(ColorFromHex("#C3C3C3"))
  584. G.FillEllipse(DefColor, New Rectangle(BaseRect.X + 5, BaseRect.Y + 5, 9, 9))
  585. G.DrawEllipse(DefBorder, New Rectangle(BaseRect.X + 5, BaseRect.Y + 5, 9, 9))
  586. End Using
  587.  
  588. End If
  589.  
  590. If Hovering Then
  591. Cursor = Cursors.Hand
  592. Else
  593. Cursor = Cursors.Default
  594. End If
  595.  
  596. Next
  597.  
  598. MyBase.OnPaint(e)
  599. End Sub
  600.  
  601. End Class
  602.  
  603. Public Class StrafeOnOffBox
  604. Inherits Base.CheckControl
  605.  
  606. Private G As Graphics
  607.  
  608. Protected Overrides Sub OnPaint(e As PaintEventArgs)
  609. G = e.Graphics
  610. G.SmoothingMode = SmoothingMode.HighQuality
  611. G.TextRenderingHint = TextRenderingHint.ClearTypeGridFit
  612.  
  613. If Enabled Then
  614.  
  615. If Not Checked Then
  616.  
  617. Using Background As New SolidBrush(ColorFromHex("#C8C8C8")), Border As New Pen(ColorFromHex("#C3C3C3")), SquareBorder As New Pen(ColorFromHex("#C3C3C3"))
  618. G.FillRectangle(Background, FullRectangle(Size, True))
  619. G.DrawRectangle(Border, FullRectangle(Size, True))
  620.  
  621. G.FillRectangle(Brushes.White, New Rectangle(3, 3, 16, Height - 7))
  622. G.DrawRectangle(SquareBorder, New Rectangle(3, 3, 16, Height - 7))
  623. End Using
  624.  
  625. Else
  626.  
  627. Using Background As New SolidBrush(ColorFromHex("#40B1D0")), Border As New Pen(ColorFromHex("#3CA3C3")), SquareBorder As New Pen(ColorFromHex("#3CA3C3"))
  628. G.FillRectangle(Background, FullRectangle(Size, True))
  629. G.DrawRectangle(Border, FullRectangle(Size, True))
  630.  
  631. G.FillRectangle(Brushes.White, New Rectangle(Width - 20, 3, 16, Height - 7))
  632. G.DrawRectangle(SquareBorder, New Rectangle(Width - 20, 3, 16, Height - 7))
  633. End Using
  634.  
  635. End If
  636.  
  637. Else
  638.  
  639. If Not Checked Then
  640.  
  641. Using Background As New SolidBrush(ColorFromHex("#E8E8E8")), Border As New Pen(ColorFromHex("#DEDEDE")), SquareBorder As New Pen(ColorFromHex("#E0E0E0"))
  642. G.FillRectangle(Background, FullRectangle(Size, True))
  643. G.DrawRectangle(Border, FullRectangle(Size, True))
  644.  
  645. G.FillRectangle(Brushes.White, New Rectangle(3, 3, 16, Height - 7))
  646. G.DrawRectangle(SquareBorder, New Rectangle(3, 3, 16, Height - 7))
  647. End Using
  648.  
  649. Else
  650.  
  651. Using Background As New SolidBrush(ColorFromHex("#A0C4CE")), Border As New Pen(ColorFromHex("#9FC1CB")), SquareBorder As New Pen(ColorFromHex("#9FC1CB"))
  652. G.FillRectangle(Background, FullRectangle(Size, True))
  653. G.DrawRectangle(Border, FullRectangle(Size, True))
  654.  
  655. G.FillRectangle(Brushes.White, New Rectangle(Width - 20, 3, 16, Height - 7))
  656. G.DrawRectangle(SquareBorder, New Rectangle(Width - 20, 3, 16, Height - 7))
  657. End Using
  658.  
  659. End If
  660.  
  661. End If
  662.  
  663. MyBase.OnPaint(e)
  664. End Sub
  665.  
  666. End Class
  667.  
  668. Public Class StrafeCheckBox
  669. Inherits Base.CheckControl
  670.  
  671. Private G As Graphics
  672.  
  673. Protected Overrides Sub OnPaint(e As PaintEventArgs)
  674. G = e.Graphics
  675. G.SmoothingMode = SmoothingMode.HighQuality
  676. G.TextRenderingHint = TextRenderingHint.ClearTypeGridFit
  677.  
  678. If Enabled Then
  679.  
  680. Using Border As New Pen(ColorFromHex("#C8C8C8")), TextColor As New SolidBrush(ColorFromHex("#72778D")), TextFont As New Font("Segoe UI", 9)
  681. G.DrawRectangle(Border, New Rectangle(0, 0, 16, 16))
  682. G.DrawString(Text, TextFont, TextColor, New Point(22, 0))
  683. End Using
  684.  
  685. If Checked Then
  686.  
  687. Using Check As New SolidBrush(ColorFromHex("#40B1D0")), CheckBorder As New Pen(ColorFromHex("#3CA3C3"))
  688. G.FillRectangle(Check, New Rectangle(3, 3, 10, 10))
  689. G.DrawRectangle(CheckBorder, New Rectangle(3, 3, 10, 10))
  690. End Using
  691.  
  692. End If
  693.  
  694. Else
  695.  
  696. Using Border As New Pen(ColorFromHex("#E8E8E8")), TextColor As New SolidBrush(ColorFromHex("#B8BDC9")), TextFont As New Font("Segoe UI", 9)
  697. G.DrawRectangle(Border, New Rectangle(0, 0, 16, 16))
  698. G.DrawString(Text, TextFont, TextColor, New Point(22, 0))
  699. End Using
  700.  
  701. If Checked Then
  702.  
  703. Using Check As New SolidBrush(ColorFromHex("#A0C4CE")), CheckBorder As New Pen(ColorFromHex("#9FC1CB"))
  704. G.FillRectangle(Check, New Rectangle(3, 3, 10, 10))
  705. G.DrawRectangle(CheckBorder, New Rectangle(3, 3, 10, 10))
  706. End Using
  707.  
  708. End If
  709.  
  710. End If
  711.  
  712. MyBase.OnPaint(e)
  713. End Sub
  714.  
  715. Protected Overrides Sub OnResize(e As EventArgs)
  716. MyBase.OnResize(e)
  717. Size = New Size(Width, 17)
  718. End Sub
  719.  
  720. End Class
  721.  
  722. Public Class StrafeRadioButton
  723. Inherits Base.RadioButtonBase
  724.  
  725. Private G As Graphics
  726.  
  727. Protected Overrides Sub OnPaint(e As PaintEventArgs)
  728. G = e.Graphics
  729. G.SmoothingMode = SmoothingMode.HighQuality
  730. G.TextRenderingHint = TextRenderingHint.ClearTypeGridFit
  731.  
  732. If Enabled Then
  733.  
  734. Using Border As New Pen(ColorFromHex("#C8C8C8")), TextColor As New SolidBrush(ColorFromHex("#72778D")), TextFont As New Font("Segoe UI", 9)
  735. G.DrawEllipse(Border, New Rectangle(0, 0, 16, 16))
  736. G.DrawString(Text, TextFont, TextColor, New Point(22, 0))
  737. End Using
  738.  
  739. If Checked Then
  740.  
  741. Using Check As New SolidBrush(ColorFromHex("#40B1D0")), CheckBorder As New Pen(ColorFromHex("#3CA3C3"))
  742. G.FillEllipse(Check, New Rectangle(3, 3, 10, 10))
  743. G.DrawEllipse(CheckBorder, New Rectangle(3, 3, 10, 10))
  744. End Using
  745.  
  746. End If
  747.  
  748. Else
  749.  
  750. Using Border As New Pen(ColorFromHex("#E8E8E8")), TextColor As New SolidBrush(ColorFromHex("#B8BDC9")), TextFont As New Font("Segoe UI", 9)
  751. G.DrawEllipse(Border, New Rectangle(0, 0, 16, 16))
  752. G.DrawString(Text, TextFont, TextColor, New Point(22, 0))
  753. End Using
  754.  
  755. If Checked Then
  756.  
  757. Using Check As New SolidBrush(ColorFromHex("#A0C4CE")), CheckBorder As New Pen(ColorFromHex("#9FC1CB"))
  758. G.FillEllipse(Check, New Rectangle(3, 3, 10, 10))
  759. G.DrawEllipse(CheckBorder, New Rectangle(3, 3, 10, 10))
  760. End Using
  761.  
  762. End If
  763.  
  764. End If
  765.  
  766. MyBase.OnPaint(e)
  767. End Sub
  768.  
  769. Protected Overrides Sub OnResize(e As EventArgs)
  770. MyBase.OnResize(e)
  771. Size = New Size(Width, 17)
  772. End Sub
  773.  
  774. End Class
  775.  
  776. Public Class StrafeHeader
  777. Inherits Control
  778.  
  779. Private G As Graphics
  780.  
  781. Protected Overrides Sub OnPaint(e As PaintEventArgs)
  782. G = e.Graphics
  783. G.SmoothingMode = SmoothingMode.HighQuality
  784. G.TextRenderingHint = TextRenderingHint.ClearTypeGridFit
  785.  
  786. G.Clear(Parent.BackColor)
  787.  
  788. Using TextColor As New SolidBrush(ColorFromHex("#4E5260")), TextFont As New Font("Segoe UI semibold", 15)
  789. G.DrawString(Text, TextFont, TextColor, New Point(0, 0))
  790. End Using
  791.  
  792. MyBase.OnPaint(e)
  793. End Sub
  794.  
  795. Protected Overrides Sub OnResize(e As EventArgs)
  796. MyBase.OnResize(e)
  797. Size = New Size(Width, 32)
  798. End Sub
  799.  
  800. End Class
  801.  
  802. Public Class StrafeSeparator
  803. Inherits Control
  804.  
  805. Private G As Graphics
  806.  
  807. Protected Overrides Sub OnPaint(e As PaintEventArgs)
  808. G = e.Graphics
  809. G.SmoothingMode = SmoothingMode.HighQuality
  810. G.TextRenderingHint = TextRenderingHint.ClearTypeGridFit
  811.  
  812. G.Clear(Parent.BackColor)
  813.  
  814. Using SepColor As New Pen(ColorFromHex("#ECEFF3"))
  815. G.DrawLine(SepColor, 0, 0, Width, 0)
  816. End Using
  817.  
  818. MyBase.OnPaint(e)
  819. End Sub
  820.  
  821. Protected Overrides Sub OnResize(e As EventArgs)
  822. MyBase.OnResize(e)
  823. Size = New Size(Width, 6)
  824. End Sub
  825.  
  826. End Class
  827.  
  828. Public Class StrafeCircular
  829. Inherits Control
  830.  
  831. Private G As Graphics
  832. Private ProgressAngle As Single
  833. Private RemainderAngle As Single
  834.  
  835. Private _Progress As Single
  836. Private _Max As Single = 100
  837. Private _Min As Single = 0
  838.  
  839. Public Property ShowMax As Boolean
  840.  
  841. Public Property Progress As Single
  842. Get
  843. Return _Progress
  844. End Get
  845. Set(value As Single)
  846. Select Case value
  847. Case Is > Max
  848. value = Max
  849. Invalidate()
  850.  
  851. Case Is < Min
  852. value = Min
  853. Invalidate()
  854. End Select
  855. _Progress = value
  856. Invalidate()
  857. End Set
  858. End Property
  859.  
  860. Public Property Max As Single
  861. Get
  862. Return _Max
  863. End Get
  864. Set(value As Single)
  865. Select Case value
  866. Case Is < _Progress
  867. _Progress = value
  868. End Select
  869. _Max = value
  870. Invalidate()
  871. End Set
  872. End Property
  873.  
  874. Public Property Min As Single
  875. Get
  876. Return _Min
  877. End Get
  878. Set(value As Single)
  879. Select Case value
  880. Case Is > _Progress
  881. _Progress = value
  882. End Select
  883. _Min = value
  884. Invalidate()
  885. End Set
  886. End Property
  887.  
  888. Sub New()
  889. DoubleBuffered = True
  890. End Sub
  891.  
  892. Protected Overrides Sub OnPaint(e As PaintEventArgs)
  893.  
  894. G = e.Graphics
  895. G.SmoothingMode = SmoothingMode.HighQuality
  896. G.TextRenderingHint = TextRenderingHint.ClearTypeGridFit
  897.  
  898. ProgressAngle = 360 / Max * Progress
  899. RemainderAngle = 360 - ProgressAngle
  900.  
  901. Using ProgressColor As New Pen(ColorFromHex("#40B1D0"), 4), Background As New Pen(ColorFromHex("#E8E8E8"), 4)
  902. G.DrawArc(ProgressColor, New Rectangle(2, 2, Width - 5, Height - 5), -90, ProgressAngle)
  903. G.DrawArc(Background, New Rectangle(2, 2, Width - 5, Height - 5), ProgressAngle - 90, RemainderAngle)
  904. End Using
  905.  
  906. Using TextFont As New Font("Segoe UI", 9, FontStyle.Bold), TextColor As New SolidBrush(ColorFromHex("#4E5260"))
  907. CenterString(G, Progress, TextFont, TextColor.Color, New Rectangle(1, 1, Width, Height + 1))
  908. End Using
  909.  
  910. If ShowMax Then
  911.  
  912. Using TextFont As New Font("Segoe UI", 7, FontStyle.Bold), TextColor As New SolidBrush(ColorFromHex("#B8BDC9"))
  913. CenterString(G, Max, TextFont, TextColor.Color, New Rectangle(0, 11, Width, Height + 1))
  914. End Using
  915.  
  916. End If
  917.  
  918. MyBase.OnPaint(e)
  919.  
  920. End Sub
  921.  
  922. End Class
  923.  
  924. Public Class StrafeProgressBar
  925. Inherits Control
  926.  
  927. Private G As Graphics
  928.  
  929. Private _Val As Integer = 0
  930. Private _Min As Integer = 0
  931. Private _Max As Integer = 100
  932.  
  933. Public Property Value As Integer
  934. Get
  935. Return _Val
  936. End Get
  937. Set(value As Integer)
  938. _Val = value
  939. Invalidate()
  940. End Set
  941. End Property
  942.  
  943. Public Property Minimum As Integer
  944. Get
  945. Return _Min
  946. End Get
  947. Set(value As Integer)
  948. _Min = value
  949. Invalidate()
  950. End Set
  951. End Property
  952.  
  953. Public Property Maximum As Integer
  954. Get
  955. Return _Max
  956. End Get
  957. Set(value As Integer)
  958. _Max = value
  959. Invalidate()
  960. End Set
  961. End Property
  962.  
  963. Sub New()
  964. DoubleBuffered = True
  965. Maximum = 100
  966. Minimum = 0
  967. Value = 0
  968. End Sub
  969.  
  970. Protected Overrides Sub OnPaint(e As PaintEventArgs)
  971.  
  972. G = e.Graphics
  973. G.SmoothingMode = SmoothingMode.HighQuality
  974. G.TextRenderingHint = TextRenderingHint.ClearTypeGridFit
  975.  
  976. G.Clear(Parent.BackColor)
  977.  
  978. Using Border As New Pen(ColorFromHex("#D0D5D9"))
  979. G.DrawRectangle(Border, FullRectangle(Size, True))
  980. End Using
  981.  
  982. Using Background As New SolidBrush(ColorFromHex("#40B1D0")), DefBackground As New SolidBrush(ColorFromHex("#E8E8E8"))
  983. G.FillRectangle(DefBackground, FullRectangle(Size, True))
  984. G.FillRectangle(Background, New Rectangle(0, 0, Value / Maximum * Width - 1, Height - 1))
  985. End Using
  986.  
  987. MyBase.OnPaint(e)
  988.  
  989. End Sub
  990.  
  991. End Class
  992.  
  993. Public Class StrafeButton
  994. Inherits Base.ButtonBase
  995.  
  996. Private G As Graphics
  997.  
  998. Protected Overrides Sub OnPaint(e As PaintEventArgs)
  999. G = e.Graphics
  1000. G.SmoothingMode = SmoothingMode.HighQuality
  1001. G.TextRenderingHint = TextRenderingHint.ClearTypeGridFit
  1002.  
  1003. G.Clear(Parent.BackColor)
  1004.  
  1005. If Enabled Then
  1006.  
  1007. Select Case State
  1008.  
  1009. Case MouseState.None
  1010.  
  1011. Using Border As New Pen(ColorFromHex("#C8C8C8"))
  1012. G.DrawRectangle(Border, FullRectangle(Size, True))
  1013. End Using
  1014.  
  1015. Case MouseState.Over
  1016.  
  1017. Using Background As New SolidBrush(ColorFromHex("#F0F0F0")), Border As New Pen(ColorFromHex("#C8C8C8"))
  1018. G.FillRectangle(Background, FullRectangle(Size, True))
  1019. G.DrawRectangle(Border, FullRectangle(Size, True))
  1020. End Using
  1021.  
  1022. Case MouseState.Down
  1023.  
  1024. Using Background As New SolidBrush(ColorFromHex("#E6E6E6")), Border As New Pen(ColorFromHex("#C8C8C8"))
  1025. G.FillRectangle(Background, FullRectangle(Size, True))
  1026. G.DrawRectangle(Border, FullRectangle(Size, True))
  1027. End Using
  1028.  
  1029. End Select
  1030.  
  1031. Using TextFont As New Font("Segoe UI", 9), TextColor As New SolidBrush(ColorFromHex("#72778D"))
  1032. CenterString(G, Text, TextFont, TextColor.Color, FullRectangle(Size, False))
  1033. End Using
  1034.  
  1035. Else
  1036.  
  1037. Using Border As New Pen(ColorFromHex("#E8E8E8"))
  1038. G.DrawRectangle(Border, FullRectangle(Size, True))
  1039. End Using
  1040.  
  1041. Using TextFont As New Font("Segoe UI", 9), TextColor As New SolidBrush(ColorFromHex("#B8BDC9"))
  1042. CenterString(G, Text, TextFont, TextColor.Color, FullRectangle(Size, False))
  1043. End Using
  1044.  
  1045. End If
  1046.  
  1047.  
  1048. MyBase.OnPaint(e)
  1049. End Sub
  1050.  
  1051. End Class
  1052.  
  1053. Public Class StrafeNumericUpDown
  1054. Inherits Control
  1055.  
  1056. Public Event ValueChanged(sender As Object, e As EventArgs)
  1057.  
  1058. Private G As Graphics
  1059. Private IsEnabled As Boolean
  1060. Public Property UpDownStep As Integer = 1
  1061.  
  1062. Private _Value As Integer
  1063. Public Property Value As Integer
  1064. Get
  1065. Return _Value
  1066. End Get
  1067. Set(value As Integer)
  1068. Select Case value
  1069. Case Is > Max
  1070. value = Max
  1071. Invalidate()
  1072.  
  1073. Case Is < Min
  1074. value = Min
  1075. Invalidate()
  1076. End Select
  1077. _Value = value
  1078. Invalidate()
  1079. RaiseEvent ValueChanged(Me, EventArgs.Empty)
  1080. End Set
  1081. End Property
  1082.  
  1083. Private _Max As Integer = 100
  1084. Public Property Max As Integer
  1085. Get
  1086. Return _Max
  1087. End Get
  1088. Set(value As Integer)
  1089. Select Case value
  1090. Case Is < _Value
  1091. _Value = value
  1092. End Select
  1093. _Max = value
  1094. Invalidate()
  1095. End Set
  1096. End Property
  1097.  
  1098. Private _Min As Integer
  1099. Public Property Min As Integer
  1100. Get
  1101. Return _Min
  1102. End Get
  1103. Set(value As Integer)
  1104. Select Case value
  1105. Case Is > _Value
  1106. _Value = value
  1107. End Select
  1108. _Min = value
  1109. Invalidate()
  1110. End Set
  1111. End Property
  1112.  
  1113. Public Shadows Property Enabled As Boolean
  1114. Get
  1115. Return EnabledCalc
  1116. End Get
  1117. Set(value As Boolean)
  1118. IsEnabled = value
  1119. Invalidate()
  1120. End Set
  1121. End Property
  1122.  
  1123. <DisplayName("Enabled")>
  1124. Public Property EnabledCalc As Boolean
  1125. Get
  1126. Return IsEnabled
  1127. End Get
  1128. Set(value As Boolean)
  1129. Enabled = value
  1130. Invalidate()
  1131. End Set
  1132. End Property
  1133.  
  1134. Sub New()
  1135. Enabled = True
  1136. DoubleBuffered = True
  1137. End Sub
  1138.  
  1139. Protected Overrides Sub OnPaint(e As PaintEventArgs)
  1140. G = e.Graphics
  1141. G.SmoothingMode = SmoothingMode.HighQuality
  1142. G.TextRenderingHint = TextRenderingHint.ClearTypeGridFit
  1143.  
  1144. If Enabled Then
  1145.  
  1146. Using Border As New Pen(ColorFromHex("#C8C8C8"))
  1147. G.DrawRectangle(Border, FullRectangle(Size, True))
  1148. G.DrawRectangle(Border, New Rectangle(Width - 20, 4, 15, 18))
  1149. End Using
  1150.  
  1151. Using TextColor As New SolidBrush(ColorFromHex("#424E5A")), TextFont As New Font("Segoe UI", 10)
  1152. CenterString(G, Value, TextFont, TextColor.Color, New Rectangle(-10, 0, Width, Height))
  1153. End Using
  1154.  
  1155. Using SignColor As New SolidBrush(ColorFromHex("#72778D")), SignFont As New Font("Marlett", 10)
  1156. G.DrawString("t", SignFont, SignColor, New Point(Width - 20, 4))
  1157. G.DrawString("u", SignFont, SignColor, New Point(Width - 20, 10))
  1158. End Using
  1159.  
  1160. Else
  1161.  
  1162. Using Border As New Pen(ColorFromHex("#E6E6E6"))
  1163. G.DrawRectangle(Border, FullRectangle(Size, True))
  1164. G.DrawRectangle(Border, New Rectangle(Width - 20, 4, 15, 18))
  1165. End Using
  1166.  
  1167. Using TextColor As New SolidBrush(ColorFromHex("#A6B2BE")), TextFont As New Font("Segoe UI", 10)
  1168. CenterString(G, Value, TextFont, TextColor.Color, New Rectangle(-10, 0, Width, Height))
  1169. End Using
  1170.  
  1171. Using SignColor As New SolidBrush(ColorFromHex("#BAC6D2")), SignFont As New Font("Marlett", 10)
  1172. G.DrawString("t", SignFont, SignColor, New Point(Width - 20, 4))
  1173. G.DrawString("u", SignFont, SignColor, New Point(Width - 20, 10))
  1174. End Using
  1175.  
  1176. End If
  1177.  
  1178. MyBase.OnPaint(e)
  1179. End Sub
  1180.  
  1181. Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
  1182. MyBase.OnMouseUp(e)
  1183.  
  1184. If Enabled Then
  1185.  
  1186. If e.X > Width - 20 And e.Y < 10 Then
  1187. Value += UpDownStep
  1188. ElseIf e.X > Width - 20 And e.Y > 10
  1189. Value -= UpDownStep
  1190. End If
  1191.  
  1192. End If
  1193.  
  1194. End Sub
  1195.  
  1196. Protected Overrides Sub OnMouseMove(e As MouseEventArgs)
  1197. MyBase.OnMouseMove(e)
  1198.  
  1199. If Enabled Then
  1200.  
  1201. If e.X > Width - 20 And e.Y < 10 Then
  1202. Cursor = Cursors.Hand
  1203. ElseIf e.X > Width - 20 And e.Y > 10
  1204. Cursor = Cursors.Hand
  1205. Else
  1206. Cursor = Cursors.Default
  1207. End If
  1208.  
  1209. End If
  1210.  
  1211. End Sub
  1212.  
  1213. Protected Overrides Sub OnResize(e As EventArgs)
  1214. MyBase.OnResize(e)
  1215. Size = New Size(Width, 27)
  1216. End Sub
  1217.  
  1218. End Class
Add Comment
Please, Sign In to add comment