SnapRect method

Called by MSHTML whenever a selected element is resized or moved in the editor.

Syntax

HRESULT retVal = object.SnapRect(pIElement, prcNew, eHandle);

Parameters

  • pIElement [in]
    Type: IHTMLElement

    A pointer to an IHTMLElement interface that specifies the element that is resized or moved.

  • prcNew [in, out]
    Type: RECT

    A pointer to a variable of type RECT that specifies the element's current size and position, relative to the containing document's global coordinate system, and that receives the new size and position for the element.

  • eHandle
    Type: ELEMENT_CORNER

    A ELEMENT_CORNER enumeration that specifies which handle or corner the user has selected for the resizing operation.

Return value

Type: HRESULT

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

Remarks

You can use this method to provide a snap-to-grid feature for element resizing and positioning.