DelphiFAQ Home Search:

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

 

comments2 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);

Content-type: text/html

Comments:

2007-11-02, 04:11:04
anonymous from Brazil  
rating
aff... was good!
2012-10-29, 05:42:42
anonymous from China  

 

 

NEW: Optional: Register   Login
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, or post under a registered account.
 

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:

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.

photo Add a picture: