Right-Align Text in Graphics Object

I’m wanting to right-justify a string of text on a printed page. How do I get the width of a string of text so I can properly position it on the horizontal axis?

Pseudo-code below:

strWidth = GetDrawTextWidth( "Page X/Y") ' is there such a thing? DrawString( "Page X/Y", right_Margin - strWidth, page_footer_Y )

You’ll need to use Graphics.StringWidth().