adjust edit box size

I would like to adjust the size of a TEdit component based on the
length of the text it it.

For example, if the message "Delphi rules" is in the text box I want
the box to be only as large as the space it takes in the box.  In
this way I can center the box and have it look neat and always center
properly.

If I am using a proportional font I have found no way of doing this.
I can calculate that every character is so many dots wide times the
number of characters and get an approximate answer, but if there
are a disproportionate amount of "wider" characters in the box I get
wider text than expected.  I can only get an approximate size this
way.

Has anyone figured out how to get around this problem?

Please e-mail any clues to c...@flinet.com as well as posting them
here for the benefit of others.

Thanks,
Kevin Lieberman
Palm Beach Software