Join two TMetaFile (Views: 29)
Problem/Question/Abstract: I wish to join two *.wmf files together - adding one to the end of the other. Answer: { ... } MetaFile1 := TMetaFile.Create; MetaFile2 := TMetaFile.Create; DestMetaFile := TMetaFile.Create; try MetaFile1.LoadFromFile('A0000259.WMF'); MetaFile2.LoadFromFile('A0000260.WMF'); DestMetaFile.Width := Max(MetaFile1.Width, MetaFile2.Width); DestMetaFile.Height := MetaFile1.Height + MetaFile2.Height; MetaFileCanvas := TMetaFileCanvas.Create(DestMetaFile, 0); try MetaFileCanvas.Draw(0, 0, MetaFile1); MetaFileCanvas.Draw(0, MetaFile1.Height, MetaFile2); finally MetaFileCanvas.Free; end; DestMetaFile.SaveToFile('new.wmf'); finally MetaFile1.Free; MetaFile2.Free; DestMetaFile.Free; end; { ... } |