Gets the width of characters

https://www.cnblogs.com/gaodu2003/archive/2009/06/12/1502242.html

Method a:
var
  CharX, Chary: Integer;
with the Canvas do
  the begin
  Font.Name: = 'Arial';
  Size: =. 9;
  CharX: The TextExtent = ( 'string') .cx; // string width, in pixels
  CharY: = TextExtent ( 'string') .cy; // character height, in pixels
end;

Method two:
var
  S: TSize for the;
with the Canvas do
  the begin
  Font.Name: = 'Arial';
  Size: =. 9;
  S: The TextExtent = ( 'string');
  the ShowMessage (the Format ( 'word width:% d character height: D% ', [s.cx, s.cy]);
End;

Method a:
var
  CharX, Chary: Integer;
with the Canvas do
  the begin
  Font.Name: = 'Arial';
  Size: =. 9;
  CharX: The TextExtent = ( 'string') .cx; // string width, in pixels
  CharY: = TextExtent ( 'string') .cy; // character height, in pixels
end;

Method two:
var
  S: TSize for the;
with the Canvas do
  the begin
  Font.Name: = 'Arial';
  Size: =. 9;
  S: The TextExtent = ( 'string');
  the ShowMessage (the Format ( 'word width:% d character height: D% ', [s.cx, s.cy]);
End;

Guess you like

Origin www.cnblogs.com/gaodu2019/p/10935778.html