Print report on two sides with textbox and lines (duplex) (visual basic 2010)

  • Thread starter Thread starter MrAllan
  • Start date Start date
M

MrAllan

Guest
My question
I have two groups with a number of text boxes that I need to print on two different pages. Text boxes have fixed locations on the paper and a number of lines. The report shall consist of a front and back cover in the same paper (duplex printing)
I have searched and re-searched but have not been able to find answers to perhaps this simple question
So, I ask the question simply
I have two text boxes and two lines, and I want to print textbox1.text and line 1 on page 1 and then I want to print textbox2.text and line 2 on page 2 under the same printing prosedur? (Visual basic 2010)

Private Sub PrintDocument1_PrintPage (sender As System.Object, e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage

Dim g As Graphics = e.Graphics
Dim myPen As New Pen (Brushes.Black, 1)
Dim PointX1 As Single
Dim PointY1 As Single
Dim PointX2 As Single
Dim PointY2 As Single

PointX1 = 40
PointY1 = 62
PointX2 = 760
PointY2 = 62

Dim messageFont1 As New Font ("Arial", 12)
Dim messageFont2 As New Font ("Arial", 10)

"Page one of the print

g.DrawString ("Calc 1", messageFont1, Brushes.Black, 320, 30)
g.DrawLine (myPen, PointX1, PointY1, PointX2, PointY2)
g.DrawString ("Result:" messageFont2, Brushes.Black, 41, 64)
g.DrawString (TextBox1.Text, messageFont2, Brushes.Black, 80, 64)



Side two of the print

g.DrawString ("Calc 2", messageFont1, Brushes.Black, 320, 30)
g.DrawLine (myPen, PointX1, PointY1, PointX2, PointY2)
g.DrawString ("Result:" messageFont2, Brushes.Black, 41, 64)
g.DrawString (TextBox2.Text, messageFont2, Brushes.Black, 80, 64)

End Sub

I do not know if it is the right place to do this procedure for two sides
(X and Y co-ordinates this just made up now)

Continue reading...
 
Back
Top