|
TCustomRichViewEdit.InsertPicture |
Top Previous Next |
|
Inserts picture in the position of caret. function InsertPicture(const Name: String; gr: TGraphic; VAlign: TRVVAlign): Boolean; Parameters: Name – name of this picture item, any string. Name must not contain CR and LF characters. RichView does not use items names itself, they are for you own use. This is an ANSI string, regardless of Unicode mode of text styles. gr – picture to insert. You should create picture yourself, and should not free it (RichViewEdit will do it for you). VAlign – vertical align of this picture, relative to its line, see TRVVAlign for possible values.
Method type:
If you want this picture to be a hypertext link, use InsertHotPicture instead.
Return value True if the insertion was successful (it can fail due to protection, or when inserting in table having multicell selection)
Example (inserting icon from file) var ico: TIcon; ... ico := TIcon.Create; ico.LoadFromFile('My Icon.ico'); MyRichViewEdit.InsertPicture('',ico, rvvaBaseline); Example 2 (inserting picture of any supported format): var gr: TGraphic; pic: TPicture; ... if OpenPictureDialog1.Execute then begin pic := TPicture.Create; try pic.LoadFromFile(OpenPictureDialog1.FileName); gr := RV_CreateGraphics(TGraphicClass(pic.Graphic.ClassType)); gr.Assign(pic.Graphic); MyRichViewEdit.InsertPicture('', gr, rvvaBaseline); finally pic.Free; end; end; See also methods of TCustomRichView: See also: |