• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 536
  • Last Modified:

combine 2 metafile drawings?

how can i draw object of 1 metafile picture (wmf) to another metafile canvas which is created dinamicly?

thanks
0
kirez
Asked:
kirez
1 Solution
 
TheRealLokiSenior DeveloperCommented:
This is from memory, not tested since I do not have any metafiles handy
hope it's correct and helps,
Loki

uses math;

procedure TForm1.BitBtn1Click(Sender: TObject);
     var
         m1, m2 : TmetaFile;
         mc : TmetaFileCanvas;
         b : tbitmap;
    begin
        m1 := TMetaFile.Create;
        m2 := TMetaFile.Create;
        try
            m1.LoadFromFile('c:\pic1.wmf'); // or is emf? i forget
//            m2.LoadFromFile('c:\pic2.wmf');
// if you want to merge 2 wmf's you could do the above line - I put this in just in case it was handy

            m2.Height := max(m1.Height, m2.height);
            m2.Width := max(m1.Width, m2.Width);
            mc := TMetafileCanvas.Create(m2, 0);
            mc.Draw(0, 0, m1); // draw m1 to m2's canvas
            m2.SaveToFile('c:\pic3.wmf'); // or is emf, i forget
        finally
            mc.Free;
            m1.free;
            m2.free;
        end;
        Image1.Picture.LoadFromFile('c:\pic3.wmf');
    end;
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

Tackle projects and never again get stuck behind a technical roadblock.
Join Now