stilllwaiting
Programmer
I'm trying to update a current application.
The application I have now allows a user to type text into three separate text boxes which will display automatically in a preview area. As they enter text into these three text boxes, the application automatically resizes the text to make it as large as possible in the defined preview area and making it smaller as more text is entered to make sure that all the text will fit. I do this by calculating the approximate width of the characters based on font size and resizing the text appropriately.
In the update, I want to replace the three text boxes with one text area to do the same job.
I'm confident I can do the same thing using the users break lines and calculating the width and height from there, but it would be nice to allow text wrapping and not force the user to break the line themselves.
I've been researching this for a while, though and can't seem to find a way to measure the space the text is taking up if I allow wrapping.
Does anyone know of a way to measure the actual space (in pixels) a span of text is taking up?
Thanks in advance.
The application I have now allows a user to type text into three separate text boxes which will display automatically in a preview area. As they enter text into these three text boxes, the application automatically resizes the text to make it as large as possible in the defined preview area and making it smaller as more text is entered to make sure that all the text will fit. I do this by calculating the approximate width of the characters based on font size and resizing the text appropriately.
In the update, I want to replace the three text boxes with one text area to do the same job.
I'm confident I can do the same thing using the users break lines and calculating the width and height from there, but it would be nice to allow text wrapping and not force the user to break the line themselves.
I've been researching this for a while, though and can't seem to find a way to measure the space the text is taking up if I allow wrapping.
Does anyone know of a way to measure the actual space (in pixels) a span of text is taking up?
Thanks in advance.