Japt

VB6 Button - VB.NET

Jul 18th, 2016
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.11 KB | None | 0 0
  1. '------------------
  2. 'Creator: aeonhack
  3. 'Site: elitevs.net
  4. 'Created: 9/24/2011
  5. 'Changed: 9/24/2011
  6. 'Version: 1.0.0
  7. 'Theme Base: 1.5.3
  8. '------------------
  9. Class VB6Button
  10. Inherits ThemeControl153
  11.  
  12. Sub New()
  13. SetColor("Back", 240, 240, 240)
  14. SetColor("Border1", Color.White)
  15. SetColor("Border2", 227, 227, 227)
  16. SetColor("Border3", 160, 160, 160)
  17. SetColor("Border4", 105, 105, 105)
  18. SetColor("Text", Color.Black)
  19. SetColor("Focus", Color.Black)
  20. End Sub
  21.  
  22. Private C1 As Color
  23. Private P1, P2, P3, P4, P5 As Pen
  24. Private B1 As SolidBrush
  25.  
  26. Protected Overrides Sub ColorHook()
  27. C1 = GetColor("Back")
  28.  
  29. B1 = GetBrush("Text")
  30.  
  31. P1 = GetPen("Border1")
  32. P2 = GetPen("Border2")
  33. P3 = GetPen("Border3")
  34. P4 = GetPen("Border4")
  35. P5 = GetPen("Focus")
  36.  
  37. P5.DashStyle = DashStyle.Dot
  38. End Sub
  39.  
  40. Protected Overrides Sub PaintHook()
  41. G.Clear(C1)
  42. G.TextRenderingHint = Drawing.Text.TextRenderingHint.SingleBitPerPixelGridFit
  43.  
  44. If State = MouseState.Down Then
  45. DrawBorders(P3, 1)
  46. DrawBorders(P4)
  47.  
  48. DrawText(B1, HorizontalAlignment.Center, 1, 1)
  49. Else
  50. DrawBorders(P1)
  51. DrawBorders(P2, 1)
  52.  
  53. G.DrawLine(P4, 0, Height - 1, Width, Height - 1)
  54. G.DrawLine(P4, Width - 1, 0, Width - 1, Height)
  55.  
  56. G.DrawLine(P3, 1, Height - 2, Width - 2, Height - 2)
  57. G.DrawLine(P3, Width - 2, 1, Width - 2, Height - 2)
  58.  
  59. DrawText(B1, HorizontalAlignment.Center, 0, 0)
  60. End If
  61.  
  62. If Focused Then
  63. DrawBorders(P5, 4)
  64. End If
  65.  
  66. End Sub
  67.  
  68. Protected Overrides Sub OnClick(ByVal e As System.EventArgs)
  69. Focus()
  70. MyBase.OnClick(e)
  71. End Sub
  72.  
  73. Protected Overrides Sub OnGotFocus(ByVal e As EventArgs)
  74. Invalidate()
  75. MyBase.OnGotFocus(e)
  76. End Sub
  77.  
  78. Protected Overrides Sub OnLostFocus(ByVal e As EventArgs)
  79. Invalidate()
  80. MyBase.OnLostFocus(e)
  81. End Sub
  82.  
  83. End Class
Add Comment
Please, Sign In to add comment