DelphiFAQ Home Search:

How to get a string's width in pixels, not in characters

 

comments1 comments. Current rating: 5 stars (1 votes). Leave comments and/ or rate it.

Sometimes you may need to know how wide a string is in pixels, e.g. for dynamically generated forms.
This depends of course on the selected font characteristics. Windows and the VLC provide a function TextWidth which is a method of TCanvas:

TCanvas.TextWidth(sString);

Comments:

2007-11-02, 04:11:04
anonymous from Brazil  
rating
aff... was good!

 

 

Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option.
 
It seems that you are
from Washington, US .

Info/ Feedback on this

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:
photo Add a picture:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity. The owner of this web site reserves the right to delete such material.