Procedure NoImage(var jpg:TJpegImage);
Const Str='(No Image)';
var bmp:TBitmap;
x,y:integer;
begin
try
bmp:=TBitmap.Create;
bmp.Width:=60;
bmp.Height:=60;
bmp.Canvas.Font.Size:=8;
bmp.Canvas.Brush.Color:=clWhite;
bmp.Canvas.FillRect(bmp.Canvas.ClipRect);
bmp.Canvas.Font.Color:=clBlack;
bmp.Canvas.Font.Name:='Times New Roman';
x:=(bmp.Width-bmp.Canvas.TextWidth(Str)) div 2;
y:=(bmp.Height-bmp.Canvas.TextHeight(Str)) div 2;
bmp.Canvas.TextOut(x,y,Str);
jpg.Empty;
jpg.Assign(bmp);
finally
bmp.Free;
end;
end;
这个是生成一个60*60像素的小图标,上面显示(No Image),返回Jpg类型的图,你这种方式,可以在调用时先传入图片,然后再作处理就可以了。