i personally use the e.PageBounds.Width / 2 method to get the center of the page:
VB Code:
'PrintDocument: Static fntHeadingFont As New Font("Arial", 16, FontStyle.Bold) Dim sngCenterPage As Single sngCenterPage = Convert.ToSingle(e.PageBounds.Width / 2 - e.Graphics.MeasureString("Your String Here", fntHeadingFont).Width / 2) e.Graphics.DrawString("Your String Here", fntHeadingFont, Brushes.Black, sngCenterPage, 2)
but either method achieves the same goal![]()




Reply With Quote