Function to measure text length

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

    #1

    Function to measure text length

    I'm trying to create a function that will return the length of a text
    string in inches.

    e.Graphics.Meas ureString(mStri ng, mFont)

    Seems to be what I'm looking for, but I don't know how to pass
    PaintEventArgs (e).

    I don't want to use it in a paint event, I just want it to return a
    number when I pass it a string and a font. How do I do this?
  • Kevin

    #2
    Re: Function to measure text length

    Never mind. I figured it out.



    On Sat, 11 Nov 2006 02:09:51 GMT, Kevin <Kevinp@nospam. cfl.rr.com>
    wrote:
    >I'm trying to create a function that will return the length of a text
    >string in inches.
    >
    >e.Graphics.Mea sureString(mStr ing, mFont)
    >
    >Seems to be what I'm looking for, but I don't know how to pass
    >PaintEventAr gs (e).
    >
    >I don't want to use it in a paint event, I just want it to return a
    >number when I pass it a string and a font. How do I do this?

    Comment

    • Cor Ligthert [MVP]

      #3
      Re: Function to measure text length

      Kevin,

      Will you as you have figured it out show what you did, people are searching
      in this newsgroup, there is quite a few about what you have asked, but now
      you are blocking them because there is a new item without an answer in that.

      Thanks in advance,

      Cor

      "Kevin" <Kevinp@nospam. cfl.rr.comschre ef in bericht
      news:q8hal259au 78u2bqpqvvee11n 6csh4k1dr@4ax.c om...
      Never mind. I figured it out.
      >
      >
      >
      On Sat, 11 Nov 2006 02:09:51 GMT, Kevin <Kevinp@nospam. cfl.rr.com>
      wrote:
      >
      >>I'm trying to create a function that will return the length of a text
      >>string in inches.
      >>
      >>e.Graphics.Me asureString(mSt ring, mFont)
      >>
      >>Seems to be what I'm looking for, but I don't know how to pass
      >>PaintEventArg s (e).
      >>
      >>I don't want to use it in a paint event, I just want it to return a
      >>number when I pass it a string and a font. How do I do this?

      Comment

      Working...