CRichEditCtx.InsertImagemethod
Replaces the selection with a blob that displays an image.
Syntax
FUNCTION InsertImage OVERLOAD (BYREF wszFileName AS WSTRING, BYVAL xWidth AS LONG = 0, BYVAL yHeight AS LONG = 0, BYVAL Ascent AS LONG = 0, BYVAL nType AS LONG = TA_BASELINE, BYREF wszAlternateText AS WSTRING = "") AS BOOLEAN
Parameters
| Name | Description | |
|---|---|---|
wszFileName | Path and name of the image file to load. | |
xWidth | Optional. Image width in pixels. If both xWidth and yWidth parameters are 0, the method retrieves the size of the image using GDI+. | |
yHeight | Optional. Image heigh in pixels. If both xWidth and yWidth parameters are 0, the method retrieves the size of the image using GDI+. | |
Ascent | Optional. If nType is TA_BASELINE (the default value), this parameter is the distance, in pixels, that the top of the image extends above the text baseline. If nType is TA_BASELINE and ascent is zero, the bottom of the image is placed at the text baseline. | |
nType | Optional. The vertical alignment of the image. It can be one of the following values. TA_BASELINE. Align the image relative to the text baseline. TA_BOTTOM. Align the bottom of the image at the bottom of the text line. TA_TOP. Align the top of the image at the top of the text line. | |
wszAlternateText | Optional. The alternate text for the image. | |
ip | A RICHEDIT_IMAGE_PARAMETERS structure that contains the image blob. |
Return value
Returns a boolean value: 0 for success and -1 for failure. To get extended error information call GetErrorInfo, which can return S_OK if successful, or one of the following error codes.
Overloaded method that replaces the selection with a blob that displays an image. Uses HIMETRIC units.
Returns S_OK if successful, or one of the following error codes.
Description
Overloaded method that replaces the selection with a blob that displays an image. It uses pixels instead of HIMETRIC units and it is DPI aware. Can insert and display .bmp, .jpg, .png and .gif files.
Example
FUNCTION InsertImage OVERLOAD (BYREF ip AS RICHEDIT_IMAGE_PARAMETERS) AS DWORD
Reference
- Defined in AfxNova/CRichEditCtx.inc:2713
- Documented in Windows/WIndows Controls/RichEdit/CRichEditCtx Class.md
- Topic: CRichEditCtx Class