将字符串保存为图像文件!
procedure genBmp(s,f:string);stdcall;
var
b:TBitmap;
w,h:integer;
begin
b:=TBitmap.Create ;
b.Canvas.Font.Size:=20;
b.Canvas.Font.name:='黑体';
b.Canvas.Font.color:=clRed;
w:=b.Canvas.TextWidth(s)+5;
h:=b.Canvas.TextHeight(s)+3;
b.width:=w;
b.height:=H;
b.Canvas.TextOut(1,1,s);
b.canvas.Brush.Style:=bsClear;
b.Canvas.Font.color:=clBlue;
b.Canvas.TextOut(3,2,s);
b.SaveToFile(f);
b.free;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
genBmp('这是字符串','d:/Test.bmp');
end;