Solved

Creating a tmetafilecanvas and "inherit" the image already drawn on the tmetafile

Posted on 2003-12-10
5
719 Views
Last Modified: 2012-08-14
Hi there,

I have a list of TMetafiles with images already drawn on them. Now I need to be able to create a TMetafilecanvas for a specific metafile in the list, and the draw on top of the image already on the metafile.

My list is a tobjectlist and the code i have so far is

mymetacanvas := tmetafilecanvas.create(tmetafile(mymetafilelist[index]),printer.handle);

then some drawing

and finally
 
mymetacanvas.free;


when I use this code I get the drwaing done is this last bit of code shown just fine, but the image I had drawn previosly is gone.

What to do ?

Best regards
NetGeek


0
Comment
Question by:NetGeek
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 2

Expert Comment

by:odissey1
ID: 9914129
Hi NetGeek,

Create Temp metacanvas
Draw tmetafile(mymetafilelist[index]),
Add extra drawing,
Send to printer ot assign to tmetafile(mymetafilelist[index]).

Well, I am sure you are already accomplished that...
regards,
odissey1
0
 

Author Comment

by:NetGeek
ID: 9914167
Hi odissey1,

I'm not sure that will work (if Iøve understood you correctly). If you could show me some real code how to do it, maybe I'll see the light

NetGeek
0
 
LVL 2

Expert Comment

by:odissey1
ID: 9914299
Hi NetGeek,

I can't work on the code  right now - I'm on my job. I'll try later. Please let us know if you accomplish this before.

odissey1
0
 
LVL 5

Accepted Solution

by:
delphized earned 125 total points
ID: 9915296
directly from Delphi Help
cut and paste:

This example shows how to create or augment a metafile using a metafile canvas object.  This metafile can then be used to draw on the canvas of another object such as a paintbox or a printer.

MyMetafile := TMetafile.Create;

with TMetafileCanvas.Create(MyMetafile, 0) do
try
  Brush.Color := clRed;
  Ellipse(0,0,100,100);
  ...
finally
  Free;

end;

Form1.Canvas.Draw(0,0,MyMetafile); {1 red circle }

To add to an existing metafile image, create a metafile canvas and play the source metafile into the metafile canvas:

with TMetafileCanvas.Create(MyMetafile, 0) do

try
  Draw(0,0,MyMetafile);
  Brush.Color := clBlue;
  Ellipse(100,100,200,200);
...
finally
  Free;
end;

Form1.Canvas.Draw(0,0,MyMetafile); {1 red circle and 1 blue circle }
0
 

Author Comment

by:NetGeek
ID: 9918801
excellent, delphized

the Draw(0,0,MyMetafile); did the trick just nicely.

Just shows that you should first read the help thoroughly before seeking help elsewhere, but who ever reads the help ;)

thank you very much

NetGeek
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question