RichViewEdit1.InsertPicture problem

General TRichView support forum. Please post your questions here
Post Reply
Marsianin
Posts: 193
Joined: Sun Sep 25, 2005 11:03 pm

RichViewEdit1.InsertPicture problem

Post by Marsianin »

I want to insert picture to RichViewEdit from PngImageList (Png Components adapted for Delphi 2009).
And it seems I'm doing something wrong here because I'm getting EInvalidPointer on application exit but image inserts and saves fine.

Code: Select all

RichViewEdit1.InsertPicture('',ImageList1.PngImages.Items[10].PngImage,rvvaAbsBottom);
May be I forgot something or inserting picture is not so trivial?
Sergey Tkachenko
Site Admin
Posts: 17571
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

TRichView frees inserted pictures. You need to create a copy to insert from the list:

Code: Select all

var png: TPngImage;

png := TPngImage.Create;
png.Assign(ImageList1.PngImages.Items[10].PngImage);
RichViewEdit1.InsertPicture('', png, rvvaAbsBottom);
Or, if TPngImageList is compatible with TImageList, consider using InsertBullet method instead.
Post Reply