Function TextSize(Phrase : string; Police : TFont = nil) : TPoint;
var
DC: HDC;
Rect: TRect;
C : TBitmap;
begin
C := TBitmap.create;
if police <> nil then C.canvas.Font := police;
Rect.Left := 0;
Rect.Top:=0;
Rect.Right:=0;
Rect.Bottom:=0;
DC := GetDC(0);
C.Canvas.Handle := DC;
DrawText(C.Canvas.Handle, PChar(Phrase), Length(Phrase), Rect, (DT_EXPANDTABS or DT_CALCRECT));
C.Canvas.Handle := 0;
ReleaseDC(0, DC);
result.X:=Rect.Right-Rect.Left;
result.Y:=Rect.Bottom-Rect.Top;
C.Free;
end;