Page 1 of 1

Insert Images

Posted: Sat Apr 30, 2016 1:06 pm
by bswift
I have been using this code in an old app for 10 years and it works;
var
bmp: TBitmap;
jpg: TJpegImage;
begin
bmp := TBitmap.Create;
jpg := TJpegImage.Create;
bmp.Assign(TImage(Image1.Picture));
jpg.Assign(bmp);
RVE.InsertPicture('', bmp, rvvaBaseline);
bmp.Free;
jpg.Free;
end;

using it in another app and it tell me I can't assign a Tpicture to a bitmap.

What the heck am I doing wrong here.....

Posted: Mon May 02, 2016 8:00 am
by Sergey Tkachenko
Change
bmp.Assign(TImage(Image1.Picture));
to
bmp.Assign(Image1.Picture.Graphic);

And I assume you wanted to insert jpg instead of bmp.
And do not free the graphic object passed to InsertPicture.

Posted: Mon May 02, 2016 4:55 pm
by bswift
Sergey,

Thanks for the help. It now works.

Bruce