转为bmp格式处理!
procedure WmfToBmp(FicheroWmf,FicheroBmp:string);
var
MetaFile:TMetafile;
Bmp:TBitmap;
begin
Metafile:=TMetaFile.create;
{Create a Temporal Bitmap}
Bmp:=TBitmap.create;
{Load the Metafile}
MetaFile.LoadFromFile(FicheroWmf);
{Draw the metafile in Bitmap's canvas}
with Bmp do
begin
Height:=Metafile.Height;
Width:=Metafile.Width;
Canvas.Draw(0,0,MetaFile);
{Save the BMP}
SaveToFile(FicheroBmp);
{Free BMP}
Free;
end;
{Free Metafile}
MetaFile.Free;
end;
procedure BmpToWmf (BmpFile,WmfFile:string);
var
MetaFile : TMetaFile;
MFCanvas : TMetaFileCanvas;
BMP : TBitmap;
begin
MetaFile := TMetaFile.Create;
BMP := TBitmap.create;
BMP.LoadFromFile(BmpFile);
MetaFile.Height := BMP.Height;
MetaFile.Width := BMP.Width;
MFCanvas:=TMetafileCanvas.Create(MetaFile, 0);
with MFCanvas do
begin
Draw(0, 0, BMP);
Free;
end;
BMP.Free;
with MetaFile do
begin
SaveToFile(WmfFile);
Free;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
BmpToWmf('reboot.bmp','reboot.wmf');
end;