Insert Images

General TRichView support forum. Please post your questions here
Post Reply
bswift
Posts: 37
Joined: Thu Sep 15, 2005 8:26 pm

Insert Images

Post 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.....
Sergey Tkachenko
Site Admin
Posts: 17604
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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.
bswift
Posts: 37
Joined: Thu Sep 15, 2005 8:26 pm

Post by bswift »

Sergey,

Thanks for the help. It now works.

Bruce
Post Reply