trichview.support
Re: Inserting picture |
Author |
Message |
Sergey Tkachenko |
Posted: 04/10/2003 17:56:09 In both cases, you insert empty picture. The first parameter of InsertPicture is a arbitrary string that is not used by RichView. The correct code is procedure TForm1.FormCreate(Sender: TObject); var gr:TGraphic; begin r.format; // for any case r.InsertText('a line'); gr := TBitmap.Create; gr.LoadFromFile('c:\flag.bmp'); r.InsertPicture('c:\flag.bmp',gr,rvvaBaseline); // format is not required here end; or better procedure TForm1.FormCreate(Sender: TObject); var gr:TGraphic; begin r.Clear; r.AddNL('a line', 0, 0); gr := TBitmap.Create; gr.LoadFromFile('c:\flag.bmp'); r.AddPictureEx('c:\flag.bmp',gr, -1, rvvaBaseline); r.Format; end; There is a great difference between methods Add*** (like AddNL, AddPictureEx, and other methods introduced in TCustomRichView) and methods Insert*** (InsertText, InsertPicture, and other methods of TCustomRichViewEdit). See the help topic "Viewer vs Editor". Do not mix these methods. Add*** add items to the end, do not require formatted document, require call of Format after. Insert*** inserts at the position of caret, require formatted document before their call, leave document formatted after, can be undone/redone. > > Hello, > When I use the following method, the picture is not inserted. Why is this > so? WHere did the picture go to? |
Powered by ABC Amber Outlook Express Converter