[VB.NET] Graphite Theme


SUBMITTED BY: eddysix

DATE: March 13, 2017, 8:19 a.m.

FORMAT: VB.net

SIZE: 43.1 kB

HITS: 495

  1. Imports System.Drawing.Drawing2D
  2. Module ConversionFunctions
  3. Function ToBrush(ByVal A As Integer, ByVal R As Integer, ByVal G As Integer, ByVal B As Integer) As Brush
  4. Return New SolidBrush(Color.FromArgb(A, R, G, B))
  5. End Function
  6. Function ToBrush(ByVal R As Integer, ByVal G As Integer, ByVal B As Integer) As Brush
  7. Return New SolidBrush(Color.FromArgb(R, G, B))
  8. End Function
  9. Function ToBrush(ByVal A As Integer, ByVal C As Color) As Brush
  10. Return New SolidBrush(Color.FromArgb(A, C))
  11. End Function
  12. Function ToBrush(ByVal Pen As Pen) As Brush
  13. Return New SolidBrush(Pen.Color)
  14. End Function
  15. Function ToBrush(ByVal Color As Color) As Brush
  16. Return New SolidBrush(Color)
  17. End Function
  18. Function ToPen(ByVal A As Integer, ByVal R As Integer, ByVal G As Integer, ByVal B As Integer) As Pen
  19. Return New Pen(New SolidBrush(Color.FromArgb(A, R, G, B)))
  20. End Function
  21. Function ToPen(ByVal R As Integer, ByVal G As Integer, ByVal B As Integer) As Pen
  22. Return New Pen(New SolidBrush(Color.FromArgb(R, G, B)))
  23. End Function
  24. Function ToPen(ByVal A As Integer, ByVal C As Color) As Pen
  25. Return New Pen(New SolidBrush(Color.FromArgb(A, C)))
  26. End Function
  27. Function ToPen(ByVal Brush As SolidBrush) As Pen
  28. Return New Pen(Brush)
  29. End Function
  30. Function ToPen(ByVal Color As Color) As Pen
  31. Return New Pen(New SolidBrush(Color))
  32. End Function
  33. End Module
  34. Module RRM
  35. Public Function RoundRect(ByVal Rectangle As Rectangle, ByVal Curve As Integer) As GraphicsPath
  36. Dim P As GraphicsPath = New GraphicsPath()
  37. Dim ArcRectangleWidth As Integer = Curve * 2
  38. P.AddArc(New Rectangle(Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -180, 90)
  39. P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -90, 90)
  40. P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 0, 90)
  41. P.AddArc(New Rectangle(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 90, 90)
  42. P.AddLine(New Point(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y), New Point(Rectangle.X, Curve + Rectangle.Y))
  43. Return P
  44. End Function
  45. 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
  46. Dim Rectangle As Rectangle = New Rectangle(X, Y, Width, Height)
  47. Dim P As GraphicsPath = New GraphicsPath()
  48. Dim ArcRectangleWidth As Integer = Curve * 2
  49. P.AddArc(New Rectangle(Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -180, 90)
  50. P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), -90, 90)
  51. P.AddArc(New Rectangle(Rectangle.Width - ArcRectangleWidth + Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 0, 90)
  52. P.AddArc(New Rectangle(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y, ArcRectangleWidth, ArcRectangleWidth), 90, 90)
  53. P.AddLine(New Point(Rectangle.X, Rectangle.Height - ArcRectangleWidth + Rectangle.Y), New Point(Rectangle.X, Curve + Rectangle.Y))
  54. Return P
  55. End Function
  56. End Module
  57. Class GraphiteButton
  58. Inherits Control
  59. Enum MouseState
  60. None = 0
  61. Over = 1
  62. Down = 2
  63. End Enum
  64. Private State As MouseState = 0
  65. Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  66. MyBase.OnPaint(e)
  67. Dim G As Graphics = e.Graphics
  68. G.FillRectangle(ToBrush(Color.FromArgb(232, 232, 232)), ClientRectangle)
  69. G.FillRectangle(ToBrush(120, Color.White), New Rectangle(0, 0, Width, CInt(Height / 2)))
  70. Select Case Enabled
  71. Case True
  72. Select Case State
  73. Case MouseState.Over
  74. Dim Whit As New GraphicsPath
  75. Whit.AddEllipse(New Rectangle(0, 0, Width, Height * 2))
  76. Dim Whity As New PathGradientBrush(Whit)
  77. Whity.CenterColor = Color.FromArgb(120, Color.White)
  78. Whity.SurroundColors = New Color() {Color.Transparent}
  79. G.FillEllipse(Whity, New Rectangle(0, 0, Width, Height * 2))
  80. Case MouseState.Down
  81. Dim Whit As New GraphicsPath
  82. Whit.AddEllipse(New Rectangle(0, 0, Width, Height * 2))
  83. Dim Whity As New PathGradientBrush(Whit)
  84. Whity.CenterColor = Color.FromArgb(120, Color.White)
  85. Whity.SurroundColors = New Color() {Color.Transparent}
  86. G.FillEllipse(Whity, New Rectangle(0, 0, Width, Height * 2))
  87. G.FillRectangle(ToBrush(20, Color.Black), ClientRectangle)
  88. End Select
  89. G.DrawString(Text, Font, Brushes.Black, New Point(CInt((Width / 2) - (G.MeasureString(Text, Font).Width / 2)), CInt((Height / 2) - (G.MeasureString(Text, Font).Height / 2))))
  90. Case False
  91. G.DrawString(Text, Font, Brushes.White, New Point(CInt((Width / 2) - (G.MeasureString(Text, Font).Width / 2)) + 1, CInt((Height / 2) - (G.MeasureString(Text, Font).Height / 2)) + 1))
  92. G.DrawString(Text, Font, Brushes.Gray, New Point(CInt((Width / 2) - (G.MeasureString(Text, Font).Width / 2)), CInt((Height / 2) - (G.MeasureString(Text, Font).Height / 2))))
  93. End Select
  94. G.SmoothingMode = SmoothingMode.HighQuality
  95. G.DrawPath(ToPen(157, 157, 157), RoundRect(0, 0, Width - 1, Height - 1, 2))
  96. G.DrawRectangle(ToPen(40, Color.White), New Rectangle(1, 1, Width - 3, Height - 3))
  97. End Sub
  98. Protected Overrides Sub OnMouseEnter(ByVal e As System.EventArgs)
  99. MyBase.OnMouseEnter(e) : State = MouseState.Over : Invalidate()
  100. End Sub
  101. Protected Overrides Sub OnMouseLeave(ByVal e As System.EventArgs)
  102. MyBase.OnMouseLeave(e) : State = MouseState.None : Invalidate()
  103. End Sub
  104. Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  105. MyBase.OnMouseDown(e) : State = MouseState.Down : Invalidate()
  106. End Sub
  107. Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
  108. MyBase.OnMouseUp(e) : State = MouseState.Over : Invalidate()
  109. End Sub
  110. End Class
  111. Class GraphiteButtonToggle
  112. Inherits Control
  113. Private _toggled As Boolean
  114. Public Property Toggled() As Boolean
  115. Get
  116. Return _toggled
  117. End Get
  118. Set(ByVal value As Boolean)
  119. _toggled = value
  120. Invalidate()
  121. End Set
  122. End Property
  123. Enum MouseState
  124. None = 0
  125. Over = 1
  126. Down = 2
  127. End Enum
  128. Private State As MouseState = 0
  129. Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  130. MyBase.OnPaint(e)
  131. Dim G As Graphics = e.Graphics
  132. G.FillRectangle(ToBrush(Color.FromArgb(232, 232, 232)), ClientRectangle)
  133. G.FillRectangle(ToBrush(120, Color.White), New Rectangle(0, 0, Width, CInt(Height / 2)))
  134. Select Case Enabled
  135. Case True
  136. If Not Toggled Then
  137. Select Case State
  138. Case MouseState.Over
  139. Dim Whit As New GraphicsPath
  140. Whit.AddEllipse(New Rectangle(0, 0, Width, Height * 2))
  141. Dim Whity As New PathGradientBrush(Whit)
  142. Whity.CenterColor = Color.FromArgb(120, Color.White)
  143. Whity.SurroundColors = New Color() {Color.Transparent}
  144. G.FillEllipse(Whity, New Rectangle(0, 0, Width, Height * 2))
  145. Case MouseState.Down
  146. Dim Whit As New GraphicsPath
  147. Whit.AddEllipse(New Rectangle(0, 0, Width, Height * 2))
  148. Dim Whity As New PathGradientBrush(Whit)
  149. Whity.CenterColor = Color.FromArgb(120, Color.White)
  150. Whity.SurroundColors = New Color() {Color.Transparent}
  151. G.FillEllipse(Whity, New Rectangle(0, 0, Width, Height * 2))
  152. G.FillRectangle(ToBrush(20, Color.Black), ClientRectangle)
  153. End Select
  154. Else
  155. Dim Whit As New GraphicsPath
  156. Whit.AddEllipse(New Rectangle(0, 0, Width, Height * 2))
  157. Dim Whity As New PathGradientBrush(Whit)
  158. Whity.CenterColor = Color.FromArgb(120, Color.White)
  159. Whity.SurroundColors = New Color() {Color.Transparent}
  160. G.FillEllipse(Whity, New Rectangle(0, 0, Width, Height * 2))
  161. G.FillRectangle(ToBrush(20, Color.Black), ClientRectangle)
  162. End If
  163. G.DrawString(Text, Font, Brushes.Black, New Point(CInt((Width / 2) - (G.MeasureString(Text, Font).Width / 2)), CInt((Height / 2) - (G.MeasureString(Text, Font).Height / 2))))
  164. Case False
  165. G.DrawString(Text, Font, Brushes.White, New Point(CInt((Width / 2) - (G.MeasureString(Text, Font).Width / 2)) + 1, CInt((Height / 2) - (G.MeasureString(Text, Font).Height / 2)) + 1))
  166. G.DrawString(Text, Font, Brushes.Gray, New Point(CInt((Width / 2) - (G.MeasureString(Text, Font).Width / 2)), CInt((Height / 2) - (G.MeasureString(Text, Font).Height / 2))))
  167. End Select
  168. G.SmoothingMode = SmoothingMode.HighQuality
  169. G.DrawPath(ToPen(157, 157, 157), RoundRect(0, 0, Width - 1, Height - 1, 2))
  170. G.DrawRectangle(ToPen(40, Color.White), New Rectangle(1, 1, Width - 3, Height - 3))
  171. End Sub
  172. Protected Overrides Sub OnMouseEnter(ByVal e As System.EventArgs)
  173. MyBase.OnMouseEnter(e) : State = MouseState.Over : Invalidate()
  174. End Sub
  175. Protected Overrides Sub OnMouseLeave(ByVal e As System.EventArgs)
  176. MyBase.OnMouseLeave(e) : State = MouseState.None : Invalidate()
  177. End Sub
  178. Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  179. MyBase.OnMouseDown(e) : State = MouseState.Down : Invalidate()
  180. End Sub
  181. Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
  182. MyBase.OnMouseUp(e) : State = MouseState.Over : Invalidate()
  183. End Sub
  184. Protected Overrides Sub OnMouseClick(ByVal e As System.Windows.Forms.MouseEventArgs)
  185. MyBase.OnMouseClick(e) : Toggled = Not Toggled : Invalidate()
  186. End Sub
  187. End Class
  188. Class GraphiteFrame
  189. Inherits ContainerControl
  190. Enum TAlign
  191. Left = 0
  192. Center = 1
  193. Right = 2
  194. End Enum
  195. Private TA As TAlign
  196. Public Property TextAlignment() As TAlign
  197. Get
  198. Return TA
  199. End Get
  200. Set(ByVal value As TAlign)
  201. TA = value
  202. Invalidate()
  203. End Set
  204. End Property
  205. Sub New()
  206. Size = New Size(275, 75)
  207. TA = TAlign.Left
  208. End Sub
  209. Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  210. Dim G As Graphics = e.Graphics
  211. G.Clear(Color.FromArgb(236, 237, 239))
  212. G.DrawRectangle(ToPen(165, 166, 168), New Rectangle(0, CInt(G.MeasureString(Text, Font).Height / 2), Width - 1, Height - 1 - CInt(G.MeasureString(Text, Font).Height / 2)))
  213. Dim TOff As Integer = 0
  214. Select Case TA
  215. Case TAlign.Left
  216. TOff = 6
  217. Case TAlign.Right
  218. TOff = Width - 6 - G.MeasureString(Text, Font).Width
  219. Case TAlign.Center
  220. TOff = CInt((Width / 2) - (G.MeasureString(Text, Font).Width / 2))
  221. End Select
  222. G.FillRectangle(ToBrush(236, 237, 239), New Rectangle(New Point(TOff, 0), G.MeasureString(Text, Font).ToSize))
  223. G.DrawString(Text, Font, Brushes.Black, TOff, 0)
  224. End Sub
  225. End Class
  226. Class GraphiteProgress
  227. Inherits Control
  228. Private Max As Integer
  229. Public Property Maximum() As Integer
  230. Get
  231. Return Max
  232. End Get
  233. Set(ByVal value As Integer)
  234. If value > 0 Then Max = value
  235. If Max < Val Then Val = Max
  236. Invalidate()
  237. End Set
  238. End Property
  239. Private Val As Integer
  240. Public Property Value() As Integer
  241. Get
  242. Return Val
  243. End Get
  244. Set(ByVal value As Integer)
  245. If value < 0 Then Val = 0 Else If value > Max Then Val = Max Else Val = value
  246. Invalidate()
  247. End Set
  248. End Property
  249. Sub New()
  250. Max = 100
  251. End Sub
  252. Protected Overrides Sub CreateHandle()
  253. DoubleBuffered = True
  254. MyBase.CreateHandle()
  255. Dim Animation As New Timer With {.Interval = 50}
  256. AddHandler Animation.Tick, AddressOf AnimationHandle
  257. Animation.Start()
  258. End Sub
  259. Dim Offset As Integer = 0
  260. Sub AnimationHandle()
  261. If Offset < 7 Then Offset += 1 Else Offset = 0
  262. Invalidate()
  263. End Sub
  264. Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  265. MyBase.OnPaint(e)
  266. Dim G As Graphics = e.Graphics
  267. G.SmoothingMode = SmoothingMode.HighQuality
  268. G.Clear(Color.FromArgb(225, 226, 228))
  269. Dim Fill As Rectangle = New Rectangle(2, 2, CInt((Width - 5) * (Val / Max)), Height - 5)
  270. G.FillRectangle(ToBrush(180, Color.Black), Fill)
  271. G.RenderingOrigin = New Point(Offset, 0)
  272. Dim KP As New HatchBrush(HatchStyle.WideUpwardDiagonal, Color.FromArgb(40, Color.Black), Color.Empty)
  273. G.FillRectangle(KP, Fill)
  274. 'If Value > 2 Then
  275. ' For x = 0 To Math.Floor(Fill.Width / 10)
  276. ' Dim points As Point() = {New Point(x * 10, 3), New Point((x * 10) - 5, Height - 3), New Point((x * 10) - 10, Height - 3), New Point((x * 10) - 5, 3)}
  277. ' G.FillPolygon(ToBrush(40, Color.Black), points)
  278. ' Next
  279. 'End If
  280. G.DrawRectangle(ToPen(40, Color.Black), Fill)
  281. G.FillRectangle(ToBrush(40, Color.White), New Rectangle(0, 0, Width, CInt(Height / 2)))
  282. G.DrawPath(ToPen(50, Color.Black), RoundRect(0, 0, Width - 1, Height - 1, 2))
  283. End Sub
  284. End Class
  285. Class GraphiteRadio
  286. Inherits Control
  287. Private [Check] As Boolean
  288. Public Property Checked() As Boolean
  289. Get
  290. Return [Check]
  291. End Get
  292. Set(ByVal value As Boolean)
  293. [Check] = value
  294. Invalidate()
  295. End Set
  296. End Property
  297. Private aZ As Boolean
  298. Public Overrides Property Autosize() As Boolean
  299. Get
  300. Return aZ
  301. End Get
  302. Set(ByVal value As Boolean)
  303. aZ = value
  304. Invalidate()
  305. End Set
  306. End Property
  307. Sub New()
  308. SetStyle(ControlStyles.SupportsTransparentBackColor, True)
  309. BackColor = Color.Transparent
  310. Autosize = True
  311. End Sub
  312. Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  313. Dim Ell As Rectangle = New Rectangle(0, 0, 12, 12)
  314. Dim G As Graphics = e.Graphics
  315. If Autosize Then
  316. Size = New Size(Ell.Width + 5 + G.MeasureString(Text, Font).Width, _
  317. Ell.Height + 1)
  318. End If
  319. G.Clear(Parent.FindForm.BackColor)
  320. G.SmoothingMode = SmoothingMode.HighQuality
  321. If Enabled Then
  322. G.FillEllipse(Brushes.White, Ell)
  323. G.DrawEllipse(ToPen(40, Color.Black), Ell)
  324. If Checked Then
  325. G.FillEllipse(ToBrush(180, Color.Black), New Rectangle(New Point(Ell.X + 3, Ell.Y + 3), New Size(Ell.Width - 6, Ell.Height - 6)))
  326. End If
  327. G.DrawString(Text, Font, Brushes.Black, New Point(5 + Ell.X + Ell.Width, CInt(((Ell.Y + Ell.Width) / 2) - (G.MeasureString(Text, Font).Height / 2))))
  328. Else
  329. G.DrawEllipse(ToPen(40, Color.Black), Ell)
  330. If Checked Then
  331. G.FillEllipse(ToBrush(80, Color.Black), New Rectangle(New Point(Ell.X + 3, Ell.Y + 3), New Size(Ell.Width - 6, Ell.Height - 6)))
  332. End If
  333. G.DrawString(Text, Font, Brushes.DimGray, New Point(5 + Ell.X + Ell.Width, CInt(((Ell.Y + Ell.Width) / 2) - (G.MeasureString(Text, Font).Height / 2))))
  334. End If
  335. End Sub
  336. Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
  337. MyBase.OnTextChanged(e)
  338. Invalidate()
  339. End Sub
  340. Protected Overrides Sub OnClick(ByVal e As System.EventArgs)
  341. MyBase.OnClick(e)
  342. If Enabled Then
  343. If Not Checked Then Checked = True
  344. For Each ctl As Control In Parent.Controls
  345. If TypeOf ctl Is GraphiteRadio Then
  346. If ctl.Handle = Me.Handle Then Continue For
  347. If ctl.Enabled Then DirectCast(ctl, GraphiteRadio).Checked = False
  348. End If
  349. Next
  350. End If
  351. End Sub
  352. End Class
  353. Class GraphiteTabControl
  354. Inherits TabControl
  355. Sub New()
  356. SetStyle(ControlStyles.AllPaintingInWmPaint Or _
  357. ControlStyles.ResizeRedraw Or _
  358. ControlStyles.UserPaint Or _
  359. ControlStyles.DoubleBuffer, True)
  360. End Sub
  361. Protected Overrides Sub CreateHandle()
  362. MyBase.CreateHandle()
  363. Select Case Alignment
  364. Case TabAlignment.Left
  365. SizeMode = TabSizeMode.Fixed
  366. ItemSize = New Size(20, 75)
  367. Case TabAlignment.Right
  368. SizeMode = TabSizeMode.Fixed
  369. ItemSize = New Size(20, 75)
  370. Case Else
  371. SizeMode = TabSizeMode.Normal
  372. ItemSize = New Size(77, 21)
  373. End Select
  374. End Sub
  375. Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  376. Dim G As Graphics = e.Graphics
  377. Dim ItemBounds As Rectangle
  378. Dim TextBrush As New SolidBrush(Color.Empty)
  379. Dim SOFF As Integer = 0
  380. G.Clear(Color.FromArgb(236, 237, 239))
  381. For TabItemIndex As Integer = 0 To Me.TabCount - 1
  382. ItemBounds = Me.GetTabRect(TabItemIndex)
  383. If Not TabItemIndex = SelectedIndex Then
  384. SOFF = 2
  385. Select Case Alignment
  386. Case TabAlignment.Left
  387. G.FillPath(ToBrush(216, 217, 219), RoundRect(New Rectangle(New Point(ItemBounds.X + SOFF, ItemBounds.Y), New Size(ItemBounds.Width, ItemBounds.Height)), 2))
  388. G.DrawPath(ToPen(90, Color.Black), RoundRect(New Rectangle(New Point(ItemBounds.X, ItemBounds.Y), New Size(ItemBounds.Width, ItemBounds.Height)), 2))
  389. Dim sf As New StringFormat
  390. sf.LineAlignment = StringAlignment.Center
  391. sf.Alignment = StringAlignment.Center
  392. TextBrush.Color = Color.FromArgb(80, 80, 80)
  393. Try
  394. G.DrawString(TabPages(TabItemIndex).Text, New Font(Font.Name, Font.Size - 1), TextBrush, New Rectangle(GetTabRect(TabItemIndex).Location, GetTabRect(TabItemIndex).Size), sf)
  395. TabPages(TabItemIndex).BackColor = Color.FromArgb(236, 237, 239)
  396. Catch : End Try
  397. Case TabAlignment.Right
  398. G.FillPath(ToBrush(216, 217, 219), RoundRect(New Rectangle(New Point(ItemBounds.X, ItemBounds.Y + SOFF), New Size(ItemBounds.Width, ItemBounds.Height)), 2))
  399. G.DrawPath(ToPen(90, Color.Black), RoundRect(New Rectangle(New Point(ItemBounds.X, ItemBounds.Y + SOFF), New Size(ItemBounds.Width, ItemBounds.Height)), 2))
  400. Dim sf As New StringFormat
  401. sf.LineAlignment = StringAlignment.Center
  402. sf.Alignment = StringAlignment.Center
  403. TextBrush.Color = Color.FromArgb(80, 80, 80)
  404. Try
  405. G.DrawString(TabPages(TabItemIndex).Text, New Font(Font.Name, Font.Size - 1), TextBrush, New Rectangle(GetTabRect(TabItemIndex).Location, GetTabRect(TabItemIndex).Size), sf)
  406. TabPages(TabItemIndex).BackColor = Color.FromArgb(236, 237, 239)
  407. Catch : End Try
  408. Case TabAlignment.Top
  409. G.FillPath(ToBrush(216, 217, 219), RoundRect(New Rectangle(New Point(ItemBounds.X, ItemBounds.Y + SOFF), New Size(ItemBounds.Width, ItemBounds.Height)), 2))
  410. G.DrawPath(ToPen(90, Color.Black), RoundRect(New Rectangle(New Point(ItemBounds.X, ItemBounds.Y + SOFF), New Size(ItemBounds.Width, ItemBounds.Height)), 2))
  411. Dim sf As New StringFormat
  412. sf.LineAlignment = StringAlignment.Center
  413. sf.Alignment = StringAlignment.Center
  414. TextBrush.Color = Color.FromArgb(80, 80, 80)
  415. Try
  416. G.DrawString(TabPages(TabItemIndex).Text, New Font(Font.Name, Font.Size - 1), TextBrush, New Rectangle(GetTabRect(TabItemIndex).Location, GetTabRect(TabItemIndex).Size), sf)
  417. TabPages(TabItemIndex).BackColor = Color.FromArgb(236, 237, 239)
  418. Catch : End Try
  419. Case TabAlignment.Bottom
  420. G.FillPath(ToBrush(216, 217, 219), RoundRect(New Rectangle(New Point(ItemBounds.X, ItemBounds.Y - 6 + SOFF), New Size(ItemBounds.Width, ItemBounds.Height)), 2))
  421. G.DrawPath(ToPen(90, Color.Black), RoundRect(New Rectangle(New Point(ItemBounds.X, ItemBounds.Y - 6 + SOFF), New Size(ItemBounds.Width, ItemBounds.Height)), 2))
  422. Dim sf As New StringFormat
  423. sf.LineAlignment = StringAlignment.Center
  424. sf.Alignment = StringAlignment.Center
  425. TextBrush.Color = Color.FromArgb(80, 80, 80)
  426. Try
  427. G.DrawString(TabPages(TabItemIndex).Text, New Font(Font.Name, Font.Size - 1), TextBrush, New Rectangle(GetTabRect(TabItemIndex).Location - New Point(0, 2), GetTabRect(TabItemIndex).Size), sf)
  428. TabPages(TabItemIndex).BackColor = Color.FromArgb(236, 237, 239)
  429. Catch : End Try
  430. End Select
  431. End If
  432. Next
  433. Select Case Alignment
  434. Case TabAlignment.Top
  435. G.FillPath(ToBrush(236, 237, 239), RoundRect(0, 20, Width - 1, Height - 21, 2))
  436. G.DrawPath(ToPen(150, 151, 153), RoundRect(0, 20, Width - 1, Height - 21, 2))
  437. Case TabAlignment.Bottom
  438. G.DrawPath(ToPen(150, 151, 153), RoundRect(0, 0, Width - 1, Height - 22, 2))
  439. G.FillPath(ToBrush(236, 237, 239), RoundRect(1, 1, Width - 3, Height - 23, 2))
  440. Case TabAlignment.Right
  441. G.FillPath(ToBrush(236, 237, 239), RoundRect(0, 2, Width - 76, Height - 3, 2))
  442. G.DrawPath(ToPen(150, 151, 153), RoundRect(0, 2, Width - 76, Height - 3, 2))
  443. Case TabAlignment.Left
  444. G.FillPath(ToBrush(236, 237, 239), RoundRect(75, 2, Width - 76, Height - 3, 2))
  445. G.DrawPath(ToPen(150, 151, 153), RoundRect(75, 2, Width - 76, Height - 3, 2))
  446. End Select
  447. For TabItemIndex As Integer = 0 To Me.TabCount - 1
  448. ItemBounds = Me.GetTabRect(TabItemIndex)
  449. If TabItemIndex = SelectedIndex Then
  450. Select Case Alignment
  451. Case TabAlignment.Top
  452. G.FillPath(ToBrush(236, 237, 239), RoundRect(New Rectangle(New Point(ItemBounds.X - 2, ItemBounds.Y), New Size(ItemBounds.Width + 3, ItemBounds.Height - 2)), 2))
  453. G.DrawPath(ToPen(150, 151, 153), RoundRect(New Rectangle(New Point(ItemBounds.X - 2, ItemBounds.Y), New Size(ItemBounds.Width + 2, ItemBounds.Height - 2)), 2))
  454. G.FillRectangle(ToBrush(236, 237, 239), New Rectangle(New Point(ItemBounds.X - 1, ItemBounds.Y + 1), New Size(ItemBounds.Width + 1, ItemBounds.Height)))
  455. Case TabAlignment.Bottom
  456. G.FillPath(ToBrush(236, 237, 239), RoundRect(New Rectangle(New Point(ItemBounds.X - 2, ItemBounds.Y), New Size(ItemBounds.Width + 3, ItemBounds.Height - 2)), 2))
  457. G.DrawPath(ToPen(150, 151, 153), RoundRect(New Rectangle(New Point(ItemBounds.X - 2, ItemBounds.Y), New Size(ItemBounds.Width + 2, ItemBounds.Height - 2)), 2))
  458. G.FillRectangle(ToBrush(236, 237, 239), New Rectangle(New Point(ItemBounds.X - 1, ItemBounds.Y - 2), New Size(ItemBounds.Width + 1, ItemBounds.Height)))
  459. Case TabAlignment.Left
  460. G.FillPath(ToBrush(236, 237, 239), RoundRect(New Rectangle(New Point(ItemBounds.X - 2, ItemBounds.Y), New Size(ItemBounds.Width + 3, ItemBounds.Height + 2)), 2))
  461. G.DrawPath(ToPen(150, 151, 153), RoundRect(New Rectangle(New Point(ItemBounds.X - 2, ItemBounds.Y), New Size(ItemBounds.Width + 2, ItemBounds.Height + 1)), 2))
  462. G.FillRectangle(ToBrush(236, 237, 239), New Rectangle(New Point(ItemBounds.X + 1, ItemBounds.Y + 1), New Size(ItemBounds.Width + 6, ItemBounds.Height)))
  463. Case TabAlignment.Right
  464. G.FillPath(ToBrush(236, 237, 239), RoundRect(New Rectangle(New Point(ItemBounds.X - 2, ItemBounds.Y), New Size(ItemBounds.Width + 3, ItemBounds.Height + 1)), 2))
  465. G.DrawPath(ToPen(150, 151, 153), RoundRect(New Rectangle(New Point(ItemBounds.X - 2, ItemBounds.Y), New Size(ItemBounds.Width + 2, ItemBounds.Height + 2)), 2))
  466. G.FillRectangle(ToBrush(236, 237, 239), New Rectangle(New Point(ItemBounds.X - 7, ItemBounds.Y + 1), New Size(ItemBounds.Width + 6, ItemBounds.Height + 1)))
  467. End Select
  468. SOFF = 0
  469. Dim sf As New StringFormat
  470. sf.LineAlignment = StringAlignment.Center
  471. sf.Alignment = StringAlignment.Center
  472. TextBrush.Color = Color.FromArgb(80, 80, 80)
  473. Try
  474. G.DrawString(TabPages(TabItemIndex).Text, Font, TextBrush, New Rectangle(GetTabRect(TabItemIndex).Location + New Point(0, SOFF), GetTabRect(TabItemIndex).Size), sf)
  475. TabPages(TabItemIndex).BackColor = Color.FromArgb(236, 237, 239)
  476. Catch : End Try
  477. End If
  478. Next
  479. End Sub
  480. End Class
  481. Class GraphiteTheme
  482. Inherits ContainerControl
  483. Sub New()
  484. Dock = DockStyle.Fill
  485. BackColor = Color.FromArgb(235, 235, 235)
  486. ForeColor = Color.FromArgb(235, 235, 235)
  487. End Sub
  488. Protected Overrides Sub CreateHandle()
  489. MyBase.CreateHandle() : SendToBack()
  490. Parent.FindForm.TransparencyKey = Color.Fuchsia
  491. Parent.FindForm.FormBorderStyle = FormBorderStyle.None
  492. End Sub
  493. Private _ico As Icon
  494. Public Property Icon() As Icon
  495. Get
  496. Return _ico
  497. End Get
  498. Set(ByVal value As Icon)
  499. _ico = value
  500. Invalidate()
  501. End Set
  502. End Property
  503. #Region " Movement and Control Buttons"
  504. Private Cap As Boolean = False
  505. Private CapL As Point = Nothing
  506. Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  507. MyBase.OnMouseDown(e)
  508. If New Rectangle(0, 0, Width, 25).Contains(e.Location) Then
  509. Cap = True : CapL = e.Location : End If
  510. End Sub
  511. Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
  512. MyBase.OnMouseUp(e) : Cap = False
  513. End Sub
  514. Protected Overrides Sub OnMouseMove(ByVal e As System.Windows.Forms.MouseEventArgs)
  515. MyBase.OnMouseMove(e) : If Cap Then Parent.Location = MousePosition - CapL
  516. End Sub
  517. #End Region
  518. Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  519. MyBase.OnPaint(e) : Dim G As Graphics = e.Graphics
  520. G.Clear(BackColor)
  521. 'Title
  522. G.FillRectangle(ToBrush(78, 78, 78), New Rectangle(0, 0, Width, 19))
  523. G.FillRectangle(ToBrush(73, Color.White), New Rectangle(0, 0, Width, 10))
  524. 'Title Icon
  525. Try
  526. G.DrawIcon(_ico, New Rectangle(3, 3, 16, 16))
  527. Catch : End Try
  528. 'Title Text
  529. G.DrawString(Text, Font, ToBrush(120, Color.Black), New Point((Width / 2) - (G.MeasureString(Text, Font).Width / 2), 4))
  530. G.DrawString(Text, Font, ToBrush(ForeColor), New Point((Width / 2) - (G.MeasureString(Text, Font).Width / 2) + 1, 2))
  531. 'Border
  532. G.DrawRectangle(Pens.DimGray, New Rectangle(1, 1, Width - 3, Height - 3))
  533. G.DrawPath(Pens.Black, RoundRect(0, 0, Width - 1, Height - 1, 2))
  534. Try
  535. G.DrawRectangle(ToPen(Parent.FindForm.TransparencyKey), New Rectangle(0, 0, 1, 1))
  536. G.DrawRectangle(ToPen(Parent.FindForm.TransparencyKey), New Rectangle(Width - 1, 0, 1, 1))
  537. G.DrawRectangle(ToPen(Parent.FindForm.TransparencyKey), New Rectangle(0, Height - 1, 1, 1))
  538. G.DrawRectangle(ToPen(Parent.FindForm.TransparencyKey), New Rectangle(Width - 1, Height - 1, 1, 1))
  539. Catch : End Try
  540. End Sub
  541. End Class
  542. Class GraphiteTrackBar
  543. Inherits Control
  544. #Region "Properties"
  545. Dim _Maximum As Integer = 10
  546. Public Property Maximum() As Integer
  547. Get
  548. Return _Maximum
  549. End Get
  550. Set(ByVal value As Integer)
  551. If value > 0 Then _Maximum = value
  552. If value < _Value Then _Value = value
  553. Invalidate()
  554. End Set
  555. End Property
  556. Event ValueChanged()
  557. Dim _Value As Integer = 0
  558. Public Property Value() As Integer
  559. Get
  560. Return _Value
  561. End Get
  562. Set(ByVal value As Integer)
  563. Select Case value
  564. Case Is = _Value
  565. Exit Property
  566. Case Is < 0
  567. _Value = 0
  568. Case Is > _Maximum
  569. _Value = _Maximum
  570. Case Else
  571. _Value = value
  572. End Select
  573. Invalidate()
  574. RaiseEvent ValueChanged()
  575. End Set
  576. End Property
  577. #End Region
  578. Sub New()
  579. Me.SetStyle(ControlStyles.DoubleBuffer, True)
  580. Me.SetStyle(ControlStyles.AllPaintingInWmPaint, True)
  581. Me.SetStyle(ControlStyles.ResizeRedraw, True)
  582. Me.SetStyle(ControlStyles.UserPaint, True)
  583. Me.SetStyle(ControlStyles.Selectable, True)
  584. Me.SetStyle(ControlStyles.SupportsTransparentBackColor, True)
  585. End Sub
  586. Dim CaptureM As Boolean = False
  587. Dim Bar As Rectangle = New Rectangle(0, 10, Width - 1, Height - 21)
  588. Dim Track As Size = New Size(20, 10)
  589. Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  590. MyBase.OnPaint(e)
  591. Dim G As Graphics = e.Graphics
  592. Bar = New Rectangle(15, 10, Width - 31, Height - 21)
  593. G.Clear(Parent.FindForm.BackColor)
  594. G.FillRectangle(ToBrush(20, Color.Black), New Rectangle(0, CInt((Height / 2) - 2), Width - 1, 4))
  595. G.DrawRectangle(ToPen(20, Color.Black), New Rectangle(0, CInt((Height / 2) - 2), Width - 1, 4))
  596. G.FillRectangle(ToBrush(180, Color.Black), New Rectangle(1, CInt((Height / 2) - 2), CInt(Bar.Width * (Value / Maximum)) + CInt(Track.Width / 2), 4))
  597. G.FillRectangle(ToBrush(Parent.FindForm.BackColor), New Rectangle(New Point(Bar.X + CInt(Bar.Width * (Value / Maximum)) - CInt(Track.Width / 2), Bar.Y + CInt((Bar.Height / 2)) - CInt(Track.Height / 2)), New Size(Track.Width, Track.Height)))
  598. G.DrawRectangle(ToPen(50, Color.Black), New Rectangle(New Point(Bar.X + CInt(Bar.Width * (Value / Maximum)) - CInt(Track.Width / 2), Bar.Y + CInt((Bar.Height / 2)) - CInt(Track.Height / 2)), New Size(Track.Width, Track.Height)))
  599. End Sub
  600. Protected Overrides Sub OnHandleCreated(ByVal e As System.EventArgs)
  601. Me.BackColor = Color.Transparent
  602. MyBase.OnHandleCreated(e)
  603. End Sub
  604. Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
  605. MyBase.OnMouseDown(e)
  606. Dim mp = New Rectangle(New Point(e.Location.X, e.Location.Y), New Size(1, 1))
  607. Dim Bar As Rectangle = New Rectangle(10, 10, Width - 21, Height - 21)
  608. If New Rectangle(New Point(Bar.X + CInt(Bar.Width * (Value / Maximum)) - CInt(Track.Width / 2), 0), New Size(Track.Width, Height)).IntersectsWith(mp) Then
  609. CaptureM = True
  610. End If
  611. End Sub
  612. Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
  613. MyBase.OnMouseUp(e)
  614. CaptureM = False
  615. End Sub
  616. Protected Overrides Sub OnMouseMove(ByVal e As System.Windows.Forms.MouseEventArgs)
  617. MyBase.OnMouseMove(e)
  618. If CaptureM Then
  619. Dim mp As Point = New Point(e.X, e.Y)
  620. Dim Bar As Rectangle = New Rectangle(10, 10, Width - 21, Height - 21)
  621. Value = CInt(Maximum * ((mp.X - Bar.X) / Bar.Width))
  622. End If
  623. End Sub
  624. Protected Overrides Sub OnMouseLeave(ByVal e As System.EventArgs)
  625. MyBase.OnMouseLeave(e) : CaptureM = False
  626. End Sub
  627. End Class
  628. Class GraphiteSeperator
  629. Inherits Control
  630. Enum POrientation
  631. Horizonal = 0
  632. Vertical = 1
  633. End Enum
  634. Private ori As POrientation
  635. Public Property Orientation() As POrientation
  636. Get
  637. Return ori
  638. End Get
  639. Set(ByVal value As POrientation)
  640. ori = value
  641. If ori = POrientation.Horizonal Then If Height > Width Then Size = New Size(Height, Width)
  642. If ori = POrientation.Vertical Then If Width > Height Then Size = New Size(Height, Width)
  643. Invalidate()
  644. End Set
  645. End Property
  646. Sub New()
  647. Size = New Size(100, 10)
  648. End Sub
  649. Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  650. MyBase.OnPaint(e)
  651. Dim G As Graphics = e.Graphics
  652. G.Clear(Parent.BackColor)
  653. Select Case ori
  654. Case POrientation.Horizonal
  655. G.DrawLine(ToPen(40, Color.Black), New Point(0, CInt(Height / 2) - 1), New Point(Width, CInt(Height / 2) - 1))
  656. G.DrawLine(ToPen(20, Color.White), New Point(0, CInt(Height / 2)), New Point(Width, CInt(Height / 2)))
  657. Case POrientation.Vertical
  658. G.DrawLine(ToPen(40, Color.Black), New Point(CInt(Width / 2) - 1, 0), New Point(CInt(Width / 2) - 1, Height))
  659. G.DrawLine(ToPen(20, Color.White), New Point(CInt(Width / 2), 0), New Point(CInt(Width / 2), Height))
  660. End Select
  661. End Sub
  662. Protected Overrides Sub OnResize(ByVal e As System.EventArgs)
  663. MyBase.OnResize(e)
  664. Select Case ori
  665. Case POrientation.Horizonal
  666. Size = New Size(Width, 10)
  667. Case POrientation.Vertical
  668. Size = New Size(10, Height)
  669. End Select
  670. End Sub
  671. End Class
  672. Class GraphiteComboBox
  673. Inherits ComboBox
  674. Sub New()
  675. MyBase.New()
  676. SetStyle(ControlStyles.AllPaintingInWmPaint Or _
  677. ControlStyles.ResizeRedraw Or _
  678. ControlStyles.UserPaint Or _
  679. ControlStyles.DoubleBuffer, True)
  680. DrawMode = Windows.Forms.DrawMode.OwnerDrawFixed
  681. BackColor = Color.FromArgb(235, 235, 235)
  682. ForeColor = Color.FromArgb(31, 31, 31)
  683. DropDownStyle = ComboBoxStyle.DropDownList
  684. End Sub
  685. Private _StartIndex As Integer = 0
  686. Public Property StartIndex As Integer
  687. Get
  688. Return _StartIndex
  689. End Get
  690. Set(ByVal value As Integer)
  691. _StartIndex = value
  692. Try
  693. MyBase.SelectedIndex = value
  694. Catch
  695. End Try
  696. Invalidate()
  697. End Set
  698. End Property
  699. Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
  700. If Not DropDownStyle = ComboBoxStyle.DropDownList Then DropDownStyle = ComboBoxStyle.DropDownList
  701. MyBase.OnPaint(e)
  702. Dim G As Graphics = e.Graphics
  703. Dim T As LinearGradientBrush = New LinearGradientBrush(New Rectangle(0, 0, Width, Height), Color.FromArgb(0, Color.Black), Color.FromArgb(22, Color.Black), 90S)
  704. Dim DrawCornersBrush As SolidBrush
  705. DrawCornersBrush = ToBrush(235, 235, 235)
  706. Try
  707. With G
  708. G.SmoothingMode = SmoothingMode.HighQuality
  709. .Clear(Color.FromArgb(235, 235, 235))
  710. .FillRectangle(T, New Rectangle(0, 0, Width, Height))
  711. .DrawLine(ToPen(235, 235, 235), 0, 0, 0, 0)
  712. .DrawRectangle(ToPen(235, 235, 235), New Rectangle(1, 1, Width - 3, Height - 3))
  713. .DrawLine(ToPen(80, Color.Black), New Point(Width - 22, 4), New Point(Width - 22, Height - 5))
  714. Dim K As New GraphicsPath
  715. K.AddEllipse(-Width \ 2, -Height, Width * 2, CInt(Height * 1.55))
  716. Dim kK As New PathGradientBrush(K)
  717. kK.CenterColor = Color.Transparent
  718. kK.SurroundColors = New Color() {Color.FromArgb(100, Color.White)}
  719. .FillPath(kK, K)
  720. Try
  721. If .MeasureString(Text, Font).Width > Width - 29 Then
  722. .DrawString(Items(SelectedIndex).ToString, Font, ToBrush(71, 71, 71), New RectangleF(3, 3, Width - 35, Height - 7))
  723. .DrawString("...", Font, ToBrush(71, 71, 71), New Point(Width - 38, 3))
  724. Else
  725. .DrawString(Items(SelectedIndex).ToString, Font, ToBrush(71, 71, 71), New RectangleF(3, 3, Width - 35, Height - 7))
  726. End If
  727. Catch
  728. .DrawString("...", Font, ToBrush(71, 71, 71), New Point(3, 3))
  729. End Try
  730. DrawTriangle(Color.FromArgb(71, 71, 71), New Point(Width - 15, Height - 10), New Point(Width - 12, Height - 7), New Point(Width - 9, Height - 10), G)
  731. DrawTriangle(Color.FromArgb(235, 235, 235), New Point(Width - 15, Height - 12), New Point(Width - 12, Height - 8), New Point(Width - 9, Height - 12), G)
  732. DrawTriangle(Color.FromArgb(71, 71, 71), New Point(Width - 15, 9), New Point(Width - 12, 6), New Point(Width - 9, 9), G)
  733. DrawTriangle(Color.FromArgb(235, 235, 235), New Point(Width - 15, 11), New Point(Width - 12, 7), New Point(Width - 9, 11), G)
  734. .DrawPath(ToPen(120, Color.Black), RoundRect(0, 0, Width - 1, Height - 1, 2))
  735. End With
  736. Catch
  737. End Try
  738. End Sub
  739. Sub ReplaceItem(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles Me.DrawItem
  740. e.DrawBackground()
  741. Try
  742. If (e.State And DrawItemState.Selected) = DrawItemState.Selected Then
  743. e.Graphics.FillRectangle(ToBrush(200, 200, 200), e.Bounds)
  744. End If
  745. e.Graphics.DrawString(MyBase.GetItemText(MyBase.Items(e.Index)), e.Font, ToBrush(71, 71, 71), e.Bounds)
  746. Catch : End Try
  747. End Sub
  748. Protected Sub DrawTriangle(ByVal Clr As Color, ByVal FirstPoint As Point, ByVal SecondPoint As Point, ByVal ThirdPoint As Point, ByVal G As Graphics)
  749. Dim points As New List(Of Point)()
  750. points.Add(FirstPoint)
  751. points.Add(SecondPoint)
  752. points.Add(ThirdPoint)
  753. G.FillPolygon(New SolidBrush(Clr), points.ToArray)
  754. End Sub
  755. End Class
  756. Class GraphiteCheck
  757. Inherits Control
  758. Sub New()
  759. Check = False
  760. Az = True
  761. End Sub
  762. Private [Check] As Boolean
  763. Public Property Checked() As Boolean
  764. Get
  765. Return [Check]
  766. End Get
  767. Set(ByVal value As Boolean)
  768. [Check] = value
  769. Invalidate()
  770. End Set
  771. End Property
  772. Private [Az] As Boolean
  773. Public Property AutoResize() As Boolean
  774. Get
  775. Return [Az]
  776. End Get
  777. Set(ByVal value As Boolean)
  778. [Az] = value
  779. OnResize(EventArgs.Empty)
  780. End Set
  781. End Property
  782. Protected Overrides Sub OnResize(ByVal e As System.EventArgs)
  783. MyBase.OnResize(e)
  784. If Az Then Size = New Size(15 + CreateGraphics().MeasureString(Text, Font).Width, 13)
  785. End Sub
  786. Protected Overrides Sub OnMouseClick(ByVal e As System.Windows.Forms.MouseEventArgs)
  787. MyBase.OnMouseClick(e) : Checked = Not Checked : Invalidate()
  788. End Sub
  789. Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
  790. Dim G As Graphics = e.Graphics
  791. G.Clear(BackColor)
  792. G.FillPath(Brushes.White, RoundRect(0, 0, Height - 1, Height - 1, 2))
  793. G.DrawPath(ToPen(120, Color.Black), RoundRect(0, 0, Height - 1, Height - 1, 2))
  794. Dim ChkSize As Integer = Height - 1
  795. If Checked Then
  796. Dim WWidth As Integer = Height
  797. G.SmoothingMode = SmoothingMode.HighQuality
  798. Dim OFS As Integer = -2
  799. Dim CP As Point() = {New Point(ChkSize / 4, ChkSize / 2), New Point(ChkSize / 2, ChkSize - (ChkSize / 4)), New Point(ChkSize - (ChkSize / 5), ChkSize / 4), New Point(ChkSize - (ChkSize / 4), (ChkSize / 4) + OFS), New Point(ChkSize / 2, ChkSize - (ChkSize / 4) + OFS), New Point(ChkSize / 4, (ChkSize / 2) + OFS)}
  800. G.FillPolygon(Brushes.Black, CP)
  801. End If
  802. G.DrawString(Text, Font, ToBrush(ForeColor), New Point(ChkSize + 3, CInt(Height / 2) - CInt(G.MeasureString(Text, Font).Height / 2)))
  803. End Sub
  804. Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
  805. MyBase.OnTextChanged(e) : OnResize(EventArgs.Empty) : Invalidate()
  806. End Sub
  807. End Class

comments powered by Disqus