the rvf file is simple...it only contains two words.
the resulting .wmf file is corrupt. the resulting .bmp file is good.
i'm surprised there are no attachments supported here; i'd include the sample app.
how can i fix this?
thank you!
mp
procedure TForm1.btnRenderToPictureClick(Sender: TObject);
const
VERYLARGEVALUE = $FFFFFFF;
var
iWidth, iHeight:integer;
mfCanvas: TMetafileCanvas;
bmp:TBitmap;
wmf : TMetafile;
begin
RichViewEdit1.LoadRVF('r.rvf');
RichViewEdit1.Format;
RichViewEdit1.Reformat;
RichViewEdit1.HScrollPos := 0;
RichViewEdit1.VScrollPos := 0;
RichViewEdit1.Deselect;
RichViewEdit1.Invalidate;
iWidth := RichViewEdit1.RVData.DocumentWidth + RichViewEdit1.LeftMargin + RichViewEdit1.RightMargin;
iHeight := RichViewEdit1.RVData.DocumentHeight;
// surely these are not needed
// RichViewEdit1.Width:=iWidth;
// RichViewEdit1.Height:=iHeight;
wmf := TMetafile.Create;
wmf.Width := iWidth;
wmf.Height := iHeight;
mfCanvas := TMetafileCanvas.Create(wmf, 0);
mfCanvas.Brush.Color := clRed;// clWhite;
mfCanvas.FillRect(Rect(0, 0, iWidth, iHeight));
RichViewEdit1.RVData.PaintTo(mfCanvas, Rect(0, 0, VERYLARGEVALUE, VERYLARGEVALUE),
False, False, False, False, 0, 0);
// file is corrupt
wmf.SaveToFile('r.wmf');
mfCanvas.Free;
wmf.Free;
bmp:=TBitmap.Create;
bmp.Width := iWidth;
bmp.Height := iHeight;
bmp.Canvas.Brush.Color := clRed;// clWhite;
bmp.Canvas.FillRect(Rect(0, 0, iWidth, iHeight));
RichViewEdit1.RVData.PaintTo(bmp.Canvas,
Rect(0, 0, VERYLARGEVALUE, VERYLARGEVALUE),
False,
False,
False,
False,
0,
0);
// file is ok
bmp.SaveToFile('r.bmp');
bmp.Free;
end;
invalid meta file created by RichViewEdit1.RVData.PaintTo( )
-
- Site Admin
- Posts: 17525
- Joined: Sat Aug 27, 2005 10:28 am
- Contact: