Measuring text RRS feed

  • Question

  • User21496045 posted
    Hi gang, Is it possible to measure the length (in pixels) of a string ?. I want to create a function that will determine if a string is longer than Z pixels, if it is, then the function will trim the string's tail and add "..." to it. Something like: sVar = "This is a very long string that I want to measure" sVar = StringTrim(sVar, 125px) sVar is now: "This is a very long str..." Any help will be really appreciated. T.I.A.
    Monday, July 5, 2004 7:57 PM

All replies

  • User-1372641848 posted
    Graphics Object has property called MeasureString you can use that to get width of string. Start from 1st character of your string and add on characters in loop until you reach maximum size.
    Tuesday, July 6, 2004 11:47 AM