Help with e.Graphics.DrawString

  • Thread starter Thread starter DazedAndConfused
  • Start date Start date
D

DazedAndConfused

Is there a way to find the coordinates of x after using Graphics.DrawString?

i.e.
e.Graphics.DrawString("My Report", reportFont, reportBrush, x, y)

x = the coordinates position of "t" in "My Report"

Is there a way to convert Tab position to x?

i.e.

x = Tab(25)
 
DazedAndConfused said:
Is there a way to find the coordinates of x after using Graphics.DrawString?

i.e.
e.Graphics.DrawString("My Report", reportFont, reportBrush, x, y)

x = the coordinates position of "t" in "My Report"

Is there a way to convert Tab position to x?

i.e.

x = Tab(25)

You need to use the e.Graphics.MeasureString(....) to get how long the
string will be. Then add x to the width returned by measure string.

Hope it helps
Chris
 
thank you
Chris said:
You need to use the e.Graphics.MeasureString(....) to get how long the
string will be. Then add x to the width returned by measure string.

Hope it helps
Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top