Right-Justify Variable-Pitch Font?

P

PeteCresswell

Got a TreeView.

Top node is the name of a company concatonated with some numbers about
the company.

Users want company name on the left and the numbers on the right.

Tried a few monospaced fonts, but the tree's readability goes down the
tubes.

Seems like there ought tb an API call or something where I feed it a
text string, text size, and a font name and it returns something like
the width of the rendered text.

Using that, I could right-justify no matter if the font is variable-
pitch.

Anybody been here?
 
P

PeteCresswell

Anybody been here?

I should add that I've used routines that compute the width of a text
box's contents... but in this case we have not text box. Just an
ASCII string and the name/props of the font.

I guess one workaround would be to open up a little invisible form
with a text box on it, load the text box control with the text in
question, and work from there. But that sounds like it might raise
performance issues when building a large tree....
 
P

(PeteCresswell)

Top