Does RichView had any interface to insert picture?
Does RichView had any interface to insert picture?
I want a richedit inherit richview ,or richview has the richedit's property,how can i do that? And the most important is that when i complete,i want get all the picture's source path, how can i do that?
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Inserting picture? It's simple:
About storing picture file name, there are two ways to do it.
The simplest way is to store it in the "item name" - text value associated in TRichView with any picture:
But the recommended way for storing image file name is a special "file name" item property. It was specially designed for storing image file names.
Code: Select all
var bmp: TBitmap;
bmp := TBitmap.Create;
bmp.LoadFromFile('c:\pic.bmp');
RichViewEdit1.InsertPicture('', bmp, rvvaBaseline);
The simplest way is to store it in the "item name" - text value associated in TRichView with any picture:
Code: Select all
bmp := TBitmap.Create;
bmp.LoadFromFile('c:\pic.bmp');
RichViewEdit1.InsertPicture('c:\pic.bmp', bmp, rvvaBaseline);
// reading name from the picture at the position of caret
FileName := RichViewEdit1.GetCurrentItemText;
Code: Select all
bmp := TBitmap.Create;
bmp.LoadFromFile('c:\pic.bmp');
RichViewEdit1.TopLevelEditor.BeginUndoGroup(rvutInsert);
RichViewEdit1.TopLevelEditor.SetUndoGroupMode(True);
try
if RichViewEdit1.InsertPicture('', bmp, rvvaBaseline) then
RichViewEdit1.SetCurrentItemExtraStrProperty(rvespImageFileName, 'c:\pic.bmp', True);
finally
RichViewEdit1.TopLevelEditor.SetUndoGroupMode(False);
end;
// reading file name from the picture at the position of caret
RichViewEdit1.GetCurrentItemText(rvespImageFileName, FileName);