Function GetTextWidth(ACanvas:TCanvas);
Begin
  Result:=ACanvas.TextWidth('W');
End;Function GetTextHeight(ACanvas:TCanvas);
Bein
  Result:=ACanvas.TextHeight('W');
End;

解决方案 »

  1.   

    Function GetTextWidth(ACanvas:TCanvas):Integer;
    Begin
      Result:=ACanvas.TextWidth('W');
    End;Function GetTextHeight(ACanvas:TCanvas):Integer;
    Bein
      Result:=ACanvas.TextHeight('W');
    End;
      

  2.   

    Var
       TextStr :PChar;
       TextWidth:TPoint;
    ...
    Begin
    ...
      TextStr := PChar('好');
      GetTextExtentPoint(Canvas.Handle, TextStr,StrLen(TextStr), TSize(TextWidth));
      ShowMessage('宽度:'+IntToStr(TextWidth.X)+#13#10+_
                  '高度:'+IntToStr(TextWidth.Y));
    ...
    End;
      

  3.   

    错!!!!大错特错!!!!!!!竟然给分了!!!!!!!
    font的大小 以 磅记:1磅=1/72英寸;
    font所占像素数:=round(font.pixelsPerInch*font.size/72);