.TextOut文字保存为图片

//Canvas.TextOut文字保存为图片 
//Delphi开发案例精选,使用TextOut在画布上画图

procedure TForm1.Button1Click(Sender: TObject);
var
  My_Image:Timage;
  i:integer;
begin
   try
    My_Image :=Timage.Create( nil);
    My_Image.Width :=memo1.Width;
    My_Image.Height :=memo1.Height;
     for i := 0 to memo1.Lines.Count - 1 do
     begin
      My_Image.Canvas.TextOut( 0,I * 12,memo1.Lines.Strings[i]);
     end;
    My_Image.Picture.SaveToFile(Extractfilepath(Application.ExeName) + '01.bmp');
   finally
    My_Image.Free;
   end;

end;




你可能感兴趣的:(text)