Draw method

Called by MSHTML to render a behavior in the browser's client area.


HRESULT retVal = object.Draw(rcBounds, rcUpdate, lDrawFlags, hdc, pvDrawObject);


  • rcBounds [in]
    Type: RECT

    RECT that specifies the bounds of the element to which the behavior is attached.

  • rcUpdate [in]
    Type: RECT

    RECT that specifies a bounding rectangle for the region that needs to be redrawn.

  • lDrawFlags [in]
    Type: LONG

    HTML_PAINT_DRAW_FLAGS enumeration that specifies options to use while drawing.

  • hdc [in]
    Type: HDC

    HDC that specifies a GDI device context for the behavior to use while drawing.

  • pvDrawObject [in]
    Type: LPVOID

    Pointer to a drawing object, such as a DirectDraw surface, for the behavior to use while drawing.

Return value


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


The coordinate system for rcBounds and rcUpdate is the same as that of the GDI device context or drawing object in use.

Only one of hdc or pvDrawObject will be set, depending on the behavior's chosen method for drawing itself. The behavior sets this choice in the HTML_PAINTER enumeration, which MSHTML accesses by calling IHTMLPainter::GetPainterInfo prior to its first call to IHTMLPainter::Draw or whenever IHTMLPaintSite::InvalidatePainterInfo is called.