JayBeeOH

TxtEditor - File Page Setup Option - PageSetupDialog

Apr 15th, 2015
395
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 2.43 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.     ' Form loads and initialization performed.
  29.     Private Sub MainForm_Load(sender As Object, e As EventArgs) _
  30.         Handles MyBase.Load
  31.  
  32.         ' Initialize default page setup settings.
  33.         Dim pageSetup As New PageSettings
  34.         pageSetup.Landscape = False  ' Use Portrait mode.
  35.         With pageSetup.Margins
  36.             .Left = 75
  37.             .Right = 75
  38.             .Top = 100
  39.             .Bottom = 100
  40.         End With
  41.         PrintDocument1.DefaultPageSettings = pageSetup  
  42.     End Sub
  43.  
  44.  ' File Page Setup option.
  45.     Private Sub PageSetupToolStripMenuItem_Click(sender As Object, e As EventArgs) _
  46.         Handles PageSetupToolStripMenuItem.Click
  47.  
  48.         With PageSetupDialog1
  49.             .PageSettings = PrintDocument1.DefaultPageSettings
  50.             If DialogResult.OK = .ShowDialog() Then
  51.                 PrintDocument1.DefaultPageSettings = .PageSettings
  52.             End If
  53.         End With
  54.     End Sub
Advertisement
Add Comment
Please, Sign In to add comment