I have written a small program to calculate XZ positions on a manual lathe to create a large radius and I use a do loop to print the positions. I use a large font for easy reading by the turners and so I find sometimes that my lines run off the page.
How do I go about causing a page break / new page? I don’t do a lot of coding and fairly infrequently at that so my knowledge on things like printing correctly is a bit hazy. If it fits on 1 page, as most things do, then I get by ok.
here is part of the code I use:
Private Sub PrintDocument1_PrintPage(sender As System.Object, e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage ….. Do x = x + sidemm y = y + 1 If x > pathrad Then Exit Do ang = System.Math.Asin(x / pathrad) z = System.Math.Cos(ang) * pathrad z = Math.Round(z * 100) / 100 If z < vtdist – buttonmm / 2 Then Exit Do If RadioButton1.Checked Then tstring = Math.Round((x + buttonmm / 2) * 100) / 100 e.Graphics.DrawString(tstring, New Font("Arial", 16, FontStyle.Regular), Brushes.Black, 50, y * 40) tstring = Math.Round((z + buttonmm / 2 – vtdist) * 100) / 100 e.Graphics.DrawString(tstring, New Font("Arial", 16, FontStyle.Regular), Brushes.Black, 140, y * 40) tstring = Math.Round(((z + buttonmm / 2 – vtdist) * 2) * 100) / 100 e.Graphics.DrawString(tstring, New Font("Arial", 16, FontStyle.Regular), Brushes.Black, 230, y * 40) End If If RadioButton2.Checked Then e.Graphics.DrawString(x, New Font("Arial", 16, FontStyle.Regular), Brushes.Black, 50, y * 40) tstring = Math.Round((z + buttonmm / 2 – vtdist) * 100) / 100 e.Graphics.DrawString(tstring, New Font("Arial", 16, FontStyle.Regular), Brushes.Black, 140, y * 40) tstring = Math.Round(((z + buttonmm / 2 – vtdist) * 2) * 100) / 100 e.Graphics.DrawString(tstring, New Font("Arial", 16, FontStyle.Regular), Brushes.Black, 230, y * 40) End If Loop
Thanks in advance.