Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Product Lifecycle
  3. Free Tools
  4. PrintDocument1_PrintPage vb.net

PrintDocument1_PrintPage vb.net

Scheduled Pinned Locked Moved Free Tools
csharpgraphicshelptutorial
2 Posts 2 Posters 7 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    wanderleyolv
    wrote on last edited by
    #1

    Hello everyone, I created a file in .txt and I would like to print the document through the PrintDocument1_PrintPage component, but the commands are inside the .txt file as I followed the example. Private Sub PrintDocument1_PrintPage(ByVal sender As Object, ByVal e As Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage Dim AlinhamentoLeft As New StringFormat() AlinhamentoLeft.Alignment = StringAlignment.Near Dim AlinhamentoRight As New StringFormat() AlinhamentoRight.Alignment = StringAlignment.Far Dim AlinhamentoCenter As New StringFormat AlinhamentoCenter.Alignment = StringAlignment.Center Dim xRowTop = 0 e.Graphics.DrawLine(New Pen(Brushes.Black, 0.6), 40, 50, 245, 50) e.Graphics.DrawLine(New Pen(Brushes.Black, 0.6), 40, 100, 800, 100) e.Graphics.DrawLine(New Pen(Brushes.Black, 0.6), 658, 40, 796, 40) e.Graphics.DrawRectangle(Pens.DarkGray, 658, 17, 139, 53) e.Graphics.DrawString("Code", New Font("Arial", 9.75, FontStyle.Bold), New SolidBrush(Color.Black), 37, 82) e.Graphics.DrawString("Name", New Font("Arial", 9.75, FontStyle.Bold), New SolidBrush(Color.Black), 112, 82) e.Graphics.DrawString("Name", New Font("Arial", 9.75, FontStyle.Bold), New SolidBrush(Color.Black), 482, 82) e.Graphics.DrawString("Fields", New Font("Arial", 14.25, FontStyle.Bold), New SolidBrush(Color.Black), 38, 25) e.Graphics.DrawString("Page", New Font("Arial", 9.75, FontStyle.Bold), New SolidBrush(Color.Black), 663, 47) e.Graphics.DrawString("Date:", New Font("Arial", 9.75, FontStyle.Bold), New SolidBrush(Color.Black), 663, 20) e.Graphics.DrawString("Count", New Font("Arial", 9.75, FontStyle.Bold), New SolidBrush(Color.Black), 397, 82) xRowTop = 106 NewPage = False If xRowTop > e.MarginBounds.Bottom + e.PageSettings.Margins.Bottom - 40 Then e.HasMorePages = True NewPage = True Exit Sub End If End Sub it's just like a CrystalReports file, except that using PrintDocument1_PrintPage and the Sub PrintDocument1_PrintPage commands would be inside the .txt file. If you can help, thank you. Translated by google (Portuguese to English) by Wanderley

    Richard DeemingR 1 Reply Last reply
    0
    • W wanderleyolv

      Hello everyone, I created a file in .txt and I would like to print the document through the PrintDocument1_PrintPage component, but the commands are inside the .txt file as I followed the example. Private Sub PrintDocument1_PrintPage(ByVal sender As Object, ByVal e As Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage Dim AlinhamentoLeft As New StringFormat() AlinhamentoLeft.Alignment = StringAlignment.Near Dim AlinhamentoRight As New StringFormat() AlinhamentoRight.Alignment = StringAlignment.Far Dim AlinhamentoCenter As New StringFormat AlinhamentoCenter.Alignment = StringAlignment.Center Dim xRowTop = 0 e.Graphics.DrawLine(New Pen(Brushes.Black, 0.6), 40, 50, 245, 50) e.Graphics.DrawLine(New Pen(Brushes.Black, 0.6), 40, 100, 800, 100) e.Graphics.DrawLine(New Pen(Brushes.Black, 0.6), 658, 40, 796, 40) e.Graphics.DrawRectangle(Pens.DarkGray, 658, 17, 139, 53) e.Graphics.DrawString("Code", New Font("Arial", 9.75, FontStyle.Bold), New SolidBrush(Color.Black), 37, 82) e.Graphics.DrawString("Name", New Font("Arial", 9.75, FontStyle.Bold), New SolidBrush(Color.Black), 112, 82) e.Graphics.DrawString("Name", New Font("Arial", 9.75, FontStyle.Bold), New SolidBrush(Color.Black), 482, 82) e.Graphics.DrawString("Fields", New Font("Arial", 14.25, FontStyle.Bold), New SolidBrush(Color.Black), 38, 25) e.Graphics.DrawString("Page", New Font("Arial", 9.75, FontStyle.Bold), New SolidBrush(Color.Black), 663, 47) e.Graphics.DrawString("Date:", New Font("Arial", 9.75, FontStyle.Bold), New SolidBrush(Color.Black), 663, 20) e.Graphics.DrawString("Count", New Font("Arial", 9.75, FontStyle.Bold), New SolidBrush(Color.Black), 397, 82) xRowTop = 106 NewPage = False If xRowTop > e.MarginBounds.Bottom + e.PageSettings.Margins.Bottom - 40 Then e.HasMorePages = True NewPage = True Exit Sub End If End Sub it's just like a CrystalReports file, except that using PrintDocument1_PrintPage and the Sub PrintDocument1_PrintPage commands would be inside the .txt file. If you can help, thank you. Translated by google (Portuguese to English) by Wanderley

      Richard DeemingR Offline
      Richard DeemingR Offline
      Richard Deeming
      wrote on last edited by
      #2

      Wrong forum: "This forum is for discussing and recommending Free tools for software development." Post your question in the Visual Basic forum[^] instead.


      "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

      "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups