Help Center

CTextRange2.InsertImagemethod

Inserts an image into this range.

Windowsmethoddocumented

Syntax

FUNCTION InsertImage (BYVAL width_ AS LONG, BYVAL height AS LONG, BYVAL ascent AS LONG, BYVAL nType AS LONG, BYVAL bstrAltText AS AFX_BSTR, BYVAL pStream AS IStream PTR) AS HRESULT

Parameters

NameDescription
width_The width, in HIMETRIC units (0.01 mm), of the image.
heightThe height, in HIMETRIC units, of the image.
ascentIf nType is TA_BASELINE, this parameter is the distance, in HIMETRIC units, 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.
nTypeThe 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.
bstrAltTextThe alternate text for the image.
pStreamThe stream that contains the image data.

Return value

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Description

Inserts an image into this range.

Remarks

If the range is nondegenerate, the image replaces the text in the range.

Reference

  • Defined in AfxNova/CTextRange2.inc:1125
  • Documented in Windows/WIndows Controls/RichEdit/CTextRange2 Class.md
  • Topic: CTextRange2 Class