trichview.com

trichview.support




Re: Save entire document to image file


Return to index


Author

Message

Ken Linder

Posted: 03/17/2003 10:43:01


Well, now I get a file but it is not a BMP.  I am not sure what it is... :-)


Here is the code I am using:


function TFMain.ExportToBMP(FileName: string): boolean;

var

   wmf    : TMetaFile;

   Width  : integer;

   Height : integer;

   Canvas : TMetaFileCanvas;

begin

   // save to BMP

   rvEdit.HScrollPos := 0;

   rvEdit.VScrollPos := 0;

   rvEdit.Deselect;

   rvEdit.Invalidate;

   Width  := rvEdit.RVData.DocumentWidth +

rvEdit.LeftMargin+rvEdit.RightMargin;

   Height := rvEdit.RVData.DocumentHeight;


   wmf := TMetafile.Create;

   wmf.Width := Width;

   wmf.Height := Height;

   Canvas := TMetaFileCanvas.Create(wmf, 0);

   Canvas.Brush.Color := clWindow;

   Canvas.FillRect(rect(0, 0, Width, Height));

   rvEdit.RVData.PaintTo(Canvas, rect(0,0,500000, 500000));

   Canvas.Free;


   wmf.SaveToFile(FileName);


   Wmf.Free;

   Result := true;

end;


Am I just drinking too much coffee & missing the obvious?

Sergey, if you ever get to visit Las Vegas, let me know and I will get you a

nice hotel room.  It is the least I can do for all of your help!


Ken

(In Las Vegas)


"Sergey Tkachenko" <svt@trichview.com> wrote in message

news:3e74e0af@support.torry.net...

> Make sure that you save it after freeing MetafileCanvas

>

> > Thanks for the info, but when I do :

> >

> > wmf.SaveToFile(FileName);

> >

> > It saves an empty file.

> >

> > Any ideas???

> >

> > TNX

> > Ken

> >

>

>

>





Powered by ABC Amber Outlook Express Converter