|
Pictures |
Top Previous Next |
|
Pictures Picture item displays a picture stored in TGraphic object. Delphi has the following standard graphic classes:
In addition, you can use third-party graphic classes. Style of this item type: rvsPicture (-3) For hypertext pictures, see hot-pictures item type. Additional Properties This item type has the following specific extra integer properties:
This item type has the following specific extra string properties:
This item type has the following properties affecting vertical position:
Resizing In editor, pictures can be resized with the mouse (except for TIcon). You can forbid mouse resizing by including rvoNoImageResize in EditorOptions. You can forbid resizing for the specific image by assigning 0 to rvepResizable extra integer property. Resizing with mouse does not modify the image itself, it changes rvepImageWidth and rvepImageHeight. OnItemResize event occurs after resizing. Methods of TCustomRichView The following viewer-style methods add item of this type to the end of the document: The following viewer-style method changes the main properties of item of this type: The following method returns main properties of the given item of this type: Methods of TCustomRichViewEdit The following editor-style method inserts item of this type in the position of caret: The following editor-style methods modify main properties of the item of this type: The following method returns main properties of the item of this type at the position of caret: Memory Usage RichView owns this graphic object, and it will destroy it when clearing document. Do not free memory for graphic object inserted in RichView yourself. Do not insert the same graphic object twice. Saving and Loading In order to load these items from RVF, you need to register a class of the graphics. RichView does it automatically for the standard item classes. But if you use third-party graphic classes, register them. For example:
If rvfoSavePicturesBody is excluded from RVFOptions, graphic data is not saved in RVF. When loading such RVF files, OnRVFPictureNeeded event occurs. You can use this feature to store images in database or files. Export to HTML By default, all pictures are saved as jpegs (or as bitmaps). If you want to save pictures of some graphic class without conversion, call RV_RegisterHTMLGraphicFormat. For example:
If you want to save pictures in another format, use OnHTMLSaveImage or OnSaveImage2 events. RTF export RTFOptions contain options for saving pictures in RTF. Pictures are embedded in RTF, external image files are not created. Bitmaps are stored as bitmaps. 32-bit metafiles (EMF) are stored as 32-bit or 16-bit (WMF) metafiles. PNG images are stored as PNG images, if PNG class is specified. All other graphic formats are stored as bitmaps, WMF or PNG (except for Jpegs which can be stored as Jpegs). RTF Import You can set RTFReadProperties.IgnorePictures to True, and pictures in RTF will not be added in RichView. RTF can have embedded images and external images (in separate files). In order to load external images, a proper graphic class must be associated with the file extension. Delphi does it for standard graphic classes automatically, but for some third-party classes you need to do it yourself. For example: TPicture.RegisterFileFormat('gif','Gif Image',TGifImage); Read more information in the topic about third-party graphic classes. See Also... |