How to justify text in a label control?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to justify the text in a label control so that all of the text fills
the label equally, but there don't seem to be any properties to set to allow
this.

Can anyone help?
 
Hi,

What you want is an algorithm that takes into consideration the width of the
label control, the number of characters and the font size. In addition, you
may have to distinguish between caps and lower case, as these will differ
even if the font size is the same; also, spaces and other elements of
punctuation will have to be considered, as will the font face, as these too
can differ even if the point size is the same. You might even have to
consider kerning (the adjustment of space between pairs of letters to make
them more visually appealing). Finally, if the font size that is determined
by the algorithm is large enough, you might be forced to increase the height
of the label control to accommodate each character.

And that is why there is no function for it - it's very complicated, but I
would imagine doable.

HTH,

Bernie Yaeger
 
You should be able to get an acceptable solution using the Graphics Object
and Measure String by adding a space after each word then measuring the
string until it exceeds the label width then back out the last space. Of
course, you can add Kerning, etc. to improve this.
 
Thanks for the suggestions, guys, but I went with another control in the
end.Time was of the essence.
 
What control did you use?
--
Dennis in Houston


cashdeskmac said:
Thanks for the suggestions, guys, but I went with another control in the
end.Time was of the essence.
 

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