Page 1 of 1

RichViewEdit1.InsertPicture problem

Posted: Sat May 16, 2009 7:44 pm
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?

Posted: Mon May 18, 2009 6:40 pm
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.