I'm attempting to print in the center of the page - but I think VB6 is stuck in my brain. Can someone tell me what's wrong with the following code? It's printing off the left side of the page, and only showing the last few words of the title.
Code:Private Sub doc_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles doc.PrintPage Dim pnt As PointF Dim f As Font f = New Font("Times New Roman", 14) doc.DocumentName = "Open-Shelf/Container Rescan Form" e.Graphics.PageUnit = GraphicsUnit.Pixel e.Graphics.DrawImage(My.Resources.Retrievex, 500, 500, 1387, 330) 'What's wrong with these next 3 lines? pnt.X = (e.PageBounds.Width / 2) - (e.Graphics.MeasureString(doc.DocumentName, f).Width / 2) pnt.Y = 1000 e.Graphics.DrawString(doc.DocumentName, f, Brushes.Black, pnt) End Sub




Reply With Quote