Advertisement
Guest User

'leaked Private Sky Dark Theme for vb.net

a guest
Apr 1st, 2012
6,911
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 29.99 KB | None | 0 0
  1. 'leaked Private Sky Dark Theme for vb.net
  2. 'Enjoy ;)
  3. 'Can you believe he was charging money for this?
  4.  
  5.  
  6. Imports System.Drawing.Drawing2D
  7. ''' <summary>
  8. ''' Credits
  9. ''' </summary>
  10. ''' <remarks>
  11. '''
  12. ''' Contact:
  13. ''' Tedd - HackForums.net Forum or Tedd.Zublansky@blackhax.com
  14. '''
  15. ''' Copyright:
  16. ''' Sky Dark .NET Theme by the Webmaster of www.BlackHax.com is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License.
  17. ''' </remarks>
  18. '''
  19. Module ConversionFunctions
  20. Function ToBrush(ByVal A As Integer, ByVal R As Integer, ByVal G As Integer, ByVal B As Integer) As Brush
  21. Return New SolidBrush(Color.FromArgb(A, R, G, B))
  22. End Function
  23. Function ToBrush(ByVal R As Integer, ByVal G As Integer, ByVal B As Integer) As Brush
  24. Return New SolidBrush(Color.FromArgb(R, G, B))
  25. End Function
  26. Function ToBrush(ByVal A As Integer, ByVal C As Color) As Brush
  27. Return New SolidBrush(Color.FromArgb(A, C))
  28. End Function
  29. Function ToBrush(ByVal Pen As Pen) As Brush
  30. Return New SolidBrush(Pen.Color)
  31. End Function
  32. Function ToBrush(ByVal Color As Color) As Brush
  33. Return New SolidBrush(Color)
  34. End Function
  35. Function ToPen(ByVal A As Integer, ByVal R As Integer, ByVal G As Integer, ByVal B As Integer) As Pen
  36. Return New Pen(New SolidBrush(Color.FromArgb(A, R, G, B)))
  37. End Function
  38. Function ToPen(ByVal R As Integer, ByVal G As Integer, ByVal B As Integer) As Pen
  39. Return New Pen(New SolidBrush(Color.FromArgb(R, G, B)))
  40. End Function
  41. Function ToPen(ByVal A As Integer, ByVal C As Color) As Pen
  42. Return New Pen(New SolidBrush(Color.FromArgb(A, C)))
  43. End Function
  44. Function ToPen(ByVal Brush As SolidBrush) As Pen
  45. Return New Pen(Brush)
  46. End Function
  47. Function ToPen(ByVal Color As Color) As Pen
  48. Return New Pen(New SolidBrush(Color))
  49. End Function
  50. End Module
  51.  
  52. Module RRM
  53. Public Function RoundRect(ByVal Rectangle As Rectangle, ByVal Curve As Integer) As GraphicsPath
  54. Dim P As GraphicsPath = New GraphicsPath()
  55. Dim ArcRectangleWidth As Integer = Curve * 2
  56. P.AddArc(New Rectangle(Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -180, 90)
  57. P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -90, 90)
  58. P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 0, 90)
  59. P.AddArc(New Rectangle(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 90, 90)
  60. P.AddLine(New Point(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y), New Point(Rectangle.X, Curve + Rectangle.Y))
  61. Return P
  62. End Function
  63. Public Function RoundRect(ByVal X As Integer, ByVal Y As Integer, ByVal Width As Integer, ByVal Height As Integer, ByVal Curve As Integer) As GraphicsPath
  64. Dim Rectangle As Rectangle = New Rectangle(X, Y, Width, Height)
  65. Dim P As GraphicsPath = New GraphicsPath()
  66. Dim ArcRectangleWidth As Integer = Curve * 2
  67. P.AddArc(New Rectangle(Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -180, 90)
  68. P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -90, 90)
  69. P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 0, 90)
  70. P.AddArc(New Rectangle(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 90, 90)
  71. P.AddLine(New Point(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y), New Point(Rectangle.X, Curve + Rectangle.Y))
  72. Return P
  73. End Function
  74. End Module
  75.  
  76. Module Shapes
  77. Public Function Triangle(ByVal Location As Point, ByVal Size As Size) As Point()
  78. Dim ReturnPoints(0 To 3) As Point
  79. ReturnPoints(0) = Location
  80. ReturnPoints(1) = New Point(Location.X + Size.Width, Location.Y)
  81. ReturnPoints(2) = New Point(Location.X + Size.Width \ 2, Location.Y + Size.Height)
  82. ReturnPoints(3) = Location
  83.  
  84. Return ReturnPoints
  85. End Function
  86. End Module
  87.  
  88. Public Class SkyDarkForm
  89. Inherits ContainerControl
  90. Dim WithEvents Maxim As SkyDarkTop
  91. Dim WithEvents Exim As SkyDarkTop
  92. Private Locked As Boolean = False
  93. Private Locked1 As Point = Nothing
  94.  
  95. Sub New()
  96. Dock = DockStyle.Fill
  97. SendToBack()
  98. BackColor = Color.FromArgb(62, 60, 58)
  99. End Sub
  100.  
  101. Protected Overrides Sub OnHandleCreated(ByVal e As System.EventArgs)
  102. Parent.FindForm.FormBorderStyle = FormBorderStyle.None
  103. Maxim = New SkyDarkTop With {.Location = New Point(Width - 41, 3), .Size = New Size(14, 14), .Parent = Me}
  104. Exim = New SkyDarkTop With {.Location = New Point(Width - 22, 3), .Size = New Size(14, 14), .Parent = Me}
  105. Me.Controls.Add(Maxim)
  106. Me.Controls.Add(Exim)
  107. Maxim.Show()
  108. Exim.Show()
  109. End Sub
  110. Dim T1 As New Rectangle(1, 1, Width - 3, 18)
  111. Dim C1 As Color = Color.FromArgb(62, 60, 58)
  112. Dim C2 As Color = Color.FromArgb(81, 79, 77)
  113. Dim C3 As Color = Color.FromArgb(71, 70, 69)
  114. Dim C4 As Color = Color.FromArgb(58, 56, 54)
  115.  
  116. Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  117. Dim B As New Bitmap(Width, Height)
  118. Dim G As Graphics = Graphics.FromImage(B)
  119.  
  120. 'Drawing
  121. G.Clear(C1)
  122. Dim G1 As New LinearGradientBrush(New Point(T1.X, T1.Y), New Point(T1.X, T1.Y + T1.Height), C3, C4)
  123. G.FillRectangle(G1, T1)
  124. G.DrawRectangle(ToPen(C2), T1)
  125. G.DrawRectangle(ToPen(C2), New Rectangle(T1.X, T1.Y + T1.Height + 2, T1.Width, Height - T1.Y - T1.Height - 4))
  126.  
  127. G1.Dispose()
  128.  
  129. G.DrawString(Text, Font, ToBrush(113, 170, 186), _
  130. New Rectangle(New Point(T1.X + 4, T1.Y), New Size(T1.Width - 40, T1.Height)), _
  131. New StringFormat With {.LineAlignment = StringAlignment.Center})
  132.  
  133.  
  134. 'Finish Up
  135. e.Graphics.DrawImage(B.Clone, 0, 0)
  136. G.Dispose() : B.Dispose()
  137. End Sub
  138.  
  139. Private Sub Exim_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Exim.Click
  140. Parent.FindForm.Close()
  141. End Sub
  142.  
  143. Private Sub Maxim_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Maxim.Click
  144. Parent.FindForm.WindowState = FormWindowState.Minimized
  145. End Sub
  146.  
  147. Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
  148. MyBase.OnMouseUp(e) : Locked = False : Locked1 = Nothing
  149. End Sub
  150.  
  151. Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  152. MyBase.OnMouseDown(e) : If T1.Contains(e.Location) Then : Locked = True : Locked1 = e.Location : End If
  153. End Sub
  154.  
  155. Protected Overrides Sub OnMouseMove(ByVal e As System.Windows.Forms.MouseEventArgs)
  156. MyBase.OnMouseMove(e) : If Locked Then Parent.Location = Cursor.Position - Locked1
  157. End Sub
  158.  
  159. Protected Overrides Sub OnResize(ByVal e As System.EventArgs)
  160. MyBase.OnResize(e) : T1 = New Rectangle(1, 1, Width - 3, 18)
  161. End Sub
  162. End Class
  163.  
  164. Public Class SkyDarkButton
  165. Inherits Control
  166.  
  167. #Region "Properties"
  168. Public Overrides Property Text As String
  169. Get
  170. Return MyBase.Text
  171. End Get
  172. Set(ByVal value As String)
  173. MyBase.Text = value
  174. Invalidate()
  175. End Set
  176. End Property
  177. #End Region
  178.  
  179. Sub New()
  180. DoubleBuffered = True
  181. End Sub
  182.  
  183. Dim C1 As Color = Color.FromArgb(51, 49, 47)
  184. Dim C2 As Color = Color.FromArgb(90, 91, 90)
  185. Dim C3 As Color = Color.FromArgb(70, 71, 70)
  186. Dim C4 As Color = Color.FromArgb(62, 61, 58)
  187.  
  188.  
  189. Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  190. Dim B As New Bitmap(Width, Height)
  191. Dim G As Graphics = Graphics.FromImage(B)
  192.  
  193. Dim G1 As New LinearGradientBrush(New Point(0, 0), New Point(0, Height), C3, C4)
  194. G.FillRectangle(G1, 0, 0, Width, Height)
  195. G1.Dispose()
  196.  
  197. If Enabled Then
  198. Select Case State
  199. Case MouseState.Over
  200. G.FillRectangle(New SolidBrush(Color.FromArgb(20, Color.White)), New Rectangle(0, 0, Width, Height))
  201. Case MouseState.Down
  202. G.FillRectangle(New SolidBrush(Color.FromArgb(10, Color.Black)), New Rectangle(0, 0, Width, Height))
  203. End Select
  204. End If
  205.  
  206. Dim S1 As New StringFormat
  207. S1.LineAlignment = StringAlignment.Center
  208. S1.Alignment = StringAlignment.Center
  209.  
  210. Select Case Enabled
  211. Case True
  212. G.DrawString(Text, Font, ToBrush(113, 170, 186), New Rectangle(0, 0, Width - 1, Height - 1), S1)
  213. Case False
  214. G.DrawString(Text, Font, Brushes.Gray, New Rectangle(0, 0, Width - 1, Height - 1), S1)
  215. End Select
  216.  
  217. S1.Dispose()
  218.  
  219. G.DrawRectangle(ToPen(C1), 0, 0, Width - 1, Height - 1)
  220. G.DrawRectangle(ToPen(C2), 1, 1, Width - 3, Height - 3)
  221.  
  222. e.Graphics.DrawImage(B.Clone, 0, 0)
  223. G.Dispose() : B.Dispose()
  224. End Sub
  225.  
  226. #Region "Mouse States"
  227. Enum MouseState
  228. None
  229. Over
  230. Down
  231. End Enum
  232. Private ms As MouseState
  233. Private Property State() As MouseState
  234. Get
  235. Return ms
  236. End Get
  237. Set(ByVal value As MouseState)
  238. ms = value
  239. Invalidate()
  240. End Set
  241. End Property
  242. Protected Overrides Sub OnMouseEnter(ByVal e As System.EventArgs)
  243. MyBase.OnMouseEnter(e) : State = MouseState.Over
  244. End Sub
  245. Protected Overrides Sub OnMouseLeave(ByVal e As System.EventArgs)
  246. MyBase.OnMouseLeave(e) : State = MouseState.None
  247. End Sub
  248. Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  249. MyBase.OnMouseDown(e) : State = MouseState.Down
  250. End Sub
  251. Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
  252. MyBase.OnMouseUp(e) : State = MouseState.Over
  253. End Sub
  254. #End Region
  255. End Class
  256.  
  257. Public Class SkyDarkProgress
  258. Inherits Control
  259.  
  260. #Region "Properties"
  261. Private val As Integer
  262. Public Property Value() As Integer
  263. Get
  264. Return val
  265. End Get
  266. Set(ByVal _value As Integer)
  267. If _value > max Then
  268. val = max
  269. ElseIf _value < 0 Then
  270. val = 0
  271. Else
  272. val = _value
  273. End If
  274. Invalidate()
  275. End Set
  276. End Property
  277. Private max As Integer
  278. Public Property Maximum() As Integer
  279. Get
  280. Return max
  281. End Get
  282. Set(ByVal _value As Integer)
  283. If _value < 1 Then
  284. max = 1
  285. Else
  286. max = _value
  287. End If
  288.  
  289. If _value < val Then
  290. val = max
  291. End If
  292.  
  293. Invalidate()
  294. End Set
  295. End Property
  296. #End Region
  297. Dim C1 As Color = Color.FromArgb(51, 49, 47)
  298. Dim C2 As Color = Color.FromArgb(81, 77, 77)
  299. Dim C3 As Color = Color.FromArgb(64, 60, 59)
  300. Dim C4 As Color = Color.FromArgb(70, 71, 70)
  301. Dim C5 As Color = Color.FromArgb(62, 59, 58)
  302.  
  303. Sub New()
  304. max = 100
  305. End Sub
  306.  
  307. Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  308. Dim B As New Bitmap(Width, Height)
  309. Dim G As Graphics = Graphics.FromImage(B)
  310. Dim Fill As Rectangle = New Rectangle(3, 3, CInt((Width - 7) * (val / max)), Height - 7)
  311.  
  312. G.Clear(C5)
  313.  
  314. Dim G1 As New LinearGradientBrush(New Point(0, 0), New Point(0, Height), C3, C4)
  315. G.FillRectangle(G1, Fill)
  316. G1.Dispose()
  317. G.DrawRectangle(ToPen(C2), Fill)
  318.  
  319. G.DrawRectangle(ToPen(C1), 0, 0, Width - 1, Height - 1)
  320. G.DrawRectangle(ToPen(C2), 1, 1, Width - 3, Height - 3)
  321.  
  322. e.Graphics.DrawImage(B.Clone, 0, 0)
  323. G.Dispose() : B.Dispose()
  324. End Sub
  325. End Class
  326.  
  327. Public Class SkyDarkTabControl
  328. Inherits TabControl
  329.  
  330. Sub New()
  331. SetStyle(ControlStyles.AllPaintingInWmPaint Or _
  332. ControlStyles.ResizeRedraw Or _
  333. ControlStyles.UserPaint Or _
  334. ControlStyles.DoubleBuffer, True)
  335. DoubleBuffered = True
  336. End Sub
  337. Protected Overrides Sub CreateHandle()
  338. MyBase.CreateHandle()
  339. Alignment = TabAlignment.Top
  340. End Sub
  341. Dim C1 As Color = Color.FromArgb(62, 60, 58)
  342. Dim C2 As Color = Color.FromArgb(80, 78, 76)
  343. Dim C3 As Color = Color.FromArgb(51, 49, 47)
  344. Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  345. Dim B As New Bitmap(Width, Height)
  346. Dim G As Graphics = Graphics.FromImage(B)
  347. Try : SelectedTab.BackColor = C1 : Catch : End Try
  348. G.Clear(Parent.BackColor)
  349. For i = 0 To TabCount - 1
  350. If Not i = SelectedIndex Then
  351. Dim x2 As Rectangle = New Rectangle(GetTabRect(i).X, GetTabRect(i).Y + 3, GetTabRect(i).Width + 2, GetTabRect(i).Height)
  352. Dim G1 As New LinearGradientBrush(New Point(x2.X, x2.Y), New Point(x2.X, x2.Y + x2.Height), Color.FromArgb(60, 59, 58), Color.FromArgb(69, 69, 70))
  353. G.FillRectangle(G1, x2) : G1.Dispose()
  354. G.DrawRectangle(ToPen(C3), x2)
  355. G.DrawRectangle(ToPen(C2), New Rectangle(x2.X + 1, x2.Y + 1, x2.Width - 2, x2.Height))
  356. G.DrawString(TabPages(i).Text, Font, ToBrush(130, 176, 190), x2, New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
  357. End If
  358. Next
  359.  
  360. G.FillRectangle(ToBrush(C1), 0, ItemSize.Height, Width, Height)
  361. G.DrawRectangle(ToPen(C2), 0, ItemSize.Height, Width - 1, Height - ItemSize.Height - 1)
  362. G.DrawRectangle(ToPen(C3), 1, ItemSize.Height + 1, Width - 3, Height - ItemSize.Height - 3)
  363. If Not SelectedIndex = -1 Then
  364. Dim x1 As Rectangle = New Rectangle(GetTabRect(SelectedIndex).X - 2, GetTabRect(SelectedIndex).Y, GetTabRect(SelectedIndex).Width + 3, GetTabRect(SelectedIndex).Height)
  365. G.FillRectangle(ToBrush(C1), New Rectangle(x1.X + 2, x1.Y + 2, x1.Width - 2, x1.Height))
  366. G.DrawLine(ToPen(C2), New Point(x1.X, x1.Y + x1.Height - 2), New Point(x1.X, x1.Y))
  367. G.DrawLine(ToPen(C2), New Point(x1.X, x1.Y), New Point(x1.X + x1.Width, x1.Y))
  368. G.DrawLine(ToPen(C2), New Point(x1.X + x1.Width, x1.Y), New Point(x1.X + x1.Width, x1.Y + x1.Height - 2))
  369.  
  370. G.DrawLine(ToPen(C3), New Point(x1.X + 1, x1.Y + x1.Height - 1), New Point(x1.X + 1, x1.Y + 1))
  371. G.DrawLine(ToPen(C3), New Point(x1.X + 1, x1.Y + 1), New Point(x1.X + x1.Width - 1, x1.Y + 1))
  372. G.DrawLine(ToPen(C3), New Point(x1.X + x1.Width - 1, x1.Y + 1), New Point(x1.X + x1.Width - 1, x1.Y + x1.Height - 1))
  373.  
  374. G.DrawString(TabPages(SelectedIndex).Text, Font, ToBrush(130, 176, 190), x1, New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
  375. End If
  376.  
  377. e.Graphics.DrawImage(B.Clone, 0, 0)
  378. G.Dispose() : B.Dispose()
  379. End Sub
  380. End Class
  381.  
  382. Public Class SkyDarkCombo
  383. Inherits ComboBox
  384. Sub New()
  385. MyBase.New()
  386. SetStyle(ControlStyles.AllPaintingInWmPaint Or _
  387. ControlStyles.ResizeRedraw Or _
  388. ControlStyles.UserPaint Or _
  389. ControlStyles.DoubleBuffer, True)
  390. DrawMode = Windows.Forms.DrawMode.OwnerDrawFixed
  391. BackColor = Color.FromArgb(235, 235, 235)
  392. ForeColor = Color.FromArgb(31, 31, 31)
  393. DropDownStyle = ComboBoxStyle.DropDownList
  394. End Sub
  395. Private _StartIndex As Integer = 0
  396. Public Property StartIndex As Integer
  397. Get
  398. Return _StartIndex
  399. End Get
  400. Set(ByVal value As Integer)
  401. _StartIndex = value
  402. Try
  403. MyBase.SelectedIndex = value
  404. Catch
  405. End Try
  406. Invalidate()
  407. End Set
  408. End Property
  409.  
  410. Dim C1 As Color = Color.FromArgb(48, 48, 48)
  411. Dim C2 As Color = Color.FromArgb(81, 79, 77)
  412. Dim C3 As Color = Color.FromArgb(62, 60, 58)
  413.  
  414. Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  415. If Not DropDownStyle = ComboBoxStyle.DropDownList Then DropDownStyle = ComboBoxStyle.DropDownList
  416. Dim B As New Bitmap(Width, Height)
  417. Dim G As Graphics = Graphics.FromImage(B)
  418.  
  419. G.Clear(C3)
  420.  
  421.  
  422. Dim S1 As Integer = G.MeasureString("...", Font).Height
  423. If SelectedIndex <> -1 Then
  424.  
  425. G.DrawString(Items(SelectedIndex), Font, ToBrush(152, 182, 192), 4, Height \ 2 - S1 \ 2)
  426. Else
  427. If Not Items Is Nothing And Items.Count > 0 Then
  428. G.DrawString(Items(0), Font, ToBrush(152, 182, 192), 4, Height \ 2 - S1 \ 2)
  429. Else
  430. G.DrawString("...", Font, ToBrush(152, 182, 192), 4, Height \ 2 - S1 \ 2)
  431. End If
  432. End If
  433.  
  434. Dim G1 As New LinearGradientBrush(New Point(Width - 30, Height \ 2), New Point(Width - 22, Height \ 2), Color.Transparent, C3)
  435. G.FillRectangle(G1, Width - 30, 0, 8, Height)
  436.  
  437. G.DrawRectangle(ToPen(C1), New Rectangle(0, 0, Width - 1, Height - 1))
  438. G.DrawLine(ToPen(C1), New Point(Width - 21, 0), New Point(Width - 21, Height))
  439.  
  440. G.DrawRectangle(ToPen(C2), 1, 1, Width - 23, Height - 3)
  441.  
  442. G.FillRectangle(ToBrush(C3), Width - 20, 1, 18, Height - 3)
  443. G.FillRectangle(ToBrush(10, Color.White), Width - 20, 1, 18, Height - 3)
  444. G.DrawRectangle(ToPen(C2), Width - 20, 1, 18, Height - 3)
  445.  
  446. G.FillPolygon(Brushes.Black, Shapes.Triangle(New Point(Width - 12, Height \ 2), New Size(5, 3)))
  447. G.FillPolygon(Brushes.LightBlue, Shapes.Triangle(New Point(Width - 13, Height \ 2 - 1), New Size(5, 3)))
  448.  
  449. e.Graphics.DrawImage(B.Clone, 0, 0)
  450. G.Dispose() : B.Dispose()
  451. End Sub
  452. Sub ReplaceItem(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles Me.DrawItem
  453. Dim G As Graphics = e.Graphics
  454. Dim C4 As Color = Color.Empty
  455. e.DrawBackground()
  456. Try
  457. If e.State And DrawItemState.Selected = DrawItemState.Selected Then
  458. G.FillRectangle(ToBrush(50, 80, 120), New Rectangle(e.Bounds.X - 1, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height + 2))
  459. G.DrawRectangle(New Pen(ToBrush(180, Color.Black), 1), New Rectangle(e.Bounds.X - 1, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height + 2))
  460. C4 = Color.FromArgb(100, 165, 185)
  461. Else
  462. G.FillRectangle(ToBrush(62, 60, 58), New Rectangle(e.Bounds.X - 1, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height + 2))
  463. C4 = Color.FromArgb(200, 200, 200)
  464. End If
  465.  
  466. G.DrawString(MyBase.GetItemText(MyBase.Items(e.Index)), e.Font, ToBrush(C4), e.Bounds, New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
  467. Catch : End Try
  468. End Sub
  469.  
  470. Private Sub SkyDarkCombo_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.TextChanged
  471. Invalidate()
  472. End Sub
  473. End Class
  474.  
  475. Public Class SkyDarkTop
  476. Inherits Control
  477.  
  478. Sub New()
  479. DoubleBuffered = True
  480. Size = New Size(10, 10)
  481. End Sub
  482. Dim C1 As Color = Color.FromArgb(94, 103, 106)
  483. Dim C2 As Color = Color.FromArgb(152, 182, 192)
  484. Dim CD As Color = Color.FromArgb(86, 94, 96)
  485. Dim C3 As Color = Color.FromArgb(71, 70, 69)
  486. Dim C4 As Color = Color.FromArgb(58, 56, 54)
  487. Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  488. Dim B As New Bitmap(Width, Height)
  489. Dim G As Graphics = Graphics.FromImage(B)
  490. Dim G1 As New LinearGradientBrush(New Point(0, 0), New Point(0, Height), C3, C4)
  491. G.FillRectangle(G1, ClientRectangle)
  492. G1.Dispose()
  493. G.SmoothingMode = SmoothingMode.HighQuality
  494. Select Case State
  495. Case MouseState.None
  496. G.DrawEllipse(New Pen(C1, 2), New Rectangle(2, 2, Width - 5, Height - 5))
  497. Case MouseState.Over
  498. G.DrawEllipse(New Pen(C2, 2), New Rectangle(2, 2, Width - 5, Height - 5))
  499. Case MouseState.Down
  500. G.DrawEllipse(New Pen(CD, 2), New Rectangle(2, 2, Width - 5, Height - 5))
  501. End Select
  502.  
  503. G.FillEllipse(ToBrush(C2), New Rectangle(5, 5, Width - 11, Height - 11))
  504.  
  505. e.Graphics.DrawImage(B.Clone, 0, 0)
  506. G.Dispose() : B.Dispose()
  507. End Sub
  508.  
  509. #Region "Mouse States"
  510. Enum MouseState
  511. None
  512. Over
  513. Down
  514. End Enum
  515. Private ms As MouseState
  516. Private Property State() As MouseState
  517. Get
  518. Return ms
  519. End Get
  520. Set(ByVal value As MouseState)
  521. ms = value
  522. Invalidate()
  523. End Set
  524. End Property
  525. Protected Overrides Sub OnMouseEnter(ByVal e As System.EventArgs)
  526. MyBase.OnMouseEnter(e) : State = MouseState.Over
  527. End Sub
  528. Protected Overrides Sub OnMouseLeave(ByVal e As System.EventArgs)
  529. MyBase.OnMouseLeave(e) : State = MouseState.None
  530. End Sub
  531. Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  532. MyBase.OnMouseDown(e) : State = MouseState.Down
  533. End Sub
  534. Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
  535. MyBase.OnMouseUp(e) : State = MouseState.Over
  536. End Sub
  537. #End Region
  538. End Class
  539.  
  540. Public Class SkyDarkSeperator
  541. Inherits Control
  542.  
  543. Public Enum Alignment
  544. Vertical
  545. Horizontal
  546. End Enum
  547.  
  548. Private al As Alignment
  549. Public Property Align() As Alignment
  550. Get
  551. Return al
  552. End Get
  553. Set(ByVal value As Alignment)
  554. al = value
  555. Invalidate()
  556. End Set
  557. End Property
  558.  
  559. Dim C1 As Color = Color.FromArgb(51, 49, 47)
  560. Dim C2 As Color = Color.FromArgb(90, 91, 90)
  561. Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  562. Dim B As New Bitmap(Width, Height)
  563. Dim G As Graphics = Graphics.FromImage(B)
  564.  
  565. Select Case Align
  566. Case Alignment.Horizontal
  567. G.DrawLine(ToPen(C1), New Point(0, Height \ 2), New Point(Width, Height \ 2))
  568. G.DrawLine(ToPen(C2), New Point(0, Height \ 2 + 1), New Point(Width, Height \ 2 + 1))
  569. Case Alignment.Vertical
  570. G.DrawLine(ToPen(C1), New Point(Width \ 2, 0), New Point(Width \ 2, Height))
  571. G.DrawLine(ToPen(C2), New Point(Width \ 2 + 1, 0), New Point(Width \ 2 + 1, Height))
  572. End Select
  573.  
  574. e.Graphics.DrawImage(B, 0, 0)
  575. G.Dispose() : B.Dispose()
  576. End Sub
  577. End Class
  578.  
  579. Public Class SkyDarkCheck
  580. Inherits Control
  581.  
  582. Enum MouseState
  583. None
  584. Down
  585. End Enum
  586.  
  587. #Region "Properties"
  588.  
  589. Private chk As Boolean
  590. Public Property Checked() As Boolean
  591. Get
  592. Return chk
  593. End Get
  594. Set(ByVal value As Boolean)
  595. chk = value
  596. Invalidate()
  597. End Set
  598. End Property
  599.  
  600. Private ms As MouseState
  601. Public Property State() As MouseState
  602. Get
  603. Return ms
  604. End Get
  605. Set(ByVal value As MouseState)
  606. ms = value
  607. invalidate()
  608. End Set
  609. End Property
  610.  
  611. #End Region
  612.  
  613. Dim C1 As Color = Color.FromArgb(51, 49, 47)
  614. Dim C2 As Color = Color.FromArgb(80, 77, 77)
  615.  
  616. Dim C3 As Color = Color.FromArgb(70, 69, 68)
  617. Dim C4 As Color = Color.FromArgb(64, 60, 59)
  618. Dim C5 As Color = Color.Transparent
  619.  
  620. Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  621. Dim B As New Bitmap(Width, Height)
  622. Dim G As Graphics = Graphics.FromImage(B)
  623.  
  624. G.Clear(Parent.BackColor)
  625. C3 = Color.FromArgb(70, 69, 68)
  626. C4 = Color.FromArgb(64, 60, 59)
  627. Select Case Enabled
  628. Case True
  629. Select Case State
  630. Case MouseState.Down
  631. C5 = Color.FromArgb(121, 151, 160)
  632. C3 = Color.FromArgb(64, 60, 59)
  633. C4 = Color.FromArgb(70, 69, 68)
  634. Case MouseState.None
  635. C5 = Color.FromArgb(151, 181, 190)
  636. End Select
  637. Case False
  638. C5 = Color.FromArgb(88, 88, 88)
  639. End Select
  640.  
  641. Dim chkRec As New Rectangle(0, 0, Height - 1, Height - 1)
  642. Dim G1 As New LinearGradientBrush(New Point(chkRec.X, chkRec.Y), New Point(chkRec.X, chkRec.Y + chkRec.Height), C3, C4)
  643. G.FillRectangle(G1, chkRec) : G1.Dispose()
  644. G.DrawRectangle(ToPen(C1), chkRec)
  645. G.DrawRectangle(ToPen(C2), New Rectangle(chkRec.X + 1, chkRec.Y + 1, chkRec.Width - 2, chkRec.Height - 2))
  646. Dim chkPoly As Rectangle = New Rectangle(chkRec.X + chkRec.Width / 4, chkRec.Y + chkRec.Height / 4, chkRec.Width \ 2, chkRec.Height \ 2)
  647. Dim Poly() As Point = {New Point(chkPoly.X, chkPoly.Y + chkPoly.Height \ 2), _
  648. New Point(chkPoly.X + chkPoly.Width \ 2, chkPoly.Y + chkPoly.Height), _
  649. New Point(chkPoly.X + chkPoly.Width, chkPoly.Y)}
  650.  
  651. If Checked Then
  652. G.SmoothingMode = SmoothingMode.HighQuality
  653. Dim P1 As New Pen(ToBrush(C5), 2)
  654. For i = 0 To Poly.Length - 2
  655. G.DrawLine(P1, Poly(i), Poly(i + 1))
  656. Next
  657. End If
  658. G.DrawString(Text, Font, ToBrush(C5), New Rectangle(chkRec.X + chkRec.Width + 5, 0, Width - chkRec.X - chkRec.Width - 5, Height), New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Near})
  659.  
  660. e.Graphics.DrawImage(B, 0, 0)
  661. G.Dispose() : B.Dispose()
  662. End Sub
  663.  
  664. Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
  665. If Enabled Then : State = MouseState.None : Checked = Not Checked : End If
  666. End Sub
  667.  
  668. Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  669. If Enabled Then : State = MouseState.Down : End If
  670. End Sub
  671. End Class
  672.  
  673. Public Class SkyDarkRadio
  674. Inherits Control
  675.  
  676. Enum MouseState
  677. None
  678. Down
  679. End Enum
  680.  
  681. #Region "Properties"
  682.  
  683. Private ms As MouseState
  684. Public Property State() As MouseState
  685. Get
  686. Return ms
  687. End Get
  688. Set(ByVal value As MouseState)
  689. ms = value
  690. Invalidate()
  691. End Set
  692. End Property
  693.  
  694. Private chk As Boolean
  695. Public Property Checked() As Boolean
  696. Get
  697. Return chk
  698. End Get
  699. Set(ByVal value As Boolean)
  700. chk = value
  701. Invalidate()
  702. ''Error code: Whenever I add this it overflows like an infinite loop...
  703. Try
  704. If value Then
  705. For Each ctl In Parent.Controls
  706. If TypeOf ctl Is SkyDarkRadio Then
  707. If Not ctl Is Me And DirectCast(ctl, SkyDarkRadio).Enabled Then
  708. DirectCast(ctl, SkyDarkRadio).Checked = False
  709. End If
  710. End If
  711. Next
  712. End If
  713. Catch : End Try
  714. End Set
  715. End Property
  716.  
  717. #End Region
  718.  
  719. Sub New()
  720. Size = New Size(Width, 13)
  721. End Sub
  722.  
  723. Dim C1 As Color = Color.FromArgb(35, 35, 35)
  724. Dim C2 As Color = Color.Transparent
  725. Dim C3 As Color = Color.Transparent
  726. Dim C4 As Color = Color.Transparent
  727. Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  728. Dim B As New Bitmap(Width, Height)
  729. Dim G As Graphics = Graphics.FromImage(B)
  730.  
  731. G.Clear(Parent.BackColor)
  732.  
  733. Select Case Enabled
  734. Case True
  735. Select Case State
  736. Case MouseState.None
  737. C2 = Color.FromArgb(70, 70, 70)
  738. C3 = Color.FromArgb(54, 54, 51)
  739. C4 = Color.FromArgb(152, 182, 192)
  740. Case MouseState.Down
  741. C2 = Color.FromArgb(54, 54, 51)
  742. C3 = Color.FromArgb(70, 70, 70)
  743. C4 = Color.FromArgb(112, 142, 152)
  744. End Select
  745. Case False
  746. C2 = Color.FromArgb(70, 70, 70)
  747. C3 = Color.FromArgb(54, 54, 51)
  748. C4 = Color.FromArgb(89, 88, 88)
  749. End Select
  750.  
  751. Dim radRec As New Rectangle(0, 0, Height - 1, Height - 1)
  752. Dim B1 As New LinearGradientBrush(New Point(radRec.X + radRec.Width / 2, radRec.Y), New Point(radRec.X + radRec.Width / 2, radRec.Y + radRec.Height), C2, C3)
  753. G.SmoothingMode = SmoothingMode.HighQuality
  754. G.FillEllipse(B1, radRec)
  755. G.DrawEllipse(New Pen(ToBrush(C1)), radRec)
  756. If Checked Then G.FillEllipse(ToBrush(C4), New Rectangle(radRec.X + radRec.Width / 4, radRec.Y + radRec.Height / 4, radRec.Width / 2, radRec.Height / 2))
  757. G.DrawString(Text, Font, ToBrush(C4), New Rectangle(radRec.X + radRec.Width + 5, 0, Width - radRec.X - radRec.Width - 5, Height), New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Near})
  758.  
  759.  
  760. e.Graphics.DrawImage(B, 0, 0)
  761. G.Dispose() : B.Dispose()
  762. End Sub
  763.  
  764. Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
  765. If Enabled Then : State = MouseState.None : If Not Checked Then : Checked = True : End If : End If
  766. End Sub
  767.  
  768. Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  769. If Not Enabled Then State = MouseState.Down
  770. End Sub
  771. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement