xVisual Theme


SUBMITTED BY: Guest

DATE: June 5, 2014, 9:33 a.m.

FORMAT: Text only

SIZE: 71.6 kB

HITS: 812

  1. Imports System.Drawing.Drawing2D
  2. Imports System.ComponentModel
  3. 'PLEASE LEAVE CREDITS IN SOURCE, DO NOT REDISTRIBUTE!
  4. '--------------------- [ Theme ] --------------------
  5. 'Creator: Mephobia
  6. 'Contact: Mephobia.HF (Skype)
  7. 'Created: 6.19.2013
  8. 'Changed: 6.19.2013
  9. '-------------------- [ /Theme ] ---------------------
  10. 'PLEASE LEAVE CREDITS IN SOURCE, DO NOT REDISTRIBUTE!
  11. Enum MouseState As Byte
  12. None = 0
  13. Over = 1
  14. Down = 2
  15. Block = 3
  16. End Enum
  17. Module Draw
  18. Public Function GetBrush(ByVal c As Color) As SolidBrush
  19. Return New SolidBrush(c)
  20. End Function
  21. Public Function GetPen(ByVal c As Color) As Pen
  22. Return New Pen(New SolidBrush(c))
  23. End Function
  24. Function NoiseBrush(colors As Color()) As TextureBrush
  25. Dim B As New Bitmap(128, 128)
  26. Dim R As New Random(128)
  27. For X As Integer = 0 To B.Width - 1
  28. For Y As Integer = 0 To B.Height - 1
  29. B.SetPixel(X, Y, colors(R.Next(colors.Length)))
  30. Next
  31. Next
  32. Dim T As New TextureBrush(B)
  33. B.Dispose()
  34. Return T
  35. End Function
  36. Private CreateRoundPath As GraphicsPath
  37. Private CreateCreateRoundangle As Rectangle
  38. Function CreateRound(ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal slope As Integer) As GraphicsPath
  39. CreateCreateRoundangle = New Rectangle(x, y, width, height)
  40. Return CreateRound(CreateCreateRoundangle, slope)
  41. End Function
  42. Function CreateRound(ByVal r As Rectangle, ByVal slope As Integer) As GraphicsPath
  43. CreateRoundPath = New GraphicsPath(FillMode.Winding)
  44. CreateRoundPath.AddArc(r.X, r.Y, slope, slope, 180.0F, 90.0F)
  45. CreateRoundPath.AddArc(r.Right - slope, r.Y, slope, slope, 270.0F, 90.0F)
  46. CreateRoundPath.AddArc(r.Right - slope, r.Bottom - slope, slope, slope, 0.0F, 90.0F)
  47. CreateRoundPath.AddArc(r.X, r.Bottom - slope, slope, slope, 90.0F, 90.0F)
  48. CreateRoundPath.CloseFigure()
  49. Return CreateRoundPath
  50. End Function
  51. Public Sub InnerGlow(ByVal G As Graphics, ByVal Rectangle As Rectangle, ByVal Colors As Color())
  52. Dim SubtractTwo As Integer = 1
  53. Dim AddOne As Integer = 0
  54. For Each c In Colors
  55. G.DrawRectangle(New Pen(New SolidBrush(Color.FromArgb(c.R, c.B, c.G))), Rectangle.X + AddOne, Rectangle.Y + AddOne, Rectangle.Width - SubtractTwo, Rectangle.Height - SubtractTwo)
  56. SubtractTwo += 2
  57. AddOne += 1
  58. Next
  59. End Sub
  60. Public Sub InnerGlowRounded(ByVal G As Graphics, ByVal Rectangle As Rectangle, ByVal Degree As Integer, ByVal Colors As Color())
  61. Dim SubtractTwo As Integer = 1
  62. Dim AddOne As Integer = 0
  63. For Each c In Colors
  64. G.DrawPath(New Pen(New SolidBrush(Color.FromArgb(c.R, c.B, c.G))), Draw.CreateRound(Rectangle.X + AddOne, Rectangle.Y + AddOne, Rectangle.Width - SubtractTwo, Rectangle.Height - SubtractTwo, Degree))
  65. SubtractTwo += 2
  66. AddOne += 1
  67. Next
  68. End Sub
  69. End Module
  70. Public Class xVisualTheme : Inherits ContainerControl
  71. Sub New()
  72. SetStyle(ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  73. BackColor = Color.FromArgb(46, 43, 40)
  74. DoubleBuffered = True
  75. End Sub
  76. Dim TopTexture As TextureBrush = NoiseBrush({Color.FromArgb(66, 64, 62), Color.FromArgb(63, 61, 59), Color.FromArgb(69, 67, 65)})
  77. Dim InnerTexture As TextureBrush = NoiseBrush({Color.FromArgb(57, 53, 50), Color.FromArgb(56, 52, 49), Color.FromArgb(58, 55, 51)})
  78. Dim drawFont As New Font("Arial", 11, FontStyle.Bold)
  79. Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  80. Dim G As Graphics = e.Graphics
  81. MyBase.OnPaint(e)
  82. G.Clear(Color.Fuchsia)
  83. Dim mainRect As New Rectangle(0, 0, Width, Height)
  84. Dim LeftHighlight As New LinearGradientBrush(New Rectangle(0, 0, Width, Height), Color.FromArgb(66, 64, 63), Color.FromArgb(56, 54, 53), 90S)
  85. Dim RightHighlight As New LinearGradientBrush(New Rectangle(0, 0, Width, Height), Color.FromArgb(80, 78, 77), Color.FromArgb(70, 68, 67), 90S)
  86. Dim TopOverlay As New LinearGradientBrush(New Rectangle(0, 0, Width - 1, 53), Color.FromArgb(15, Color.White), Color.FromArgb(100, Color.FromArgb(43, 40, 38)), 90S)
  87. Dim mainGradient As New LinearGradientBrush(mainRect, Color.FromArgb(73, 71, 69), Color.FromArgb(69, 67, 64), 90S)
  88. G.FillRectangle(mainGradient, mainRect) 'Outside Rectangle
  89. G.DrawRectangle(Pens.Black, New Rectangle(0, 0, Width - 1, Height - 1))
  90. G.FillRectangle(InnerTexture, New Rectangle(10, 53, Width - 21, Height - 84)) 'Inner Rectangle
  91. G.DrawRectangle(Pens.Black, New Rectangle(10, 53, Width - 21, Height - 84))
  92. G.FillRectangle(TopTexture, New Rectangle(0, 0, Width - 1, 53)) 'Top Bar Rectangle
  93. G.FillRectangle(TopOverlay, New Rectangle(0, 0, Width - 1, 53))
  94. G.DrawRectangle(Pens.Black, New Rectangle(0, 0, Width - 1, 53))
  95. Dim blend As ColorBlend = New ColorBlend()
  96. 'Add the Array of Color
  97. Dim bColors As Color() = New Color() {Color.FromArgb(10, Color.White), Color.FromArgb(10, Color.Black), Color.FromArgb(10, Color.White)}
  98. blend.Colors = bColors
  99. 'Add the Array Single (0-1) colorpoints to place each Color
  100. Dim bPts As Single() = New Single() {0, 0.7, 1}
  101. blend.Positions = bPts
  102. Dim rect As New Rectangle(0, 0, Width - 1, 53)
  103. Using br As New LinearGradientBrush(rect, Color.White, Color.Black, LinearGradientMode.Vertical)
  104. 'Blend the colors into the Brush
  105. br.InterpolationColors = blend
  106. 'Fill the rect with the blend
  107. G.FillRectangle(br, rect)
  108. End Using
  109. G.DrawLine(GetPen(Color.FromArgb(173, 172, 172)), 4, 1, Width - 5, 1) 'Top Middle Highlight
  110. G.DrawLine(GetPen(Color.FromArgb(110, 109, 107)), 11, Height - 30, Width - 12, Height - 30) 'Bottom Middle Highlight
  111. G.FillRectangle(GetBrush(Color.FromArgb(173, 172, 172)), 3, 2, 1, 1) 'Top Left Corner Highlight
  112. G.FillRectangle(GetBrush(Color.FromArgb(133, 132, 132)), 2, 2, 1, 1)
  113. G.FillRectangle(GetBrush(Color.FromArgb(113, 112, 112)), 2, 3, 1, 1)
  114. G.FillRectangle(GetBrush(Color.FromArgb(83, 82, 82)), 1, 4, 1, 1)
  115. G.FillRectangle(GetBrush(Color.FromArgb(173, 172, 172)), Width - 4, 2, 1, 1) 'Top Right Corner Highlight
  116. G.FillRectangle(GetBrush(Color.FromArgb(133, 132, 132)), Width - 3, 2, 1, 1)
  117. G.FillRectangle(GetBrush(Color.FromArgb(113, 112, 112)), Width - 3, 3, 1, 1)
  118. G.FillRectangle(GetBrush(Color.FromArgb(83, 82, 82)), Width - 2, 4, 1, 1)
  119. '// Shadows
  120. G.DrawLine(GetPen(Color.FromArgb(91, 90, 89)), 1, 52, Width - 2, 52) 'Middle Top Horizontal
  121. G.DrawLine(GetPen(Color.FromArgb(40, 37, 34)), 11, 54, Width - 12, 54)
  122. G.DrawLine(GetPen(Color.FromArgb(45, 42, 39)), 11, 55, Width - 12, 55)
  123. G.DrawLine(GetPen(Color.FromArgb(50, 47, 44)), 11, 56, Width - 12, 56)
  124. G.DrawLine(GetPen(Color.FromArgb(50, 47, 44)), 11, Height - 32, Width - 12, Height - 32) 'Middle Bottom Horizontal
  125. G.DrawLine(GetPen(Color.FromArgb(52, 49, 46)), 11, Height - 33, Width - 12, Height - 33)
  126. G.DrawLine(GetPen(Color.FromArgb(54, 51, 48)), 11, Height - 34, Width - 12, Height - 34)
  127. G.DrawLine(GetPen(Color.FromArgb(59, 57, 55)), 1, 54, 9, 54) 'Left Horizontal
  128. G.DrawLine(GetPen(Color.FromArgb(64, 62, 60)), 1, 55, 9, 55)
  129. G.DrawLine(GetPen(Color.FromArgb(73, 71, 69)), 1, 56, 9, 56)
  130. G.DrawLine(GetPen(Color.FromArgb(59, 57, 55)), Width - 10, 54, Width - 2, 54) 'Right Horizontal
  131. G.DrawLine(GetPen(Color.FromArgb(64, 62, 60)), Width - 10, 55, Width - 2, 55)
  132. G.DrawLine(GetPen(Color.FromArgb(73, 71, 69)), Width - 10, 56, Width - 2, 56)
  133. G.DrawLine(GetPen(Color.FromArgb(59, 57, 55)), 1, 54, 1, Height - 5) 'Left Vertical
  134. G.DrawLine(GetPen(Color.FromArgb(64, 62, 60)), 2, 55, 2, Height - 4)
  135. G.DrawLine(GetPen(Color.FromArgb(73, 71, 69)), 3, 56, 3, Height - 3)
  136. G.DrawLine(New Pen(LeftHighlight), 1, 5, 1, 51)
  137. G.DrawLine(New Pen(RightHighlight), 2, 5, 2, 51)
  138. G.DrawLine(GetPen(Color.FromArgb(69, 67, 65)), 9, 56, 9, Height - 31)
  139. G.DrawLine(GetPen(Color.FromArgb(59, 57, 55)), Width - 2, 54, Width - 2, Height - 5) 'Right Vertical
  140. G.DrawLine(GetPen(Color.FromArgb(64, 62, 60)), Width - 3, 55, Width - 3, Height - 4)
  141. G.DrawLine(GetPen(Color.FromArgb(73, 71, 69)), Width - 4, 56, Width - 4, Height - 3)
  142. G.DrawLine(New Pen(LeftHighlight), Width - 2, 5, Width - 2, 51)
  143. G.DrawLine(New Pen(RightHighlight), Width - 3, 5, Width - 3, 51)
  144. G.DrawLine(GetPen(Color.FromArgb(69, 67, 65)), Width - 10, 56, Width - 10, Height - 31)
  145. G.DrawString(Text, drawFont, New SolidBrush(Color.FromArgb(255, 255, 255)), New Rectangle(0, 0, Width, 37), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  146. '////left upper corner
  147. G.FillRectangle(Brushes.Fuchsia, 0, 0, 1, 1)
  148. G.FillRectangle(Brushes.Fuchsia, 1, 0, 1, 1)
  149. G.FillRectangle(Brushes.Fuchsia, 2, 0, 1, 1)
  150. G.FillRectangle(Brushes.Fuchsia, 3, 0, 1, 1)
  151. G.FillRectangle(Brushes.Fuchsia, 0, 1, 1, 1)
  152. G.FillRectangle(Brushes.Fuchsia, 0, 2, 1, 1)
  153. G.FillRectangle(Brushes.Fuchsia, 0, 3, 1, 1)
  154. G.FillRectangle(Brushes.Fuchsia, 1, 1, 1, 1)
  155. G.FillRectangle(Brushes.Black, 1, 3, 1, 1)
  156. G.FillRectangle(Brushes.Black, 1, 2, 1, 1)
  157. G.FillRectangle(Brushes.Black, 2, 1, 1, 1)
  158. G.FillRectangle(Brushes.Black, 3, 1, 1, 1)
  159. ''////right upper corner
  160. G.FillRectangle(Brushes.Fuchsia, Width - 1, 0, 1, 1)
  161. G.FillRectangle(Brushes.Fuchsia, Width - 2, 0, 1, 1)
  162. G.FillRectangle(Brushes.Fuchsia, Width - 3, 0, 1, 1)
  163. G.FillRectangle(Brushes.Fuchsia, Width - 4, 0, 1, 1)
  164. G.FillRectangle(Brushes.Fuchsia, Width - 1, 1, 1, 1)
  165. G.FillRectangle(Brushes.Fuchsia, Width - 1, 2, 1, 1)
  166. G.FillRectangle(Brushes.Fuchsia, Width - 1, 3, 1, 1)
  167. G.FillRectangle(Brushes.Fuchsia, Width - 2, 1, 1, 1)
  168. G.FillRectangle(Brushes.Black, Width - 2, 3, 1, 1)
  169. G.FillRectangle(Brushes.Black, Width - 2, 2, 1, 1)
  170. G.FillRectangle(Brushes.Black, Width - 3, 1, 1, 1)
  171. G.FillRectangle(Brushes.Black, Width - 4, 1, 1, 1)
  172. ''////left bottom corner
  173. G.FillRectangle(Brushes.Fuchsia, 0, Height - 1, 1, 1)
  174. G.FillRectangle(Brushes.Fuchsia, 0, Height - 2, 1, 1)
  175. G.FillRectangle(Brushes.Fuchsia, 0, Height - 3, 1, 1)
  176. G.FillRectangle(Brushes.Fuchsia, 0, Height - 4, 1, 1)
  177. G.FillRectangle(Brushes.Fuchsia, 1, Height - 1, 1, 1)
  178. G.FillRectangle(Brushes.Fuchsia, 2, Height - 1, 1, 1)
  179. G.FillRectangle(Brushes.Fuchsia, 3, Height - 1, 1, 1)
  180. G.FillRectangle(Brushes.Fuchsia, 1, Height - 1, 1, 1)
  181. G.FillRectangle(Brushes.Fuchsia, 1, Height - 2, 1, 1)
  182. G.FillRectangle(Brushes.Black, 1, Height - 3, 1, 1)
  183. G.FillRectangle(Brushes.Black, 1, Height - 4, 1, 1)
  184. G.FillRectangle(Brushes.Black, 3, Height - 2, 1, 1)
  185. G.FillRectangle(Brushes.Black, 2, Height - 2, 1, 1)
  186. ''////right bottom corner
  187. G.FillRectangle(Brushes.Fuchsia, Width - 1, Height, 1, 1)
  188. G.FillRectangle(Brushes.Fuchsia, Width - 2, Height, 1, 1)
  189. G.FillRectangle(Brushes.Fuchsia, Width - 3, Height, 1, 1)
  190. G.FillRectangle(Brushes.Fuchsia, Width - 4, Height, 1, 1)
  191. G.FillRectangle(Brushes.Fuchsia, Width - 1, Height - 1, 1, 1)
  192. G.FillRectangle(Brushes.Fuchsia, Width - 1, Height - 2, 1, 1)
  193. G.FillRectangle(Brushes.Fuchsia, Width - 1, Height - 3, 1, 1)
  194. G.FillRectangle(Brushes.Fuchsia, Width - 2, Height - 1, 1, 1)
  195. G.FillRectangle(Brushes.Fuchsia, Width - 3, Height - 1, 1, 1)
  196. G.FillRectangle(Brushes.Fuchsia, Width - 4, Height - 1, 1, 1)
  197. G.FillRectangle(Brushes.Fuchsia, Width - 1, Height - 4, 1, 1)
  198. G.FillRectangle(Brushes.Fuchsia, Width - 2, Height - 2, 1, 1)
  199. G.FillRectangle(Brushes.Black, Width - 2, Height - 3, 1, 1)
  200. G.FillRectangle(Brushes.Black, Width - 2, Height - 4, 1, 1)
  201. G.FillRectangle(Brushes.Black, Width - 4, Height - 2, 1, 1)
  202. G.FillRectangle(Brushes.Black, Width - 3, Height - 2, 1, 1)
  203. End Sub
  204. Private MouseP As Point = New Point(0, 0)
  205. Private Cap As Boolean = False
  206. Private MoveHeight% = 53 : Private pos% = 0
  207. Dim State As MouseState = MouseState.None
  208. Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  209. MyBase.OnMouseDown(e)
  210. If e.Button = Windows.Forms.MouseButtons.Left And New Rectangle(0, 0, Width, MoveHeight).Contains(e.Location) Then
  211. Cap = True
  212. MouseP = e.Location
  213. End If
  214. State = MouseState.Down
  215. Invalidate()
  216. End Sub
  217. Protected Overrides Sub OnMouseEnter(ByVal e As System.EventArgs)
  218. MyBase.OnMouseEnter(e)
  219. State = MouseState.Over : Invalidate()
  220. End Sub
  221. Protected Overrides Sub OnMouseLeave(ByVal e As System.EventArgs)
  222. MyBase.OnMouseLeave(e)
  223. State = MouseState.None : Invalidate()
  224. End Sub
  225. Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
  226. MyBase.OnMouseUp(e) : Cap = False
  227. State = MouseState.Over : Invalidate()
  228. End Sub
  229. Protected Overrides Sub OnMouseMove(ByVal e As System.Windows.Forms.MouseEventArgs)
  230. MyBase.OnMouseMove(e)
  231. If Cap Then
  232. Parent.Location = MousePosition - MouseP
  233. End If
  234. Invalidate()
  235. End Sub
  236. Protected Overrides Sub OnCreateControl()
  237. MyBase.OnCreateControl()
  238. Me.ParentForm.FormBorderStyle = FormBorderStyle.None
  239. Me.ParentForm.TransparencyKey = Color.Fuchsia
  240. Dock = DockStyle.Fill
  241. End Sub
  242. End Class
  243. Public Class xVisualControlBox : Inherits Control
  244. Sub New()
  245. SetStyle(ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  246. BackColor = Color.Transparent
  247. ForeColor = Color.FromArgb(205, 205, 205)
  248. Size = New Size(83, 28)
  249. Location = New Point(12, 12)
  250. DoubleBuffered = True
  251. End Sub
  252. #Region " MouseStates "
  253. Dim State As MouseState = MouseState.None
  254. Dim X As Integer
  255. Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  256. MyBase.OnMouseDown(e)
  257. If X > 10 And X < 25 Then
  258. FindForm.Close()
  259. ElseIf X > 33 And X < 48 Then
  260. FindForm.WindowState = FormWindowState.Minimized
  261. ElseIf X > 56 And X < 71 Then
  262. If FindForm.WindowState = FormWindowState.Normal Then
  263. FindForm.WindowState = FormWindowState.Maximized
  264. Else
  265. FindForm.WindowState = FormWindowState.Normal
  266. End If
  267. End If
  268. State = MouseState.Down : Invalidate()
  269. End Sub
  270. Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
  271. MyBase.OnMouseUp(e)
  272. State = MouseState.Over : Invalidate()
  273. End Sub
  274. Protected Overrides Sub OnMouseEnter(ByVal e As System.EventArgs)
  275. MyBase.OnMouseEnter(e)
  276. State = MouseState.Over : Invalidate()
  277. End Sub
  278. Protected Overrides Sub OnMouseLeave(ByVal e As System.EventArgs)
  279. MyBase.OnMouseLeave(e)
  280. State = MouseState.None : Invalidate()
  281. End Sub
  282. Protected Overrides Sub OnMouseMove(ByVal e As System.Windows.Forms.MouseEventArgs)
  283. MyBase.OnMouseMove(e)
  284. X = e.Location.X
  285. Invalidate()
  286. End Sub
  287. #End Region
  288. Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  289. Dim B As New Bitmap(Width, Height)
  290. Dim G As Graphics = Graphics.FromImage(B)
  291. MyBase.OnPaint(e)
  292. G.Clear(BackColor)
  293. G.SmoothingMode = SmoothingMode.HighQuality
  294. Dim ControlGradient As New LinearGradientBrush(New Rectangle(10, 2, 15, 16), Color.FromArgb(67, 67, 67), Color.FromArgb(80, 80, 81), 90S)
  295. '// Control Box
  296. G.FillEllipse(ControlGradient, New Rectangle(10, 2, 15, 16)) 'Main Circle
  297. G.FillEllipse(ControlGradient, New Rectangle(33, 2, 15, 16))
  298. G.FillEllipse(ControlGradient, New Rectangle(56, 2, 15, 16))
  299. G.DrawEllipse(Pens.Black, New Rectangle(10, 2, 15, 16))
  300. G.DrawEllipse(Pens.Black, New Rectangle(33, 2, 15, 16))
  301. G.DrawEllipse(Pens.Black, New Rectangle(56, 2, 15, 16))
  302. Dim ControlTopCircle As New LinearGradientBrush(New Rectangle(13, 4, 9, 7), Color.FromArgb(193, 190, 176), Color.FromArgb(90, 91, 92), 90S)
  303. G.FillEllipse(ControlTopCircle, New Rectangle(13, 4, 9, 7)) 'Top Circle
  304. G.FillEllipse(ControlTopCircle, New Rectangle(36, 4, 9, 7)) 'Top Circle
  305. G.FillEllipse(ControlTopCircle, New Rectangle(59, 4, 9, 7)) 'Top Circle
  306. Dim NControlBottomCircle As New LinearGradientBrush(New Rectangle(13, 12, 9, 5), Color.FromArgb(90, 91, 92), Color.FromArgb(155, 165, 174), 90S)
  307. Select Case State
  308. Case MouseState.None
  309. None: G.FillEllipse(NControlBottomCircle, New Rectangle(13, 12, 9, 5)) 'Bottom Circle
  310. G.FillEllipse(NControlBottomCircle, New Rectangle(36, 12, 9, 5))
  311. G.FillEllipse(NControlBottomCircle, New Rectangle(59, 12, 9, 5))
  312. Case MouseState.Over
  313. If X > 10 And X < 25 Then
  314. Dim ControlBottomCircle As New LinearGradientBrush(New Rectangle(13, 12, 9, 5), Color.FromArgb(50, Color.Red), Color.FromArgb(10, Color.Red), 90S)
  315. G.FillEllipse(NControlBottomCircle, New Rectangle(13, 12, 9, 5)) 'Bottom Circle
  316. G.FillEllipse(ControlBottomCircle, New Rectangle(13, 12, 9, 5)) 'Bottom Circle
  317. G.FillEllipse(NControlBottomCircle, New Rectangle(36, 12, 9, 5))
  318. G.FillEllipse(NControlBottomCircle, New Rectangle(59, 12, 9, 5))
  319. ElseIf X > 33 And X < 48 Then
  320. Dim ControlBottomCircle As New LinearGradientBrush(New Rectangle(13, 12, 9, 5), Color.FromArgb(50, Color.Yellow), Color.FromArgb(10, Color.Yellow), 90S)
  321. G.FillEllipse(NControlBottomCircle, New Rectangle(13, 12, 9, 5)) 'Bottom Circle
  322. G.FillEllipse(NControlBottomCircle, New Rectangle(36, 12, 9, 5))
  323. G.FillEllipse(ControlBottomCircle, New Rectangle(36, 12, 9, 5))
  324. G.FillEllipse(NControlBottomCircle, New Rectangle(59, 12, 9, 5))
  325. ElseIf X > 56 And X < 71 Then
  326. Dim ControlBottomCircle As New LinearGradientBrush(New Rectangle(13, 12, 9, 5), Color.FromArgb(50, Color.Green), Color.FromArgb(10, Color.Green), 90S)
  327. G.FillEllipse(NControlBottomCircle, New Rectangle(13, 12, 9, 5)) 'Bottom Circle
  328. G.FillEllipse(NControlBottomCircle, New Rectangle(36, 12, 9, 5))
  329. G.FillEllipse(NControlBottomCircle, New Rectangle(59, 12, 9, 5))
  330. G.FillEllipse(ControlBottomCircle, New Rectangle(59, 12, 9, 5))
  331. Else
  332. GoTo None
  333. End If
  334. Case MouseState.Down
  335. End Select
  336. e.Graphics.DrawImage(B.Clone(), 0, 0)
  337. G.Dispose() : B.Dispose()
  338. End Sub
  339. End Class
  340. Public Class xVisualButton : Inherits Control
  341. #Region " MouseStates "
  342. Dim State As MouseState = MouseState.None
  343. Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  344. MyBase.OnMouseDown(e)
  345. State = MouseState.Down : Invalidate()
  346. End Sub
  347. Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
  348. MyBase.OnMouseUp(e)
  349. State = MouseState.Over : Invalidate()
  350. End Sub
  351. Protected Overrides Sub OnMouseEnter(ByVal e As System.EventArgs)
  352. MyBase.OnMouseEnter(e)
  353. State = MouseState.Over : Invalidate()
  354. End Sub
  355. Protected Overrides Sub OnMouseLeave(ByVal e As System.EventArgs)
  356. MyBase.OnMouseLeave(e)
  357. State = MouseState.None : Invalidate()
  358. End Sub
  359. #End Region
  360. Public Enum InnerShade
  361. Light
  362. Dark
  363. End Enum
  364. Private _Shade As InnerShade
  365. Property Shade As InnerShade
  366. Get
  367. Return _Shade
  368. End Get
  369. Set(ByVal value As InnerShade)
  370. _Shade = value
  371. Invalidate()
  372. End Set
  373. End Property
  374. Sub New()
  375. SetStyle(ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  376. BackColor = Color.Transparent
  377. ForeColor = Color.FromArgb(205, 205, 205)
  378. _Shade = InnerShade.Dark
  379. DoubleBuffered = True
  380. End Sub
  381. Dim InnerTexture As TextureBrush = NoiseBrush({Color.FromArgb(52, 48, 44), Color.FromArgb(54, 50, 46), Color.FromArgb(50, 46, 42)})
  382. Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  383. Dim B As New Bitmap(Width, Height)
  384. Dim G As Graphics = Graphics.FromImage(B)
  385. Dim ClientRectangle As New Rectangle(3, 3, Width - 7, Height - 7)
  386. MyBase.OnPaint(e)
  387. G.Clear(BackColor)
  388. G.SmoothingMode = SmoothingMode.HighQuality
  389. Select Case _Shade
  390. Case InnerShade.Dark
  391. G.FillPath(InnerTexture, Draw.CreateRound(ClientRectangle, 3))
  392. G.DrawPath(GetPen(Color.FromArgb(40, 38, 36)), Draw.CreateRound(New Rectangle(3, 3, Width - 6, Height - 6), 3))
  393. G.DrawPath(GetPen(Color.FromArgb(45, 43, 41)), Draw.CreateRound(New Rectangle(3, 3, Width - 6, Height - 5), 3))
  394. G.DrawPath(GetPen(Color.FromArgb(50, 48, 46)), Draw.CreateRound(New Rectangle(2, 2, Width - 5, Height - 3), 3))
  395. Dim HighlightGradient As New LinearGradientBrush(New Rectangle(4, 4, Width - 8, Height - 8), Color.FromArgb(160, 158, 157), Color.FromArgb(61, 57, 54), 90S)
  396. Dim hp As New Pen(HighlightGradient)
  397. G.DrawPath(hp, Draw.CreateRound(New Rectangle(4, 4, Width - 9, Height - 9), 3))
  398. Dim OutlineGradient As New LinearGradientBrush(New Rectangle(3, 3, Width - 7, Height - 6), Color.FromArgb(34, 32, 30), Color.Black, 90S)
  399. Dim op As New Pen(OutlineGradient)
  400. G.DrawPath(op, Draw.CreateRound(New Rectangle(3, 3, Width - 7, Height - 7), 3))
  401. Dim drawFont As New Font("Arial", 9, FontStyle.Bold)
  402. Select Case State
  403. Case MouseState.None
  404. G.DrawString(Text, drawFont, Brushes.White, New Rectangle(0, 0, Width - 1, Height - 1), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  405. Case MouseState.Over
  406. G.DrawString(Text, drawFont, Brushes.White, New Rectangle(0, 0, Width - 1, Height - 1), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  407. Case MouseState.Down
  408. G.DrawString(Text, drawFont, Brushes.White, New Rectangle(0, 0, Width - 1, Height - 1), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  409. End Select
  410. Case InnerShade.Light
  411. Dim MainGradient As New LinearGradientBrush(ClientRectangle, Color.FromArgb(225, 227, 230), Color.FromArgb(199, 201, 204), 90S)
  412. G.FillPath(MainGradient, Draw.CreateRound(ClientRectangle, 3))
  413. G.DrawPath(GetPen(Color.FromArgb(167, 168, 171)), Draw.CreateRound(New Rectangle(3, 3, Width - 6, Height - 6), 3))
  414. G.DrawPath(GetPen(Color.FromArgb(203, 205, 208)), Draw.CreateRound(New Rectangle(2, 2, Width - 5, Height - 4), 3))
  415. Dim HighlightGradient As New LinearGradientBrush(New Rectangle(4, 4, Width - 8, Height - 8), Color.FromArgb(255, 255, 255), Color.FromArgb(218, 219, 222), 90S)
  416. Dim hp As New Pen(HighlightGradient)
  417. G.DrawPath(hp, Draw.CreateRound(New Rectangle(4, 4, Width - 9, Height - 9), 3))
  418. Dim OutlineGradient As New LinearGradientBrush(New Rectangle(3, 3, Width - 7, Height - 6), Color.FromArgb(173, 174, 177), Color.FromArgb(110, 111, 114), 90S)
  419. Dim op As New Pen(OutlineGradient)
  420. G.DrawPath(op, Draw.CreateRound(New Rectangle(3, 3, Width - 7, Height - 7), 3))
  421. Dim drawFont As New Font("Arial", 9, FontStyle.Bold)
  422. Select Case State
  423. Case MouseState.None
  424. G.DrawString(Text, drawFont, GetBrush(Color.FromArgb(109, 109, 110)), New Rectangle(0, 0, Width - 1, Height - 1), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  425. Case MouseState.Over
  426. G.DrawString(Text, drawFont, GetBrush(Color.FromArgb(109, 109, 110)), New Rectangle(0, 0, Width - 1, Height - 1), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  427. Case MouseState.Down
  428. G.DrawString(Text, drawFont, GetBrush(Color.FromArgb(109, 109, 110)), New Rectangle(0, 0, Width - 1, Height - 1), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  429. End Select
  430. End Select
  431. e.Graphics.DrawImage(B.Clone(), 0, 0)
  432. G.Dispose() : B.Dispose()
  433. End Sub
  434. End Class
  435. Public Class xVisualGroupBox : Inherits ContainerControl
  436. Public Enum InnerShade
  437. Light
  438. Dark
  439. End Enum
  440. Private _Shade As InnerShade
  441. Property Shade As InnerShade
  442. Get
  443. Return _Shade
  444. End Get
  445. Set(ByVal value As InnerShade)
  446. _Shade = value
  447. Invalidate()
  448. End Set
  449. End Property
  450. Sub New()
  451. SetStyle(ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  452. BackColor = Color.Transparent
  453. ForeColor = Color.FromArgb(205, 205, 205)
  454. Size = New Size(174, 115)
  455. _Shade = InnerShade.Light
  456. DoubleBuffered = True
  457. End Sub
  458. Dim TopTexture As TextureBrush = NoiseBrush({Color.FromArgb(49, 45, 41), Color.FromArgb(51, 47, 43), Color.FromArgb(47, 43, 39)})
  459. Dim InnerTexture As TextureBrush = NoiseBrush({Color.FromArgb(55, 52, 48), Color.FromArgb(57, 50, 50), Color.FromArgb(53, 50, 46)})
  460. Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  461. Dim B As New Bitmap(Width, Height)
  462. Dim G As Graphics = Graphics.FromImage(B)
  463. Dim ClientRectangle As New Rectangle(0, 0, Width - 1, Height - 1)
  464. Dim BarRect As New Rectangle(0, 0, Width - 1, 32)
  465. MyBase.OnPaint(e)
  466. G.Clear(BackColor)
  467. G.SmoothingMode = SmoothingMode.HighQuality
  468. Select Case _Shade
  469. Case InnerShade.Light
  470. Dim mainGradient As New LinearGradientBrush(ClientRectangle, Color.FromArgb(228, 230, 232), Color.FromArgb(199, 201, 205), 90S)
  471. G.FillRectangle(mainGradient, ClientRectangle)
  472. G.DrawRectangle(Pens.Black, ClientRectangle)
  473. Case InnerShade.Dark
  474. G.FillRectangle(InnerTexture, ClientRectangle)
  475. G.DrawRectangle(Pens.Black, ClientRectangle)
  476. End Select
  477. Dim TopOverlay As New LinearGradientBrush(ClientRectangle, Color.FromArgb(5, Color.White), Color.FromArgb(10, Color.White), 90S)
  478. G.FillRectangle(TopTexture, BarRect)
  479. Dim blend As ColorBlend = New ColorBlend()
  480. 'Add the Array of Color
  481. Dim bColors As Color() = New Color() {Color.FromArgb(20, Color.White), Color.FromArgb(10, Color.Black), Color.FromArgb(10, Color.White)}
  482. blend.Colors = bColors
  483. 'Add the Array Single (0-1) colorpoints to place each Color
  484. Dim bPts As Single() = New Single() {0, 0.9, 1}
  485. blend.Positions = bPts
  486. Using br As New LinearGradientBrush(BarRect, Color.White, Color.Black, LinearGradientMode.Vertical)
  487. 'Blend the colors into the Brush
  488. br.InterpolationColors = blend
  489. 'Fill the rect with the blend
  490. G.FillRectangle(br, BarRect)
  491. End Using
  492. G.DrawRectangle(Pens.Black, BarRect)
  493. '// Top Bar Highlights
  494. G.DrawLine(GetPen(Color.FromArgb(112, 109, 107)), 1, 1, Width - 2, 1)
  495. G.DrawLine(GetPen(Color.FromArgb(67, 63, 60)), 1, BarRect.Height - 1, Width - 2, BarRect.Height - 1)
  496. Select Case _Shade
  497. Case InnerShade.Light
  498. Dim c As Color() = {Color.FromArgb(153, 153, 153), Color.FromArgb(173, 174, 177), Color.FromArgb(200, 201, 204)}
  499. Draw.InnerGlow(G, New Rectangle(1, 33, Width - 2, Height - 34), c)
  500. Case InnerShade.Dark
  501. Dim c As Color() = {Color.FromArgb(43, 40, 38), Color.FromArgb(50, 47, 44), Color.FromArgb(55, 52, 49)}
  502. Draw.InnerGlow(G, New Rectangle(1, 33, Width - 2, Height - 34), c)
  503. End Select
  504. Dim drawFont As New Font("Arial", 9, FontStyle.Bold)
  505. G.DrawString(Text, drawFont, Brushes.White, New Rectangle(15, 3, Width - 1, 26), New StringFormat() With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Center})
  506. e.Graphics.DrawImage(B.Clone(), 0, 0)
  507. G.Dispose() : B.Dispose()
  508. End Sub
  509. End Class
  510. Public Class xVisualHeader : Inherits ContainerControl
  511. Protected Overrides Sub OnResize(ByVal e As EventArgs)
  512. Height = 32
  513. MyBase.OnResize(e)
  514. End Sub
  515. Sub New()
  516. SetStyle(ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  517. BackColor = Color.Transparent
  518. ForeColor = Color.FromArgb(205, 205, 205)
  519. Size = New Size(174, 32)
  520. DoubleBuffered = True
  521. End Sub
  522. Dim TopTexture As TextureBrush = NoiseBrush({Color.FromArgb(49, 45, 41), Color.FromArgb(51, 47, 43), Color.FromArgb(47, 43, 39)})
  523. Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  524. Dim B As New Bitmap(Width, Height)
  525. Dim G As Graphics = Graphics.FromImage(B)
  526. Dim BarRect As New Rectangle(0, 0, Width - 1, Height - 1)
  527. MyBase.OnPaint(e)
  528. G.Clear(BackColor)
  529. G.SmoothingMode = SmoothingMode.HighQuality
  530. Dim TopOverlay As New LinearGradientBrush(BarRect, Color.FromArgb(5, Color.White), Color.FromArgb(10, Color.White), 90S)
  531. G.FillRectangle(TopTexture, BarRect)
  532. Dim blend As ColorBlend = New ColorBlend()
  533. 'Add the Array of Color
  534. Dim bColors As Color() = New Color() {Color.FromArgb(20, Color.White), Color.FromArgb(10, Color.Black), Color.FromArgb(10, Color.White)}
  535. blend.Colors = bColors
  536. 'Add the Array Single (0-1) colorpoints to place each Color
  537. Dim bPts As Single() = New Single() {0, 0.9, 1}
  538. blend.Positions = bPts
  539. Using br As New LinearGradientBrush(BarRect, Color.White, Color.Black, LinearGradientMode.Vertical)
  540. 'Blend the colors into the Brush
  541. br.InterpolationColors = blend
  542. 'Fill the rect with the blend
  543. G.FillRectangle(br, BarRect)
  544. End Using
  545. G.DrawRectangle(Pens.Black, BarRect)
  546. '// Top Bar Highlights
  547. G.DrawLine(GetPen(Color.FromArgb(112, 109, 107)), 1, 1, Width - 2, 1)
  548. G.DrawLine(GetPen(Color.FromArgb(67, 63, 60)), 1, BarRect.Height - 1, Width - 2, BarRect.Height - 1)
  549. Dim drawFont As New Font("Arial", 9, FontStyle.Bold)
  550. G.DrawString(Text, drawFont, Brushes.White, New Rectangle(15, 3, Width - 1, 26), New StringFormat() With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Center})
  551. e.Graphics.DrawImage(B.Clone(), 0, 0)
  552. G.Dispose() : B.Dispose()
  553. End Sub
  554. End Class
  555. Public Class xVisualSeperator : Inherits Control
  556. Public Enum LineStyle
  557. Horizontal
  558. Vertical
  559. End Enum
  560. Private _Style As LineStyle
  561. Property Style As LineStyle
  562. Get
  563. Return _Style
  564. End Get
  565. Set(ByVal value As LineStyle)
  566. _Style = value
  567. Invalidate()
  568. End Set
  569. End Property
  570. Sub New()
  571. SetStyle(ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  572. BackColor = Color.Transparent
  573. ForeColor = Color.FromArgb(205, 205, 205)
  574. _Style = LineStyle.Horizontal
  575. Size = New Size(174, 3)
  576. DoubleBuffered = True
  577. End Sub
  578. Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  579. Dim B As New Bitmap(Width, Height)
  580. Dim G As Graphics = Graphics.FromImage(B)
  581. MyBase.OnPaint(e)
  582. Size = Size
  583. _Style = Style
  584. G.Clear(BackColor)
  585. G.SmoothingMode = SmoothingMode.HighQuality
  586. Select Case _Style
  587. Case LineStyle.Horizontal
  588. G.DrawLine(GetPen(Color.Black), 0, 0, Width - 1, Height - 3)
  589. G.DrawLine(GetPen(Color.FromArgb(99, 97, 94)), 0, 1, Width - 1, Height - 2)
  590. Case LineStyle.Vertical
  591. G.DrawLine(GetPen(Color.Black), 0, 0, 0, Height - 1)
  592. G.DrawLine(GetPen(Color.FromArgb(99, 97, 94)), 1, 0, 1, Height - 1)
  593. End Select
  594. e.Graphics.DrawImage(B.Clone(), 0, 0)
  595. G.Dispose() : B.Dispose()
  596. End Sub
  597. End Class
  598. <DefaultEvent("TextChanged")> Public Class xVisualTextBox : Inherits Control
  599. #Region " Variables"
  600. Private W, H As Integer
  601. Private State As MouseState = MouseState.None
  602. Private WithEvents TB As Windows.Forms.TextBox
  603. #End Region
  604. #Region " Properties"
  605. #Region " TextBox Properties"
  606. Private _TextAlign As HorizontalAlignment = HorizontalAlignment.Left
  607. Public Enum RoundingStyle
  608. Normal
  609. Rounded
  610. End Enum
  611. Private _Style As RoundingStyle
  612. <Category("Options")> _
  613. Property Style() As RoundingStyle
  614. Get
  615. Return _Style
  616. End Get
  617. Set(ByVal value As RoundingStyle)
  618. _Style = value
  619. If TB IsNot Nothing Then
  620. TB.TextAlign = value
  621. End If
  622. End Set
  623. End Property
  624. <Category("Options")> _
  625. Property TextAlign() As HorizontalAlignment
  626. Get
  627. Return _TextAlign
  628. End Get
  629. Set(ByVal value As HorizontalAlignment)
  630. _TextAlign = value
  631. If TB IsNot Nothing Then
  632. TB.TextAlign = value
  633. End If
  634. End Set
  635. End Property
  636. Private _MaxLength As Integer = 32767
  637. <Category("Options")> _
  638. Property MaxLength() As Integer
  639. Get
  640. Return _MaxLength
  641. End Get
  642. Set(ByVal value As Integer)
  643. _MaxLength = value
  644. If TB IsNot Nothing Then
  645. TB.MaxLength = value
  646. End If
  647. End Set
  648. End Property
  649. Private _ReadOnly As Boolean
  650. <Category("Options")> _
  651. Property [ReadOnly]() As Boolean
  652. Get
  653. Return _ReadOnly
  654. End Get
  655. Set(ByVal value As Boolean)
  656. _ReadOnly = value
  657. If TB IsNot Nothing Then
  658. TB.ReadOnly = value
  659. End If
  660. End Set
  661. End Property
  662. Private _UseSystemPasswordChar As Boolean
  663. <Category("Options")> _
  664. Property UseSystemPasswordChar() As Boolean
  665. Get
  666. Return _UseSystemPasswordChar
  667. End Get
  668. Set(ByVal value As Boolean)
  669. _UseSystemPasswordChar = value
  670. If TB IsNot Nothing Then
  671. TB.UseSystemPasswordChar = value
  672. End If
  673. End Set
  674. End Property
  675. Private _Multiline As Boolean
  676. <Category("Options")> _
  677. Property Multiline() As Boolean
  678. Get
  679. Return _Multiline
  680. End Get
  681. Set(ByVal value As Boolean)
  682. _Multiline = value
  683. If TB IsNot Nothing Then
  684. TB.Multiline = value
  685. If value Then
  686. TB.Height = Height - 11
  687. Else
  688. Height = TB.Height + 11
  689. End If
  690. End If
  691. End Set
  692. End Property
  693. <Category("Options")> _
  694. Overrides Property Text As String
  695. Get
  696. Return MyBase.Text
  697. End Get
  698. Set(ByVal value As String)
  699. MyBase.Text = value
  700. If TB IsNot Nothing Then
  701. TB.Text = value
  702. End If
  703. End Set
  704. End Property
  705. <Category("Options")> _
  706. Overrides Property Font As Font
  707. Get
  708. Return MyBase.Font
  709. End Get
  710. Set(ByVal value As Font)
  711. MyBase.Font = value
  712. If TB IsNot Nothing Then
  713. TB.Font = value
  714. TB.Location = New Point(3, 5)
  715. TB.Width = Width - 6
  716. If Not _Multiline Then
  717. Height = TB.Height + 11
  718. End If
  719. End If
  720. End Set
  721. End Property
  722. Protected Overrides Sub OnCreateControl()
  723. MyBase.OnCreateControl()
  724. If Not Controls.Contains(TB) Then
  725. Controls.Add(TB)
  726. End If
  727. End Sub
  728. Private Sub OnBaseTextChanged(ByVal s As Object, ByVal e As EventArgs)
  729. Text = TB.Text
  730. End Sub
  731. Private Sub OnBaseKeyDown(ByVal s As Object, ByVal e As KeyEventArgs)
  732. If e.Control AndAlso e.KeyCode = Keys.A Then
  733. TB.SelectAll()
  734. e.SuppressKeyPress = True
  735. End If
  736. If e.Control AndAlso e.KeyCode = Keys.C Then
  737. TB.Copy()
  738. e.SuppressKeyPress = True
  739. End If
  740. End Sub
  741. Protected Overrides Sub OnResize(ByVal e As EventArgs)
  742. TB.Location = New Point(11, 5)
  743. TB.Width = Width - 14
  744. If _Multiline Then
  745. TB.Height = Height - 11
  746. Else
  747. Height = TB.Height + 11
  748. End If
  749. MyBase.OnResize(e)
  750. End Sub
  751. #End Region
  752. #Region " Mouse States"
  753. Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
  754. MyBase.OnMouseDown(e)
  755. State = MouseState.Down : Invalidate()
  756. End Sub
  757. Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
  758. MyBase.OnMouseUp(e)
  759. State = MouseState.Over : TB.Focus() : Invalidate()
  760. End Sub
  761. Protected Overrides Sub OnMouseEnter(e As EventArgs)
  762. MyBase.OnMouseEnter(e)
  763. State = MouseState.Over : Invalidate()
  764. End Sub
  765. Protected Overrides Sub OnMouseLeave(e As EventArgs)
  766. MyBase.OnMouseLeave(e)
  767. State = MouseState.None : Invalidate()
  768. End Sub
  769. #End Region
  770. #End Region
  771. #Region " Colors"
  772. Private _BaseColor As Color = Color.FromArgb(242, 242, 242)
  773. Private _TextColor As Color = Color.FromArgb(30, 30, 30)
  774. #End Region
  775. Sub New()
  776. SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.UserPaint Or _
  777. ControlStyles.ResizeRedraw Or ControlStyles.OptimizedDoubleBuffer Or _
  778. ControlStyles.SupportsTransparentBackColor, True)
  779. DoubleBuffered = True
  780. BackColor = Color.Transparent
  781. TB = New Windows.Forms.TextBox
  782. TB.Font = New Font("Arial", 8, FontStyle.Bold)
  783. TB.Text = Text
  784. TB.BackColor = _BaseColor
  785. TB.ForeColor = _TextColor
  786. TB.MaxLength = _MaxLength
  787. TB.Multiline = _Multiline
  788. TB.ReadOnly = _ReadOnly
  789. TB.UseSystemPasswordChar = _UseSystemPasswordChar
  790. TB.BorderStyle = BorderStyle.None
  791. TB.Location = New Point(11, 5)
  792. TB.Width = Width - 10
  793. _Style = RoundingStyle.Normal
  794. TB.Cursor = Cursors.IBeam
  795. If _Multiline Then
  796. TB.Height = Height - 11
  797. Else
  798. Height = TB.Height + 11
  799. End If
  800. AddHandler TB.TextChanged, AddressOf OnBaseTextChanged
  801. AddHandler TB.KeyDown, AddressOf OnBaseKeyDown
  802. End Sub
  803. Protected Overrides Sub OnPaint(e As PaintEventArgs)
  804. Dim B As New Bitmap(Width, Height)
  805. Dim G As Graphics = Graphics.FromImage(B)
  806. G = Graphics.FromImage(B)
  807. W = Width - 1 : H = Height - 1
  808. Dim Base As New Rectangle(0, 0, W, H)
  809. With G
  810. .SmoothingMode = SmoothingMode.HighQuality
  811. .Clear(BackColor)
  812. TB.BackColor = _BaseColor
  813. TB.ForeColor = _TextColor
  814. Select Case _Style
  815. Case RoundingStyle.Normal
  816. .FillPath(New SolidBrush(_BaseColor), Draw.CreateRound(Base, 5))
  817. Dim tg As New LinearGradientBrush(Base, Color.FromArgb(186, 188, 191), Color.FromArgb(204, 205, 209), 90S)
  818. .DrawPath(New Pen(tg), Draw.CreateRound(Base, 5))
  819. Case RoundingStyle.Rounded
  820. .DrawPath(New Pen(New SolidBrush(Color.FromArgb(132, 130, 128))), Draw.CreateRound(New Rectangle(Base.X, Base.Y + 1, Base.Width, Base.Height - 1), 20))
  821. .FillPath(New SolidBrush(_BaseColor), Draw.CreateRound(New Rectangle(Base.X, Base.Y, Base.Width, Base.Height - 1), 20))
  822. Dim tg As New LinearGradientBrush(New Rectangle(Base.X, Base.Y, Base.Width, Base.Height - 1), Color.Black, Color.FromArgb(31, 28, 24), 90S)
  823. .DrawPath(New Pen(tg), Draw.CreateRound(New Rectangle(Base.X, Base.Y, Base.Width, Base.Height - 1), 20))
  824. End Select
  825. End With
  826. MyBase.OnPaint(e)
  827. G.Dispose()
  828. e.Graphics.InterpolationMode = 7
  829. e.Graphics.DrawImageUnscaled(B, 0, 0)
  830. B.Dispose()
  831. End Sub
  832. End Class
  833. Public Class xVisualProgressBar : Inherits Control
  834. #Region " Control Help - Properties & Flicker Control "
  835. Private OFS As Integer = 0
  836. Private Speed As Integer = 50
  837. Private _Maximum As Integer = 100
  838. Public Property Maximum() As Integer
  839. Get
  840. Return _Maximum
  841. End Get
  842. Set(ByVal v As Integer)
  843. Select Case v
  844. Case Is < _Value
  845. _Value = v
  846. End Select
  847. _Maximum = v
  848. Invalidate()
  849. End Set
  850. End Property
  851. Private _Value As Integer = 0
  852. Public Property Value() As Integer
  853. Get
  854. Select Case _Value
  855. Case 0
  856. Return 0
  857. Case Else
  858. Return _Value
  859. End Select
  860. End Get
  861. Set(ByVal v As Integer)
  862. Select Case v
  863. Case Is > _Maximum
  864. v = _Maximum
  865. End Select
  866. _Value = v
  867. Invalidate()
  868. End Set
  869. End Property
  870. Private _ShowPercentage As Boolean = False
  871. Public Property ShowPercentage() As Boolean
  872. Get
  873. Return _ShowPercentage
  874. End Get
  875. Set(ByVal v As Boolean)
  876. _ShowPercentage = v
  877. Invalidate()
  878. End Set
  879. End Property
  880. Protected Overrides Sub CreateHandle()
  881. MyBase.CreateHandle()
  882. End Sub
  883. Sub Animate()
  884. While True
  885. If OFS <= Width Then : OFS += 1
  886. Else : OFS = 0
  887. End If
  888. Invalidate()
  889. Threading.Thread.Sleep(Speed)
  890. End While
  891. End Sub
  892. #End Region
  893. Sub New()
  894. MyBase.New()
  895. DoubleBuffered = True
  896. SetStyle(ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  897. BackColor = Color.Transparent
  898. Size = New Size(274, 30)
  899. End Sub
  900. Dim InnerTexture As TextureBrush = NoiseBrush({Color.FromArgb(55, 52, 48), Color.FromArgb(57, 50, 50), Color.FromArgb(53, 50, 46)})
  901. Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  902. Dim B As New Bitmap(Width, Height)
  903. Dim G As Graphics = Graphics.FromImage(B)
  904. 'G.SmoothingMode = SmoothingMode.HighQuality
  905. Dim intValue As Integer = CInt(_Value / _Maximum * Width)
  906. G.Clear(BackColor)
  907. Dim percentColor As SolidBrush = New SolidBrush(Color.White)
  908. G.FillRectangle(InnerTexture, New Rectangle(0, 0, Width - 1, Height - 1))
  909. Dim blend As ColorBlend = New ColorBlend()
  910. 'Add the Array of Color
  911. Dim bColors As Color() = New Color() {Color.FromArgb(20, Color.White), Color.FromArgb(10, Color.Black), Color.FromArgb(10, Color.White)}
  912. blend.Colors = bColors
  913. 'Add the Array Single (0-1) colorpoints to place each Color
  914. Dim bPts As Single() = New Single() {0, 0.8, 1}
  915. blend.Positions = bPts
  916. Using br As New LinearGradientBrush(New Rectangle(0, 0, Width - 1, Height - 1), Color.White, Color.Black, LinearGradientMode.Vertical)
  917. 'Blend the colors into the Brush
  918. br.InterpolationColors = blend
  919. 'Fill the rect with the blend
  920. G.FillRectangle(br, New Rectangle(0, 0, Width - 1, Height - 1))
  921. End Using
  922. G.DrawRectangle(Pens.Black, New Rectangle(0, 0, Width - 1, Height - 1))
  923. G.DrawLine(GetPen(Color.FromArgb(99, 97, 94)), 1, 1, Width - 3, 1)
  924. G.DrawLine(GetPen(Color.FromArgb(64, 60, 57)), 1, Height - 2, Width - 3, Height - 2)
  925. '//// Bar Fill
  926. If Not intValue = 0 Then
  927. G.FillRectangle(New LinearGradientBrush(New Rectangle(2, 2, intValue - 3, Height - 4), Color.FromArgb(114, 203, 232), Color.FromArgb(58, 118, 188), 90S), New Rectangle(2, 2, intValue - 3, Height - 4))
  928. G.DrawLine(GetPen(Color.FromArgb(235, 255, 255)), 2, 2, intValue - 2, 2)
  929. 'G.DrawLine(GetPen(Color.FromArgb(27, 25, 23)), 2, Height - 2, intValue + 1, Height - 2)
  930. percentColor = New SolidBrush(Color.White)
  931. End If
  932. If _ShowPercentage Then
  933. G.DrawString(Convert.ToString(String.Concat(Value, "%")), New Font("Arial", 10, FontStyle.Bold), GetBrush(Color.FromArgb(20, 20, 20)), New Rectangle(1, 2, Width - 1, Height - 1), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  934. G.DrawString(Convert.ToString(String.Concat(Value, "%")), New Font("Arial", 10, FontStyle.Bold), percentColor, New Rectangle(0, 1, Width - 1, Height - 1), New StringFormat() With {.Alignment = StringAlignment.Center, .LineAlignment = StringAlignment.Center})
  935. End If
  936. e.Graphics.DrawImage(B.Clone(), 0, 0)
  937. G.Dispose() : B.Dispose()
  938. End Sub
  939. End Class
  940. <DefaultEvent("CheckedChanged")> Public Class xVisualRadioButton : Inherits Control
  941. #Region " Control Help - MouseState & Flicker Control"
  942. Private R1 As Rectangle
  943. Private G1 As LinearGradientBrush
  944. Private State As MouseState = MouseState.None
  945. Protected Overrides Sub OnMouseEnter(ByVal e As System.EventArgs)
  946. MyBase.OnMouseEnter(e)
  947. State = MouseState.Over
  948. Invalidate()
  949. End Sub
  950. Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  951. MyBase.OnMouseDown(e)
  952. State = MouseState.Down
  953. Invalidate()
  954. End Sub
  955. Protected Overrides Sub OnMouseLeave(ByVal e As System.EventArgs)
  956. MyBase.OnMouseLeave(e)
  957. State = MouseState.None
  958. Invalidate()
  959. End Sub
  960. Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
  961. MyBase.OnMouseUp(e)
  962. State = MouseState.Over
  963. Invalidate()
  964. End Sub
  965. Protected Overrides Sub OnResize(ByVal e As System.EventArgs)
  966. MyBase.OnResize(e)
  967. Height = 21
  968. End Sub
  969. Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
  970. MyBase.OnTextChanged(e)
  971. Invalidate()
  972. End Sub
  973. Private _Checked As Boolean
  974. Property Checked() As Boolean
  975. Get
  976. Return _Checked
  977. End Get
  978. Set(ByVal value As Boolean)
  979. _Checked = value
  980. InvalidateControls()
  981. RaiseEvent CheckedChanged(Me)
  982. Invalidate()
  983. End Set
  984. End Property
  985. Protected Overrides Sub OnClick(ByVal e As EventArgs)
  986. If Not _Checked Then Checked = True
  987. MyBase.OnClick(e)
  988. End Sub
  989. Event CheckedChanged(ByVal sender As Object)
  990. Protected Overrides Sub OnCreateControl()
  991. MyBase.OnCreateControl()
  992. InvalidateControls()
  993. End Sub
  994. Private Sub InvalidateControls()
  995. If Not IsHandleCreated OrElse Not _Checked Then Return
  996. For Each C As Control In Parent.Controls
  997. If C IsNot Me AndAlso TypeOf C Is xVisualRadioButton Then
  998. DirectCast(C, xVisualRadioButton).Checked = False
  999. End If
  1000. Next
  1001. End Sub
  1002. #End Region
  1003. Sub New()
  1004. MyBase.New()
  1005. SetStyle(ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  1006. BackColor = Color.Transparent
  1007. ForeColor = Color.Black
  1008. Size = New Size(150, 21)
  1009. DoubleBuffered = True
  1010. End Sub
  1011. Dim InnerTexture As TextureBrush = NoiseBrush({Color.FromArgb(55, 52, 48), Color.FromArgb(57, 50, 50), Color.FromArgb(53, 50, 46)})
  1012. Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  1013. Dim B As New Bitmap(Width, Height)
  1014. Dim G As Graphics = Graphics.FromImage(B)
  1015. Dim radioBtnRectangle As New Rectangle(0, 0, Height - 1, Height - 1)
  1016. G.SmoothingMode = SmoothingMode.HighQuality
  1017. G.CompositingQuality = CompositingQuality.HighQuality
  1018. G.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAliasGridFit
  1019. G.Clear(BackColor)
  1020. G.FillRectangle(InnerTexture, radioBtnRectangle)
  1021. G.DrawRectangle(New Pen(Color.Black), radioBtnRectangle)
  1022. G.DrawRectangle(New Pen(Color.FromArgb(99, 97, 94)), New Rectangle(1, 1, Height - 3, Height - 3))
  1023. If Checked Then
  1024. G.DrawString("a", New Font("Marlett", 12, FontStyle.Regular), Brushes.White, New Point(1, 2))
  1025. End If
  1026. Dim drawFont As New Font("Arial", 10, FontStyle.Bold)
  1027. Dim nb As Brush = New SolidBrush(Color.FromArgb(250, 250, 250))
  1028. G.DrawString(Text, drawFont, nb, New Point(25, 10), New StringFormat With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Center})
  1029. e.Graphics.DrawImage(B.Clone(), 0, 0)
  1030. G.Dispose() : B.Dispose()
  1031. End Sub
  1032. End Class
  1033. Public Class xVisualComboBox : Inherits ComboBox
  1034. #Region " Control Help - Properties & Flicker Control "
  1035. Private _StartIndex As Integer = 0
  1036. Public Property StartIndex As Integer
  1037. Get
  1038. Return _StartIndex
  1039. End Get
  1040. Set(ByVal value As Integer)
  1041. _StartIndex = value
  1042. Try
  1043. MyBase.SelectedIndex = value
  1044. Catch
  1045. End Try
  1046. Invalidate()
  1047. End Set
  1048. End Property
  1049. Public Overrides ReadOnly Property DisplayRectangle As System.Drawing.Rectangle
  1050. Get
  1051. Return MyBase.DisplayRectangle
  1052. End Get
  1053. End Property
  1054. Sub ReplaceItem(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles Me.DrawItem
  1055. e.DrawBackground()
  1056. Try
  1057. If (e.State And DrawItemState.Selected) = DrawItemState.Selected Then
  1058. e.Graphics.FillRectangle(New SolidBrush(_highlightColor), e.Bounds)
  1059. Dim gloss As New LinearGradientBrush(e.Bounds, Color.FromArgb(20, Color.White), Color.FromArgb(0, Color.White), 90S) 'Highlight Gloss/Color
  1060. e.Graphics.FillRectangle(gloss, New Rectangle(New Point(e.Bounds.X, e.Bounds.Y), New Size(e.Bounds.Width, e.Bounds.Height))) 'Drop Background
  1061. e.Graphics.DrawRectangle(New Pen(Color.FromArgb(90, Color.Black)) With {.DashStyle = DashStyle.Solid}, New Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width - 1, e.Bounds.Height - 1))
  1062. Else
  1063. e.Graphics.FillRectangle(InnerTexture, e.Bounds)
  1064. End If
  1065. Using b As New SolidBrush(Color.FromArgb(230, 230, 230))
  1066. e.Graphics.DrawString(MyBase.GetItemText(MyBase.Items(e.Index)), e.Font, b, New Rectangle(e.Bounds.X + 2, e.Bounds.Y, e.Bounds.Width - 4, e.Bounds.Height))
  1067. End Using
  1068. Catch
  1069. End Try
  1070. e.DrawFocusRectangle()
  1071. End Sub
  1072. Protected Sub DrawTriangle(ByVal Clr As Color, ByVal FirstPoint As Point, ByVal SecondPoint As Point, ByVal ThirdPoint As Point, ByVal G As Graphics)
  1073. Dim points As New List(Of Point)()
  1074. points.Add(FirstPoint)
  1075. points.Add(SecondPoint)
  1076. points.Add(ThirdPoint)
  1077. G.FillPolygon(New SolidBrush(Clr), points.ToArray)
  1078. G.DrawPolygon(New Pen(New SolidBrush(Color.Black)), points.ToArray)
  1079. End Sub
  1080. Private _highlightColor As Color = Color.FromArgb(99, 97, 94)
  1081. Public Property ItemHighlightColor() As Color
  1082. Get
  1083. Return _highlightColor
  1084. End Get
  1085. Set(ByVal v As Color)
  1086. _highlightColor = v
  1087. Invalidate()
  1088. End Set
  1089. End Property
  1090. #End Region
  1091. Sub New()
  1092. MyBase.New()
  1093. SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or ControlStyles.DoubleBuffer Or ControlStyles.SupportsTransparentBackColor, True)
  1094. DrawMode = Windows.Forms.DrawMode.OwnerDrawFixed
  1095. BackColor = Color.Transparent
  1096. ForeColor = Color.Silver
  1097. Font = New Font("Arial", 9, FontStyle.Bold)
  1098. DropDownStyle = ComboBoxStyle.DropDownList
  1099. DoubleBuffered = True
  1100. Size = New Size(Width + 1, 21)
  1101. ItemHeight = 16
  1102. End Sub
  1103. Dim InnerTexture As TextureBrush = NoiseBrush({Color.FromArgb(55, 52, 48), Color.FromArgb(57, 50, 50), Color.FromArgb(53, 50, 46)})
  1104. Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  1105. Dim B As New Bitmap(Width, Height)
  1106. Dim G As Graphics = Graphics.FromImage(B)
  1107. G.SmoothingMode = SmoothingMode.HighQuality
  1108. G.Clear(BackColor)
  1109. G.FillRectangle(InnerTexture, New Rectangle(0, 0, Width, Height - 1))
  1110. G.DrawLine(New Pen(Color.FromArgb(99, 97, 94)), 1, 1, Width - 2, 1)
  1111. G.DrawRectangle(New Pen(Color.FromArgb(99, 97, 94)), New Rectangle(1, 1, Width - 3, Height - 3))
  1112. DrawTriangle(Color.FromArgb(99, 97, 94), New Point(Width - 14, 9), New Point(Width - 6, 9), New Point(Width - 10, 14), G) 'Triangle Fill Color
  1113. G.DrawRectangle(Pens.Black, New Rectangle(0, 0, Width - 1, Height - 1))
  1114. 'Draw Separator line
  1115. G.DrawLine(New Pen(Color.FromArgb(99, 97, 94)), New Point(Width - 21, 1), New Point(Width - 21, Height - 3))
  1116. G.DrawLine(New Pen(Color.Black), New Point(Width - 20, 2), New Point(Width - 20, Height - 3))
  1117. G.DrawLine(New Pen(Color.FromArgb(99, 97, 94)), New Point(Width - 19, 1), New Point(Width - 19, Height - 3))
  1118. Dim blend As ColorBlend = New ColorBlend()
  1119. 'Add the Array of Color
  1120. Dim bColors As Color() = New Color() {Color.FromArgb(15, Color.White), Color.FromArgb(10, Color.Black), Color.FromArgb(10, Color.White)}
  1121. blend.Colors = bColors
  1122. 'Add the Array Single (0-1) colorpoints to place each Color
  1123. Dim bPts As Single() = New Single() {0, 0.75, 1}
  1124. blend.Positions = bPts
  1125. Using br As New LinearGradientBrush(New Rectangle(0, 0, Width, Height - 1), Color.White, Color.Black, LinearGradientMode.Vertical)
  1126. 'Blend the colors into the Brush
  1127. br.InterpolationColors = blend
  1128. 'Fill the rect with the blend
  1129. G.FillRectangle(br, New Rectangle(0, 0, Width, Height - 1))
  1130. End Using
  1131. Try
  1132. G.DrawString(Text, Font, New SolidBrush(Color.FromArgb(250, 250, 250)), New Rectangle(5, 0, Width - 20, Height), New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Near})
  1133. Catch
  1134. End Try
  1135. e.Graphics.DrawImage(B.Clone(), 0, 0)
  1136. G.Dispose() : B.Dispose()
  1137. End Sub
  1138. End Class
  1139. Public Class xVisualTabControl : Inherits TabControl
  1140. Protected Overrides Sub OnResize(ByVal e As System.EventArgs)
  1141. MyBase.OnResize(e)
  1142. End Sub
  1143. Sub New()
  1144. SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or ControlStyles.DoubleBuffer, True)
  1145. DoubleBuffered = True
  1146. SizeMode = TabSizeMode.Fixed
  1147. ItemSize = New Size(35, 122)
  1148. End Sub
  1149. Protected Overrides Sub CreateHandle()
  1150. MyBase.CreateHandle()
  1151. Alignment = TabAlignment.Left
  1152. End Sub
  1153. Function ToPen(ByVal color As Color) As Pen
  1154. Return New Pen(color)
  1155. End Function
  1156. Function ToBrush(ByVal color As Color) As Brush
  1157. Return New SolidBrush(color)
  1158. End Function
  1159. Dim InnerTexture As TextureBrush = NoiseBrush({Color.FromArgb(45, 41, 37), Color.FromArgb(47, 43, 39), Color.FromArgb(43, 39, 35)})
  1160. Dim TabBGTexture As TextureBrush = NoiseBrush({Color.FromArgb(55, 51, 48), Color.FromArgb(57, 53, 50), Color.FromArgb(53, 49, 46)})
  1161. Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  1162. Dim B As New Bitmap(Width, Height)
  1163. Dim G As Graphics = Graphics.FromImage(B)
  1164. Dim FF As New Font("Arial", 9, FontStyle.Bold)
  1165. Try : SelectedTab.BackColor = Color.FromArgb(56, 52, 49) : Catch : End Try
  1166. G.Clear(Parent.FindForm.BackColor)
  1167. G.FillRectangle(TabBGTexture, New Rectangle(0, 0, ItemSize.Height + 3, Height - 1)) 'Full Tab Background
  1168. G.DrawLine(GetPen(Color.FromArgb(44, 42, 39)), 1, Height - 3, ItemSize.Height + 3, Height - 3)
  1169. G.DrawLine(GetPen(Color.FromArgb(48, 45, 43)), 1, Height - 4, ItemSize.Height + 3, Height - 4)
  1170. G.DrawLine(GetPen(Color.FromArgb(53, 50, 47)), 1, Height - 5, ItemSize.Height + 3, Height - 5)
  1171. Dim y As Integer = GetTabRect(0).Height * 2
  1172. Do Until y >= Height - 1
  1173. G.DrawLine(Pens.Black, 1, y, Width - 2, y)
  1174. G.DrawLine(GetPen(Color.FromArgb(99, 97, 94)), 1, y + 1, Width - 2, y + 1)
  1175. y = y + GetTabRect(0).Height
  1176. Loop
  1177. For i = 0 To TabCount - 1
  1178. If i = SelectedIndex Then
  1179. Dim x2 As Rectangle = New Rectangle(New Point(GetTabRect(i).Location.X - 2, GetTabRect(i).Location.Y - 2), New Size(GetTabRect(i).Width + 3, GetTabRect(i).Height - 1))
  1180. If SelectedIndex = 0 Then
  1181. Dim tabRect As New Rectangle(GetTabRect(i).Location.X, GetTabRect(i).Location.Y - 1, GetTabRect(i).Size.Width - 1, GetTabRect(i).Size.Height - 1)
  1182. Dim TabOverlay As New LinearGradientBrush(tabRect, Color.FromArgb(114, 203, 232), Color.FromArgb(58, 118, 188), 90S)
  1183. G.FillRectangle(TabOverlay, tabRect)
  1184. G.DrawLine(GetPen(Color.FromArgb(235, 255, 255)), GetTabRect(i).Location.X, GetTabRect(i).Location.Y - 1, GetTabRect(i).Size.Width, GetTabRect(i).Location.Y - 1)
  1185. Else
  1186. Dim tabRect As New Rectangle(GetTabRect(i).Location.X, GetTabRect(i).Location.Y - 2, GetTabRect(i).Size.Width - 1, GetTabRect(i).Size.Height)
  1187. Dim TabOverlay As New LinearGradientBrush(tabRect, Color.FromArgb(114, 203, 232), Color.FromArgb(58, 118, 188), 90S)
  1188. G.FillRectangle(TabOverlay, tabRect)
  1189. G.DrawLine(GetPen(Color.FromArgb(235, 255, 255)), GetTabRect(i).Location.X, GetTabRect(i).Location.Y - 2, GetTabRect(i).Size.Width, GetTabRect(i).Location.Y - 2)
  1190. End If
  1191. G.DrawLine(Pens.Black, GetTabRect(i).Location.X, GetTabRect(i).Location.Y + 33, GetTabRect(i).Size.Width, GetTabRect(i).Location.Y + 33)
  1192. G.SmoothingMode = SmoothingMode.HighQuality
  1193. G.DrawString(TabPages(i).Text, FF, GetBrush(Color.FromArgb(20, 20, 20)), New Rectangle(x2.X, x2.Y - 1, x2.Width + 1, x2.Height + 2), New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
  1194. G.DrawString(TabPages(i).Text, FF, Brushes.White, New Rectangle(x2.X, x2.Y - 1, x2.Width, x2.Height), New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
  1195. G.DrawLine(New Pen(Color.FromArgb(96, 110, 121)), New Point(x2.Location.X - 1, x2.Location.Y - 1), New Point(x2.Location.X, x2.Location.Y))
  1196. G.DrawLine(New Pen(Color.FromArgb(96, 110, 121)), New Point(x2.Location.X - 1, x2.Bottom - 1), New Point(x2.Location.X, x2.Bottom))
  1197. Else
  1198. Dim x2 As Rectangle = New Rectangle(New Point(GetTabRect(i).Location.X - 2, GetTabRect(i).Location.Y - 2), New Size(GetTabRect(i).Width + 3, GetTabRect(i).Height - 1))
  1199. Dim tabRect As New Rectangle(GetTabRect(i).Location.X, GetTabRect(i).Location.Y - 2, GetTabRect(i).Size.Width - 1, GetTabRect(i).Size.Height - 1)
  1200. G.FillRectangle(InnerTexture, tabRect) 'Highlight Fill Background
  1201. Dim TabOverlay As New LinearGradientBrush(tabRect, Color.FromArgb(15, Color.White), Color.FromArgb(100, Color.FromArgb(43, 40, 38)), 90S)
  1202. G.FillRectangle(TabOverlay, tabRect)
  1203. G.DrawLine(GetPen(Color.FromArgb(113, 110, 108)), GetTabRect(i).Location.X, GetTabRect(i).Location.Y - 1, GetTabRect(i).Size.Width, GetTabRect(i).Location.Y - 1)
  1204. G.DrawLine(Pens.Black, GetTabRect(i).Location.X, GetTabRect(i).Location.Y + 32, GetTabRect(i).Size.Width, GetTabRect(i).Location.Y + 32)
  1205. If i = TabCount - 1 Then
  1206. G.DrawLine(GetPen(Color.FromArgb(64, 60, 57)), GetTabRect(i).Location.X, GetTabRect(i).Location.Y + 31, GetTabRect(i).Size.Width, GetTabRect(i).Location.Y + 31)
  1207. G.DrawLine(GetPen(Color.FromArgb(35, 33, 31)), GetTabRect(i).Location.X, GetTabRect(i).Location.Y + 33, GetTabRect(i).Size.Width, GetTabRect(i).Location.Y + 33)
  1208. G.DrawLine(GetPen(Color.FromArgb(43, 41, 38)), GetTabRect(i).Location.X, GetTabRect(i).Location.Y + 34, GetTabRect(i).Size.Width, GetTabRect(i).Location.Y + 34)
  1209. G.DrawLine(GetPen(Color.FromArgb(53, 50, 47)), GetTabRect(i).Location.X, GetTabRect(i).Location.Y + 35, GetTabRect(i).Size.Width, GetTabRect(i).Location.Y + 35)
  1210. G.DrawLine(GetPen(Color.FromArgb(58, 55, 51)), GetTabRect(i).Location.X, GetTabRect(i).Location.Y + 36, GetTabRect(i).Size.Width, GetTabRect(i).Location.Y + 36)
  1211. End If
  1212. G.DrawString(TabPages(i).Text, FF, New SolidBrush(Color.FromArgb(210, 220, 230)), New Rectangle(x2.X, x2.Y - 1, x2.Width, x2.Height), New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
  1213. End If
  1214. G.FillRectangle(New SolidBrush(Color.FromArgb(56, 52, 49)), New Rectangle(123, -1, Width - 123, Height + 1)) 'Page Fill Full
  1215. G.DrawRectangle(Pens.Black, New Rectangle(123, 0, Width - 124, Height - 2))
  1216. Dim c As Color() = {Color.FromArgb(43, 40, 38), Color.FromArgb(50, 47, 44), Color.FromArgb(55, 52, 49)}
  1217. Draw.InnerGlow(G, New Rectangle(124, 1, Width - 125, Height - 3), c)
  1218. Next
  1219. G.DrawLine(GetPen(Color.FromArgb(56, 52, 49)), -1, Height - 1, ItemSize.Height + 1, Height - 1)
  1220. G.DrawLine(GetPen(Color.FromArgb(56, 52, 49)), 0, -1, 0, Height - 1)
  1221. G.DrawRectangle(New Pen(New SolidBrush(Color.Black)), New Rectangle(1, 0, ItemSize.Height, Height - 2)) 'Full Tab Inner Outline
  1222. e.Graphics.DrawImage(B.Clone, 0, 0)
  1223. G.Dispose() : B.Dispose()
  1224. End Sub
  1225. End Class
  1226. <DefaultEvent("CheckedChanged")> Public Class xVisualCheckBox : Inherits Control
  1227. #Region " Control Help - MouseState & Flicker Control"
  1228. Private State As MouseState = MouseState.None
  1229. Protected Overrides Sub OnMouseEnter(ByVal e As System.EventArgs)
  1230. MyBase.OnMouseEnter(e)
  1231. State = MouseState.Over
  1232. Invalidate()
  1233. End Sub
  1234. Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  1235. MyBase.OnMouseDown(e)
  1236. State = MouseState.Down
  1237. Invalidate()
  1238. End Sub
  1239. Protected Overrides Sub OnMouseLeave(ByVal e As System.EventArgs)
  1240. MyBase.OnMouseLeave(e)
  1241. State = MouseState.None
  1242. Invalidate()
  1243. End Sub
  1244. Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
  1245. MyBase.OnMouseUp(e)
  1246. State = MouseState.Over
  1247. Invalidate()
  1248. End Sub
  1249. Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
  1250. MyBase.OnTextChanged(e)
  1251. Invalidate()
  1252. End Sub
  1253. Private _Checked As Boolean
  1254. Property Checked() As Boolean
  1255. Get
  1256. Return _Checked
  1257. End Get
  1258. Set(ByVal value As Boolean)
  1259. _Checked = value
  1260. Invalidate()
  1261. End Set
  1262. End Property
  1263. Protected Overrides Sub OnResize(ByVal e As System.EventArgs)
  1264. MyBase.OnResize(e)
  1265. Height = 21
  1266. End Sub
  1267. Protected Overrides Sub OnClick(ByVal e As System.EventArgs)
  1268. _Checked = Not _Checked
  1269. RaiseEvent CheckedChanged(Me)
  1270. MyBase.OnClick(e)
  1271. End Sub
  1272. Event CheckedChanged(ByVal sender As Object)
  1273. #End Region
  1274. Sub New()
  1275. MyBase.New()
  1276. SetStyle(ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor Or ControlStyles.OptimizedDoubleBuffer, True)
  1277. BackColor = Color.Transparent
  1278. ForeColor = Color.Black
  1279. Size = New Size(250, 21)
  1280. DoubleBuffered = True
  1281. End Sub
  1282. Dim InnerTexture As TextureBrush = NoiseBrush({Color.FromArgb(55, 52, 48), Color.FromArgb(57, 50, 50), Color.FromArgb(53, 50, 46)})
  1283. Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  1284. Dim B As New Bitmap(Width, Height)
  1285. Dim G As Graphics = Graphics.FromImage(B)
  1286. Dim radioBtnRectangle As New Rectangle(0, 0, Height - 1, Height - 1)
  1287. G.SmoothingMode = SmoothingMode.HighQuality
  1288. G.CompositingQuality = CompositingQuality.HighQuality
  1289. G.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAliasGridFit
  1290. G.Clear(BackColor)
  1291. G.FillRectangle(InnerTexture, radioBtnRectangle)
  1292. G.DrawRectangle(New Pen(Color.Black), radioBtnRectangle)
  1293. G.DrawRectangle(New Pen(Color.FromArgb(99, 97, 94)), New Rectangle(1, 1, Height - 3, Height - 3))
  1294. If Checked Then
  1295. G.DrawString("a", New Font("Marlett", 12, FontStyle.Regular), Brushes.White, New Point(1, 2))
  1296. End If
  1297. Dim drawFont As New Font("Arial", 10, FontStyle.Bold)
  1298. Dim nb As Brush = New SolidBrush(Color.FromArgb(250, 250, 250))
  1299. G.DrawString(Text, drawFont, nb, New Point(25, 10), New StringFormat With {.Alignment = StringAlignment.Near, .LineAlignment = StringAlignment.Center})
  1300. e.Graphics.DrawImage(B.Clone(), 0, 0)
  1301. G.Dispose() : B.Dispose()
  1302. End Sub
  1303. End Class

comments powered by Disqus