{$R *.dfm}
procedure txttojpeg(txt, filename: string; brush_color: tcolor; font: tfont;
font_color: tcolor; width, height: integer);
var
temp: tbitmap;
jpeg: tjpegimage;
i, j: integer;
begin
temp := tbitmap.create;
try
temp.height := height;
temp.width := width;
temp.transparent := true;
temp.canvas.brush.color := brush_color;
temp.canvas.font := font;
temp.canvas.font.color := font_color;
j := 0;
for i := 0 to form1.memo1.lines.count - 1 do
begin
j := j + 15;
temp.canvas.textout(10, j, form1.memo1.lines.strings[i]); //表示距离,top,left.
end;
temp.SaveToFile('c:/1.bmp');
finally
temp.destroy;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
txttojpeg(memo1.lines.text, savedialog1.filename + '.jpg', clwhite, Memo1.Font, clblack, memo1.width, memo1.height);
end;
end.
http://www.delphibbs.com/delphibbs/dispq.asp?lid=3291877
procedure txttojpeg(txt, filename: string; brush_color: tcolor; font: tfont;
font_color: tcolor; width, height: integer);
var
temp: tbitmap;
jpeg: tjpegimage;
i, j: integer;
begin
temp := tbitmap.create;
try
temp.height := height;
temp.width := width;
temp.transparent := true;
temp.canvas.brush.color := brush_color;
temp.canvas.font := font;
temp.canvas.font.color := font_color;
j := 0;
for i := 0 to form1.memo1.lines.count - 1 do
begin
j := j + 15;
temp.canvas.textout(10, j, form1.memo1.lines.strings[i]); //表示距离,top,left.
end;
temp.SaveToFile('c:/1.bmp');
finally
temp.destroy;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
txttojpeg(memo1.lines.text, savedialog1.filename + '.jpg', clwhite, Memo1.Font, clblack, memo1.width, memo1.height);
end;
end.
http://www.delphibbs.com/delphibbs/dispq.asp?lid=3291877