TIP: Click on subject to list as thread! ANSI
echo: delphi
to: BART BROERSMA
from: FRANCOIS PIETTE
date: 1997-04-23 20:11:00
subject: Width of a string in pixels.

Salut Bart Broersma !
Dans un message de Bart Broersma dat‚ du 21 Apr 97  01:32:02 il ‚tait dit:
  BB> How do I get the width and heigth of a given string using a
  BB> given font ?
Use the GetTextExtentPoint32 API call:
BOOL GetTextExtentPoint32(
    HDC hdc,    // handle of device context 
    LPCTSTR lpString,   // address of text string 
    int cbString,       // number of characters in string 
    LPSIZE lpSize       // address of structure for string size  
   );   
 
hdc is Canvas.Handle
lpString is PChar(YourString)
cbString is Length(YourString)
lpSize is Size (var Size : TSize;)
Amiti‚s,
{-Francois Piette-}
francois.piette@ping.be
http://www.rtfm.be/fpiette
--- SvFido 1.32
---------------
* Origin: OverByte BBS (Embourg-Belgium) 32-4-3651395 VFC/V34+ (2:293/2202)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.