Help with e.Graphics.DrawString

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • DazedAndConfused

    #1

    Help with e.Graphics.DrawString

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

    i.e.
    e.Graphics.Draw String("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)


  • Chris

    #2
    Re: Help with e.Graphics.Draw String

    DazedAndConfuse d wrote:[color=blue]
    > Is there a way to find the coordinates of x after using Graphics.DrawSt ring?
    >
    > i.e.
    > e.Graphics.Draw String("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)
    >
    >[/color]

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

    Hope it helps
    Chris

    Comment

    • DazedAndConfused

      #3
      Re: Help with e.Graphics.Draw String

      thank you
      "Chris" <no@spam.com> wrote in message
      news:ekfKhOFmFH A.1416@TK2MSFTN GP09.phx.gbl...[color=blue]
      > DazedAndConfuse d wrote:[color=green]
      >> Is there a way to find the coordinates of x after using
      >> Graphics.DrawSt ring?
      >>
      >> i.e.
      >> e.Graphics.Draw String("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)[/color]
      >
      > You need to use the e.Graphics.Meas ureString(....) to get how long the
      > string will be. Then add x to the width returned by measure string.
      >
      > Hope it helps
      > Chris[/color]


      Comment

      Working...