Hello sergey
When I insert a bitmap in a table cell. I try to free the bitmap when done, but An exception in arised Why???
Please Help!!!
procedure TFScienceStudio.InsertBitmap1Click(Sender: TObject);
var Table:TrvTableItemInfo;
BitMap:TBitmap;
Row,Col:Integer;
begin
Table:=GetTable(Rich.RichViewEdit.RVData,'');
Bitmap:=TBitmap.Create;
Row:=0;
Col:=0;
Bitmap.Canvas.Font.Size:=20;
Bitmap.Width:=Bitmap.Canvas.TextWidth('Question');
Bitmap.Height:=Bitmap.Canvas.TextHeight('Question');
Bitmap.Canvas.Font.color:=Clred;
Bitmap.Canvas.TextOut(0,0,'Hello');
Table.EditCell(Row, Col);
// moving the caret to the end of this cell
with TCustomRVFormattedData(Table.Cells[Row, Col].GetRVData) do
SetSelectionBounds(ItemCount-1, GetOffsAfterItem(ItemCount-1), ItemCount-1, GetOffsAfterItem(ItemCount-1));
Rich.RichViewEdit.InsertPicture('',Bitmap, rvvaAbsMiddle);
Rich.RichViewEdit.Change;
Rich.RichViewEdit.Format;
Bitmap.free;
end;
Insert a bitmap in a table cell
Re: Insert a bitmap in a table cell
fara2000,
Sergey can confirm, but as I recall when you insert a picture (RichViewEdit.InsertPicture) the graphic is then "owned" by the richview and you no longer have to free it, the richview will do that for you. Just comment out the Bitmap.free call.
Stan
Sergey can confirm, but as I recall when you insert a picture (RichViewEdit.InsertPicture) the graphic is then "owned" by the richview and you no longer have to free it, the richview will do that for you. Just comment out the Bitmap.free call.
Stan
-
- Site Admin
- Posts: 17554
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: Insert a bitmap in a table cell
Yes, it's correct.
Do not free the image after calling InsertPicture or AddPicture
Do not free the image after calling InsertPicture or AddPicture
Re: Insert a bitmap in a table cell
Thank you very much for tghe immediate response