下面的内容回答houyg的提问:
{File Convert[BMP&WMF/EMF] Tool Ver1.0, Full source by aiming.
===============================================================
请用命令行dcc -cc bmp2wmf.dpr编译,或设置"生成控制台程序"编译项
在IDE中编译。生成的程序只能在win95的DOS窗口中使用。
===============================================================}
program bmp2wmf;
uses
Graphics, SysUtils;
const SoftWareName = 'File Convert[BMP&WMF/EMF] Tool Ver1.0,';
CompanyName = 'copyright(c) 1994,98 Keenvim software';
Width = 80 - Length(SoftWareName);
var aBmp : Tbitmap;
aWmf : TMetaFile;
param1 : String;
paramExt : String;
begin
Write(SoftWareName,CompanyName:Width);
Writeln('By Mr. Aiming Zhou.'); Writeln;
if ParamCount >= 1 then
begin
param1 := UpperCase(ParamStr(1));
paramExt := ExtractFileExt(param1);
end;
if (ParamCount < 1) or
(ParamCount > 2) or
((ParamCount = 2) and (UpperCase(ParamStr(2)) <> '/E')) or
((paramExt <> '.BMP') and (paramExt <> '.WMF')
and (paramExt <> '.EMF')) then
begin
writeln('ERROR: Param Invalid!');
writeln('Usage: Bmp2Wmf <.Bmp/.Wmf> [/E]');
writeln('notes: Param [/E] Define ouput .EMF File format.');
exit;
end;
aBmp := Tbitmap.Create;
aWmf := TMetaFile.Create;
if paramExt = '.BMP'
then
begin
aBmp.LoadFromFile(param1);
aWmf.Width := aBmp.Width;
aWmf.Height := aBmp.Height;
if ParamCount = 2 then aWmf.Enhanced := true
else aWmf.Enhanced := false;
with TMetaFileCanvas.CreateWithComment(
aWmf,0,'Aiming''s Conver program','V1.0') do
Try Draw(0,0,aBmp);
Finally Free;
end;
if aWmf.Enhanced
then aWmf.SaveToFile(copy(param1,1,pos('.',param1)) + 'EMF')
else aWmf.SaveToFile(copy(param1,1,pos('.',param1)) + 'WMF');
if aWmf.Enhanced
then writeln(param1, '==>',
copy(param1,1,pos('.',param1)) + 'EMF', #$0D)
else writeln(param1, '==>',
copy(param1,1,pos('.',param1)) + 'WMF', #$0D);
end
else
begin
aWmf.LoadFromFile(param1);
aBmp.Width := aWmf.Width;
aBmp.Height := aWmf.Height;
aBmp.Canvas.Draw(0,0,aWmf);
aBmp.SaveToFile(copy(param1,1,pos('.',param1)) + 'BMP');
writeln(param1, '==>',
copy(param1,1,pos('.',param1)) + 'EMF', #$0D);
end;
aBmp.Destroy;
aWmf.Destroy;
end.
====================================================================
哈哈哈,怎么大家都在提这个问题??是不是也是用Cool 3D的缘故?
前些天为了用Cool 3D v2. 找了不下xx个软件,都没有办法转换bmp to wmf.
最后一怒之下,自己写了个转换工具。当天便在www.expert-exchanges.com
站上看到这个问题贴出,我便贴出了源码,今天又见到了,老规矩,源码一份。
Houyg兄, 你就痛痛快快的掏钱付账罢。^-^
嘿嘿,黑黑,嘿嘿黑黑……
<hr>
请下载:<a href="/delphi/attachments/postit.zip">来自aimingoo的答案</a>