Guest User

VB.Net Sky Dark Theme [Leaked]

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