|
TCustomRichView.SetPictureInfo |
Top Previous Next |
|
Changes main properties of the item of picture or hot-picture type. function SetPictureInfo(ItemNo: Integer; const AName: String; Agr: TGraphic; AVAlign: TRVVAlign; ATag: Integer): Boolean; Parameters: ItemNo – index of the item. The item must be of picture or hot-picture type (rvsPicture or rvsHotPicture), otherwise the method raises ERichViewError exception. Items are indexed from 0 to ItemCount-1, GetItemStyle returns type of item. Items of subdocuments (table cells) are not included in the items range of the main document; for items in cells, use Cell.GetRVData.SetPictureInfo. AName – name of the item, any string without line break (CR, LF) characters. It can also be set using SetItemText method. Agr – graphic object. It must be an unique graphic object (you cannot assign the same graphic object to two or more items) or value returned by GetPictureInfo. AVAlign – vertical alignment of the picture. ATag – tag of the item.If tags are pointers to dynamically allocated strings (rvoTagsArePChars in Options), this parameter must be set to value returned by StrNew of StrAlloc functions, typecasted to integer. You can use value returned by GetPictureInfo or GetItemTag for this item. The tag can also be set by SetItemTag method.
Return value: is reformatting needed? (are the size and the vertical align of the new picture not equal to the size and the vertical align of the old one?)
Method type: Additional item properties are assigned by the methods SetItemExtraIntProperty and SetItemExtraStrProperty (including stretching, transparency for bitmaps, link to file name, alternative text for saving to HTML).
Example 1 // if not (rvoTagsArePChars in RichView1.Options) RichView1.SetPictureInfo(ItemNo, 'my image', Bitmap1, rvvaBaseline, 1) // if rvoTagsArePChars in RichView2.Options RichView1.SetPictureInfo(ItemNo, 'my image', Bitmap2, rvvaBaseline, Integer(StrNew('bullet tag'))); Example 2 (incorrect!) bmp := TBitmap.Create; bmp.LoadFromFile('c:\image.bmp'); RichView1.SetPictureInfo(ItemNo1, '', bmp, rvvaBaseline, 0); RichView1.SetPictureInfo(ItemNo2, '', bmp, rvvaBaseline, 0); // incorrect! you cannot assign // the same graphic object to different items Example 2 (the same, but correct) bmp1 := TBitmap.Create; bmp1.LoadFromFile('c:\image.bmp'); RichView1.SetPictureInfo(ItemNo1, '', bmp1, rvvaBaseline, 0); bmp2 := TBitmap.Create; bmp2.Assign(bmp1); RichView1.SetPictureInfo(ItemNo2, '', bmp2, rvvaBaseline, 0);
See also methods:
See also properties: See also methods of RichViewEdit: See also:
|