var
bmp:tbitmap;
p:tpoint;
r:trect;
txth,x:integer;
begin
p:=memo1.ClientToParent(point(2,2),self);
r.Left:=p.X;
r.Top:=p.Y;
r.Right:=p.X+memo1.ClientWidth;
r.Bottom:=p.Y+memo1.ClientHeight;
txth:=self.canvas.TextHeight('aa');
{下面是输出图像}
bmp:=tbitmap.Create;
bmp.Width:=memo1.ClientWidth;
bmp.Height:=txth*4;
x:=r.Top+bmp.Height;
bmp.Canvas.CopyRect(rect(0,0,bmp.Width,bmp.Height),self.canvas,rect(r.Left,r.Top,r.Right,x));
self.canvas.Draw(550,50,bmp);
bmp.Canvas.CopyRect(rect(0,0,bmp.Width,bmp.Height),self.canvas,rect(r.Left,x,r.Right,x+bmp.Height));
self.canvas.Draw(550,60+bmp.Height,bmp);
bmp.Free;
end;