JayBeeOH

TxtEditor - Format Menu Options - FontDialog

Mar 5th, 2015
390
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 2.81 KB | None | 0 0
  1. '------------------------------------------------------------------------------------------
  2. '           Notice of My Copyright and Intellectual Property Rights
  3. '
  4. ' Any intellectual property contained within the program by Joseph L. Bolen remains the
  5. ' intellectual property of the Joseph L. Bolen. This means that no person may distribute,
  6. ' publish or provide such intellectual property to any other person or entity for any
  7. ' reason, commercial or otherwise, without the express written permission of Joseph L. Bolen.
  8. '
  9. '                 Copyright © 2015. All rights reserved.
  10. '        All trademarks remain the property of their respective owners.
  11. '-------------------------------------------------------------------------------------------
  12. ' Program Name:   Text Editor
  13. '
  14. ' Author:         Joseph L. Bolen
  15. ' Date Created:   Feb 2015
  16. '
  17. ' Description:    Simple plain text editor program with printing ability.
  18. '
  19. '                 Documentation is at:
  20. '                   App's screen image is at: http://imgur.com/TzWs9kO
  21. '                   App's screen design time specs at: http://pastebin.com/bhinRQ5d
  22. '                   App's Visual Basic .NET Event Procedures & TODO's is at
  23. '                       http://pastebin.com/UZ4tcEpE
  24. '                   App's Visual Basic .NET code is at http://pastebin.com/u/jaybeeoh
  25. '                   Video tutorial at YouTube: http://www.youtube.com/user/bolenpresents
  26. '-------------------------------------------------------------------------------------------
  27.  
  28. #Region " Format Menu"
  29.  
  30.     ' Format Word Wrap option.
  31.     Private Sub WordWrapToolStripMenuItem_Click(sender As Object, e As EventArgs) _
  32.         Handles WordWrapToolStripMenuItem.Click
  33.  
  34.         MyTextBox.WordWrap = Not MyTextBox.WordWrap
  35.         WordWrapToolStripMenuItem.Checked = MyTextBox.WordWrap
  36.         If MyTextBox.WordWrap Then
  37.             MyTextBox.ScrollBars = ScrollBars.Vertical
  38.         Else
  39.             MyTextBox.ScrollBars = ScrollBars.Both
  40.         End If
  41.     End Sub
  42.  
  43.     ' Format Font option.
  44.     Private Sub FontToolStripMenuItem_Click(sender As Object, e As EventArgs) _
  45.         Handles FontToolStripMenuItem.Click
  46.  
  47.         FontDialog1.ShowColor = True
  48.         FontDialog1.ShowApply = True
  49.         FontDialog1.Font = MyTextBox.Font
  50.         FontDialog1.Color = MyTextBox.ForeColor
  51.         If FontDialog1.ShowDialog() = DialogResult.OK Then
  52.             With MyTextBox
  53.                 .Font = FontDialog1.Font
  54.                 .ForeColor = FontDialog1.Color
  55.             End With
  56.         End If
  57.     End Sub
  58.  
  59.     ' Apply FontDialog changes.
  60.     Private Sub FontDialog1_Apply(sender As Object, e As EventArgs) _
  61.         Handles FontDialog1.Apply
  62.  
  63.         With MyTextBox
  64.             .Font = FontDialog1.Font
  65.             .ForeColor = FontDialog1.Color
  66.         End With
  67.     End Sub
  68.  
  69. #End Region
Advertisement
Add Comment
Please, Sign In to add comment