Guest User

Kingwood theme - Dark

a guest
Dec 18th, 2014
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.47 KB | None | 0 0
  1. Imports System.Drawing.Drawing2D
  2.  
  3. 'Made by AeroRev9.
  4. 'HackForums.
  5.  
  6. Module Base
  7.  
  8. Public UI As Color = Color.FromArgb(62, 71, 86)
  9. Public UIFont As New Font("Segoe UI", 10)
  10.  
  11. Public Enum MouseState As Byte
  12. None
  13. Hover
  14. Down
  15. End Enum
  16.  
  17. Public Sub RoundRect(ByVal G As Graphics, _
  18. ByVal X As Integer, _
  19. ByVal Y As Integer, _
  20. ByVal Width As Integer, _
  21. ByVal Height As Integer, _
  22. ByVal Curve As Integer, _
  23. ByVal Draw As Color)
  24.  
  25.  
  26. Dim BaseRect As New RectangleF(X, Y, Width,
  27. Height)
  28. Dim ArcRect As New RectangleF(BaseRect.Location,
  29. New SizeF(Curve, Curve))
  30.  
  31. G.DrawArc(New Pen(Draw), ArcRect, 180, 90)
  32. G.DrawLine(New Pen(Draw), X + CInt(Curve / 2),
  33. Y,
  34. Y + Width - CInt(Curve / 2),
  35. Y)
  36.  
  37. ArcRect.X = BaseRect.Right - Curve
  38. G.DrawArc(New Pen(Draw), ArcRect, 270, 90)
  39. G.DrawLine(New Pen(Draw), X + Width,
  40. Y + CInt(Curve / 2),
  41. X + Width,
  42. Y + Height - CInt(Curve / 2))
  43.  
  44. ArcRect.Y = BaseRect.Bottom - Curve
  45. G.DrawArc(New Pen(Draw), ArcRect, 0, 90)
  46. G.DrawLine(New Pen(Draw), X + CInt(Curve / 2),
  47. Y + Height,
  48. X + Width - CInt(Curve / 2),
  49. Y + Height)
  50.  
  51. ArcRect.X = BaseRect.Left
  52. G.DrawArc(New Pen(Draw), ArcRect, 90, 90)
  53. G.DrawLine(New Pen(Draw),
  54. X, Y + CInt(Curve / 2),
  55. X,
  56. Y + Height - CInt(Curve / 2))
  57.  
  58. End Sub
  59.  
  60. Public Sub CenterString(G As Graphics, text As String, font As Font, brush As Brush, rect As Rectangle, Optional shadow As Boolean = False, Optional yOffset As Integer = 0)
  61.  
  62. Dim textSize As SizeF = G.MeasureString(text, font)
  63. Dim textX As Integer = rect.X + (rect.Width / 2) - (textSize.Width / 2)
  64. Dim textY As Integer = rect.Y + (rect.Height / 2) - (textSize.Height / 2) + yOffset
  65.  
  66. If shadow Then G.DrawString(text, font, Brushes.Black, textX + 1, textY + 1)
  67. G.DrawString(text, font, brush, textX, textY + 1)
  68.  
  69. End Sub
  70.  
  71. Public Sub DrawTriangle(G As Graphics, Rect As Rectangle, Draw As Color)
  72. Dim halfWidth As Integer = Rect.Width / 2
  73. Dim halfHeight As Integer = Rect.Height / 2
  74. Dim p0 As Point = Point.Empty
  75. Dim p1 As Point = Point.Empty
  76. Dim p2 As Point = Point.Empty
  77.  
  78.  
  79. p0 = New Point(Rect.Left + halfWidth, Rect.Bottom)
  80. p1 = New Point(Rect.Left, Rect.Top)
  81. p2 = New Point(Rect.Right, Rect.Top)
  82.  
  83. G.FillPolygon(New SolidBrush(Draw), New Point() {p0, p1, p2})
  84. End Sub
  85.  
  86. End Module
  87.  
  88. Class KingwoodForm
  89. Inherits ContainerControl
  90.  
  91. Sub New()
  92. BackColor = Color.FromArgb(227, 227, 227)
  93. Dock = DockStyle.Fill
  94. Font = New Font("Segoe UI", 10)
  95. End Sub
  96.  
  97. End Class
  98.  
  99. Class KingwoodButton
  100. Inherits Button
  101.  
  102. Private State As MouseState
  103.  
  104. Protected Overrides Sub OnCreateControl()
  105. MyBase.OnCreateControl()
  106. SetStyle(ControlStyles.UserPaint, True)
  107. End Sub
  108.  
  109. Protected Overrides Sub OnPaint(e As PaintEventArgs)
  110.  
  111. Dim G As Graphics = e.Graphics
  112. G.SmoothingMode = SmoothingMode.HighQuality
  113. G.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAliasGridFit
  114.  
  115. MyBase.OnPaint(e)
  116.  
  117. G.Clear(Color.FromArgb(227, 227, 227))
  118.  
  119. Select Case State
  120.  
  121. Case MouseState.Down
  122. G.FillRectangle(New SolidBrush(Color.FromArgb(62, 71, 86)), New Rectangle(1, 1, Width - 2, Height - 2))
  123. Case MouseState.Hover
  124. G.FillRectangle(New SolidBrush(Color.FromArgb(62, 71, 95)), New Rectangle(1, 1, Width - 2, Height - 2))
  125. RoundRect(G, 0, 0, Width - 1, Height - 1, 2, Color.FromArgb(62, 71, 86))
  126. Case Else
  127. G.FillRectangle(New SolidBrush(UI), New Rectangle(1, 1, Width - 2, Height - 2))
  128. RoundRect(G, 0, 0, Width - 1, Height - 1, 2, UI)
  129. End Select
  130.  
  131. CenterString(G, Text, UIFont, Brushes.White, New Rectangle(0, 0, Width, Height))
  132.  
  133. End Sub
  134.  
  135. Protected Overrides Sub OnMouseEnter(e As EventArgs)
  136. MyBase.OnMouseEnter(e)
  137. State = MouseState.Hover : Invalidate()
  138. End Sub
  139.  
  140. Protected Overrides Sub OnMouseLeave(e As EventArgs)
  141. MyBase.OnMouseLeave(e)
  142. State = MouseState.None : Invalidate()
  143. End Sub
  144.  
  145. Protected Overrides Sub OnMouseDown(e As MouseEventArgs)
  146. MyBase.OnMouseDown(e)
  147. State = MouseState.Down : Invalidate()
  148. End Sub
  149.  
  150. Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
  151. MyBase.OnMouseUp(e)
  152. State = MouseState.Hover : Invalidate()
  153. End Sub
  154.  
  155. End Class
  156.  
  157. Class KingwoodCheckBox
  158. Inherits Control
  159.  
  160. Event CheckedChanged(sender As Object)
  161.  
  162. Private _Checked As Boolean
  163. Public Property Checked As Boolean
  164. Get
  165. Return _Checked
  166. End Get
  167. Set(value As Boolean)
  168. _Checked = value
  169. Invalidate()
  170. End Set
  171. End Property
  172.  
  173. Protected Overrides Sub OnResize(e As EventArgs)
  174. MyBase.OnResize(e)
  175. Size = New Point(Width, 17)
  176. End Sub
  177.  
  178. Protected Overrides Sub OnPaint(e As PaintEventArgs)
  179.  
  180. Dim G As Graphics = e.Graphics
  181. G.SmoothingMode = SmoothingMode.HighQuality
  182. G.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
  183.  
  184. MyBase.OnPaint(e)
  185.  
  186. G.DrawString(Text, UIFont, New SolidBrush(Color.FromArgb(110, 110, 110)), New Point(22, -1))
  187. G.DrawRectangle(New Pen(Color.FromArgb(170, 170, 170)), New Rectangle(0, 0, 15, 15))
  188.  
  189. If Checked Then
  190. G.FillRectangle(New SolidBrush(UI), New Rectangle(3, 3, 10, 10))
  191. RoundRect(G, 2, 2, 11, 11, 3, UI)
  192. End If
  193.  
  194. End Sub
  195.  
  196. Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
  197. MyBase.OnMouseUp(e)
  198.  
  199. If Checked Then
  200. Checked = False
  201. Else
  202. Checked = True
  203. End If
  204.  
  205. End Sub
  206.  
  207. End Class
  208.  
  209. Class KingwoodRadioButton
  210. Inherits Control
  211.  
  212. Event CheckedChanged(sender As Object)
  213.  
  214. Private _Checked As Boolean
  215. Public Property Checked As Boolean
  216. Get
  217. Return _Checked
  218. End Get
  219. Set(value As Boolean)
  220. _Checked = value
  221. Invalidate()
  222. End Set
  223. End Property
  224.  
  225. Protected Overrides Sub OnResize(e As EventArgs)
  226. MyBase.OnResize(e)
  227. Size = New Point(Width, 17)
  228. End Sub
  229.  
  230. Protected Overrides Sub OnPaint(e As PaintEventArgs)
  231.  
  232. Dim G As Graphics = e.Graphics
  233. G.SmoothingMode = SmoothingMode.HighQuality
  234. G.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
  235.  
  236. MyBase.OnPaint(e)
  237.  
  238. G.DrawString(Text, UIFont, New SolidBrush(Color.FromArgb(110, 110, 110)), New Point(22, -1))
  239. G.DrawEllipse(New Pen(Color.FromArgb(170, 170, 170)), New Rectangle(0, 0, 15, 15))
  240.  
  241. If Checked Then
  242. G.FillEllipse(New SolidBrush(UI), New Rectangle(2, 2, 11, 11))
  243. End If
  244.  
  245. End Sub
  246.  
  247. Protected Overrides Sub OnMouseUp(e As MouseEventArgs)
  248. MyBase.OnMouseUp(e)
  249.  
  250. If Checked Then
  251. Checked = False
  252. Else
  253. Checked = True
  254. End If
  255.  
  256. End Sub
  257.  
  258. End Class
  259.  
  260. Class KingwoodGroupBox
  261. Inherits GroupBox
  262.  
  263. Protected Overrides Sub OnCreateControl()
  264. MyBase.OnCreateControl()
  265. SetStyle(ControlStyles.UserPaint, True)
  266. End Sub
  267.  
  268. Protected Overrides Sub OnPaint(e As PaintEventArgs)
  269.  
  270. Dim G As Graphics = e.Graphics
  271. G.SmoothingMode = SmoothingMode.HighQuality
  272. G.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAliasGridFit
  273.  
  274. MyBase.OnPaint(e)
  275.  
  276. G.Clear(Color.FromArgb(227, 227, 227))
  277.  
  278. G.DrawRectangle(New Pen(Color.FromArgb(210, 210, 210)), New Rectangle(0, 0, Width - 1, Height - 1))
  279.  
  280. G.FillRectangle(New SolidBrush(Color.FromArgb(62, 71, 86)), New Rectangle(0, 0, Width, 30))
  281. CenterString(G, Text, UIFont, Brushes.White, New Rectangle(0, 0, Width, 30))
  282.  
  283. End Sub
  284.  
  285. End Class
  286.  
  287. Class KingwoodProgressBar
  288. Inherits Control
  289.  
  290. Private _Maximum As Integer
  291. Public Property Maximum As Integer
  292. Get
  293. Return _Maximum
  294. End Get
  295. Set(value As Integer)
  296. _Maximum = value
  297. Invalidate()
  298. End Set
  299. End Property
  300.  
  301. Private _Minimum As Integer
  302. Public Property Minimum As Integer
  303. Get
  304. Return _Minimum
  305. End Get
  306. Set(value As Integer)
  307. _Minimum = value
  308. Invalidate()
  309. End Set
  310. End Property
  311.  
  312. Private _Value As Integer
  313. Public Property Value As Integer
  314. Get
  315. Return _Value
  316. End Get
  317. Set(value As Integer)
  318. _Value = value
  319. Invalidate()
  320. End Set
  321. End Property
  322.  
  323. Sub New()
  324. Maximum = 100
  325. Minimum = 0
  326. Value = 0
  327. End Sub
  328.  
  329. Protected Overrides Sub OnPaint(e As PaintEventArgs)
  330.  
  331. Dim G As Graphics = e.Graphics
  332. G.SmoothingMode = SmoothingMode.HighQuality
  333.  
  334. MyBase.OnPaint(e)
  335.  
  336. G.DrawRectangle(New Pen(Color.FromArgb(210, 210, 210)), New Rectangle(0, 0, Width - 1, Height - 1))
  337.  
  338. Select Case _Value
  339. Case Is > 2
  340. G.FillRectangle(New SolidBrush(UI), New Rectangle(0, 0, CInt(Value / Maximum * Width), Height))
  341. Case Is > 0
  342. G.FillRectangle(New SolidBrush(UI), New Rectangle(0, 0, CInt(Value / Maximum * Width), Height))
  343. End Select
  344.  
  345. End Sub
  346.  
  347. End Class
  348.  
  349. Class KingwoodMessage
  350. Inherits TextBox
  351.  
  352. Protected Overrides Sub OnCreateControl()
  353. MyBase.OnCreateControl()
  354. SetStyle(ControlStyles.UserPaint, True)
  355. Enabled = False
  356. Multiline = True
  357. BorderStyle = Windows.Forms.BorderStyle.None
  358. End Sub
  359.  
  360. Protected Overrides Sub OnPaint(e As PaintEventArgs)
  361.  
  362. Dim G As Graphics = e.Graphics
  363. G.SmoothingMode = SmoothingMode.HighQuality
  364. G.TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
  365.  
  366. MyBase.OnPaint(e)
  367.  
  368. G.Clear(Color.FromArgb(227, 227, 227))
  369.  
  370. G.FillRectangle(New SolidBrush(Color.FromArgb(250, 245, 216)), New Rectangle(1, 1, Width - 2, Height - 2))
  371. RoundRect(G, 0, 0, Width - 1, Height - 1, 3, Color.FromArgb(225, 220, 191))
  372.  
  373. G.DrawString(Text, UIFont, New SolidBrush(Color.FromArgb(110, 110, 110)), New Point(12, 8))
  374.  
  375. End Sub
  376.  
  377.  
  378. End Class
  379.  
  380. Class KingwoodTextBox
  381. Inherits Control
  382.  
  383. Dim WithEvents _tb As New TextBox
  384. Private State As MouseState
  385.  
  386. #Region "Properties"
  387.  
  388. Private _allowpassword As Boolean = False
  389. Public Shadows Property UseSystemPasswordChar() As Boolean
  390. Get
  391. Return _allowpassword
  392. End Get
  393. Set(ByVal value As Boolean)
  394. _tb.UseSystemPasswordChar = UseSystemPasswordChar
  395. _allowpassword = value
  396. Invalidate()
  397. End Set
  398. End Property
  399.  
  400. Private _maxChars As Integer = 32767
  401. Public Shadows Property MaxLength() As Integer
  402. Get
  403. Return _maxChars
  404. End Get
  405. Set(ByVal value As Integer)
  406. _maxChars = value
  407. _tb.MaxLength = MaxLength
  408. Invalidate()
  409. End Set
  410. End Property
  411.  
  412. Private _textAlignment As HorizontalAlignment
  413. Public Shadows Property TextAlign() As HorizontalAlignment
  414. Get
  415. Return _textAlignment
  416. End Get
  417. Set(ByVal value As HorizontalAlignment)
  418. _textAlignment = value
  419. Invalidate()
  420. End Set
  421. End Property
  422.  
  423. Private _multiLine As Boolean = False
  424. Public Shadows Property MultiLine() As Boolean
  425. Get
  426. Return _multiLine
  427. End Get
  428. Set(ByVal value As Boolean)
  429. _multiLine = value
  430. _tb.Multiline = value
  431. OnResize(EventArgs.Empty)
  432. Invalidate()
  433. End Set
  434. End Property
  435.  
  436. Private _readOnly As Boolean = False
  437. Public Shadows Property [ReadOnly]() As Boolean
  438. Get
  439. Return _readOnly
  440. End Get
  441. Set(ByVal value As Boolean)
  442. _readOnly = value
  443. If _tb IsNot Nothing Then
  444. _tb.ReadOnly = value
  445. End If
  446. End Set
  447. End Property
  448.  
  449. Protected Overrides Sub OnTextChanged(ByVal e As EventArgs)
  450. MyBase.OnTextChanged(e)
  451.  
  452. Invalidate()
  453.  
  454. End Sub
  455.  
  456. Protected Overrides Sub OnGotFocus(ByVal e As EventArgs)
  457. MyBase.OnGotFocus(e)
  458. _tb.Focus()
  459. End Sub
  460.  
  461. Private Sub TextChangeTb() Handles _tb.TextChanged
  462. Text = _tb.Text
  463. End Sub
  464.  
  465. Private Sub TextChng() Handles MyBase.TextChanged
  466. _tb.Text = Text
  467. End Sub
  468.  
  469. #End Region
  470.  
  471. Public Sub NewTextBox()
  472. With _tb
  473. .Text = String.Empty
  474. .BackColor = Color.FromArgb(227, 227, 227)
  475. .ForeColor = Color.FromArgb(130, 130, 130)
  476. .TextAlign = HorizontalAlignment.Left
  477. .BorderStyle = BorderStyle.None
  478. .Font = UIFont
  479. .Size = New Size(Width - 3, Height - 3)
  480. .UseSystemPasswordChar = UseSystemPasswordChar
  481. End With
  482. End Sub
  483.  
  484. Sub New()
  485. MyBase.New()
  486. NewTextBox()
  487. Controls.Add(_tb)
  488. SetStyle(ControlStyles.UserPaint Or ControlStyles.SupportsTransparentBackColor, True)
  489. DoubleBuffered = True
  490. TextAlign = HorizontalAlignment.Left
  491. ForeColor = Color.FromArgb(170, 170, 170)
  492. Font = UIFont
  493. Size = New Size(130, 29)
  494. End Sub
  495.  
  496. Protected Overrides Sub OnPaint(ByVal e As Windows.Forms.PaintEventArgs)
  497.  
  498. Dim G As Graphics = e.Graphics
  499. G.SmoothingMode = Drawing2D.SmoothingMode.HighQuality
  500.  
  501. MyBase.OnPaint(e)
  502.  
  503. G.Clear(Color.FromArgb(227, 227, 227))
  504.  
  505. If State = MouseState.Down Then
  506. RoundRect(G, 0, 0, Width - 1, Height - 1, 3, Color.FromArgb(62, 71, 86))
  507. Else
  508. RoundRect(G, 0, 0, Width - 1, Height - 1, 3, Color.FromArgb(210, 210, 210))
  509. End If
  510.  
  511. _tb.TextAlign = TextAlign
  512. _tb.UseSystemPasswordChar = UseSystemPasswordChar
  513.  
  514. End Sub
  515.  
  516. Protected Overrides Sub OnResize(e As EventArgs)
  517. MyBase.OnResize(e)
  518. If Not MultiLine Then
  519. Dim tbheight As Integer = _tb.Height
  520. _tb.Location = New Point(10, CType(((Height / 2) - (tbheight / 2) - 0), Integer))
  521. _tb.Size = New Size(Width - 20, tbheight)
  522. Else
  523. _tb.Location = New Point(10, 10)
  524. _tb.Size = New Size(Width - 20, Height - 20)
  525. End If
  526. End Sub
  527.  
  528. Protected Overrides Sub OnEnter(e As EventArgs)
  529. MyBase.OnEnter(e)
  530. State = MouseState.Down : Invalidate()
  531. End Sub
  532.  
  533. Protected Overrides Sub OnLeave(e As EventArgs)
  534. MyBase.OnLeave(e)
  535. State = MouseState.None : Invalidate()
  536. End Sub
  537.  
  538. End Class
Advertisement
Add Comment
Please, Sign In to add comment