trichview.support
Re: How to replace picture in richviewedit |
Author |
Message |
Jean Jacques Serpoul |
Posted: 09/28/2004 21:42:09 Thanks, it's working Jean Jacques Serpoul "Sergey Tkachenko" <svt@trichview.com> a écrit dans le message de news: 41594a77$1@support.torry.net... > 1) trichview.BackgroundBitmap > > bmp := TBitmap.Create; > bmp.LoadFromFile(...); > rv.BackgroundBitmap := bmp; // image is copied here > bmp.Free; // you still need to free the original image > > 2) cell.BackgroundImage > > bmp := TBitmap.Create; > bmp.LoadFromFile(...); > cell.BackgroundImage := bmp; // image is copied here > bmp.Free; // you still need to free the original image > > The same is for table.BackgroundImage. > Unlike trichview.BackgroundBitmap, you can assign not only bitmaps, but > any > graphic type for these properties > > 3) For items - image is not copied but owned by TRichView. > You can use RVData.SetPictureInfo to change it, where RVData may be > trichview.RVData is the item is not in table, or cell.GetRVData, if the > item > is in a table cell. > > bmp := TBitmap.Create; > bmp.LoadFromFile(...); > RVData.SetPictureInfo(... bmp ...); > // do not free bmp! > > What to do if you want to load graphics from file, do not know file > format, > but want to load it anyway if it's supported by Delphi. > > var pic: TPicture; > gr: TGraphic; > > pic.LoadFromFile(...); // TPicture can detect file format > gr := RV_CreateGraphics(TGraphicClass(pic.Graphic.ClassType)); // from > RVFuncs unit > gr.Assign(pic.Graphic); > > Now use gr as bmp in the examples 2-3 above. > > The examples above assume that you do not want to make these operations > undoable. > >> Hello, >> I want to replace programmatically pictures in a richview document using >> BackgroundImage, Cell.BackgroundImage or Cell.GetPictureInfo ==> I get a >> Tgraphic object. >> How to change it (Loading from a file for example) and replace it in the >> richview document. >> Thanks in advance >> Jean Jacques Serpoul >> >> > > |
Powered by ABC Amber Outlook Express Converter