Advertisement
asril99

Untitled

Aug 15th, 2016
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. Public Class FontColorandStyle
  2.  
  3. Private Sub FontColorandStyle_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  4.  
  5. End Sub
  6.  
  7. Private Sub ChangeFontColor(ByVal col As Color)
  8. For Each ctrl As Control In Me.Controls
  9. If TypeOf (ctrl) Is Label Then
  10. ctrl.ForeColor = col
  11. End If
  12. Next
  13. End Sub
  14. Private Sub ChangeBackColor(ByVal col As Color)
  15. For Each ctrl As Control In Me.Controls
  16. If TypeOf (ctrl) Is Label Then
  17. ctrl.BackColor = col
  18. End If
  19. Next
  20. End Sub
  21. Private Sub ChangeFontStyle()
  22. For Each ctrl As Control In Me.Controls
  23. If TypeOf (ctrl) Is Label Then
  24. 'ctrl.Font = New Font(ctrl.Font.FontFamily, ctrl.Font.Size, ctrl.Font.Style Xor FontStyle.Regular)
  25. ctrl.Font = New Font("verdana", 30, FontStyle.Underline)
  26. End If
  27. Next
  28. End Sub
  29.  
  30. Private Sub MsubRed_Click(sender As Object, e As EventArgs) Handles MsubRed.Click
  31. Call ChangeFontColor(Color.Red)
  32. End Sub
  33.  
  34. Private Sub MsubGreen_Click(sender As Object, e As EventArgs) Handles MsubGreen.Click
  35. Call ChangeFontColor(Color.Green)
  36. End Sub
  37.  
  38. Private Sub MsubBlue_Click(sender As Object, e As EventArgs) Handles MsubBlue.Click
  39. Call ChangeFontColor(Color.Blue)
  40. End Sub
  41.  
  42. Private Sub MsubGray_Click(sender As Object, e As EventArgs) Handles MsubGray.Click
  43. Call ChangeFontColor(Color.Gray)
  44. End Sub
  45.  
  46. Private Sub MsubPink_Click(sender As Object, e As EventArgs) Handles MsubPink.Click
  47. Call ChangeFontColor(Color.Pink)
  48. End Sub
  49.  
  50. Private Sub MsubYellow_Click(sender As Object, e As EventArgs) Handles MsubYellow.Click
  51. Call ChangeFontColor(Color.Yellow)
  52. End Sub
  53.  
  54. Private Sub MsubBrown_Click(sender As Object, e As EventArgs) Handles MsubBrown.Click
  55. Call ChangeFontColor(Color.Brown)
  56. End Sub
  57.  
  58. Private Sub FontStyleToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles FontStyleToolStripMenuItem.Click
  59. Call ChangeFontStyle()
  60. End Sub
  61. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement