PrintDocument1_PrintPage vb.net
-
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
-
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
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