I am having problems trying to center some text. I created a printdocument and it has a company name and title and then other information I have the information fine but I wanted to center the company name and I can't seem to do it correctly here is what I have

ResultMessage = "Valley boulevard Auto Center"
        HorizontalPrintLocSingle = Convert.ToSingle((e.PageBounds.Width / 2) - (szF.Width / 2))
        e.Graphics.DrawString(ResultMessage, HeadingFont, Brushes.Black, HorizontalPrintLocSingle, VerticalPrintLocSingle)

What Am I doing wrong. I know I have to get the width of the page then divide it by two and after that find out how long my
text is then subtract that so it still prints center screen. Pretty much right now it prints out and runs off the right side of the page...But what I would like it to do is print in the Center but have equal margins on the sides of the page still. Just like clicking Center allignment on a word doc. Any help?

I might have figured it out on my own... Does this look right?

Center = Convert.ToSingle(e.PageBounds.Width / 2 - e.Graphics.MeasureString("Valley boulevard Auto Center", HeadingFont).Width / 2)