还查到一个老帖
来自: hfghfghfg, 时间: 2004-01-08 10:55:00, ID: 2400030
SelStart
function TCanvas.TextExtent(const Text: string): TSize;
begin
RequiredState([csHandleValid, csFontValid]);
Result.cX := 0;
Result.cY := 0;
Windows.GetTextExtentPoint32(FHandle, PChar(Text), Length(Text), Result);
end;
function TCanvas.TextWidth(const Text: string): Integer;
begin
Result := TextExtent(Text).cX;
end;
来自: hfghfghfg, 时间: 2004-01-08 10:57:00, ID: 2400041
function DrawText(hDC: HDC; lpString: PChar; nCount: Integer;
var lpRect: TRect; uFormat: UINT): Integer; stdcall;
var lpRect: TRect 也可获得