IRawElementProviderFragment::BoundingRectangle Property

Gets the bounding rectangle of this element.

Syntax

HRESULT IRawElementProviderFragment::get_BoundingRectangle(UiaRect *pRetVal);

Parameters

  • pRetVal
    When this method returns, contains a UiaRect structure that defines the bounding rectangle. This parameter is passed uninitialized.

Return Value

Returns S_OK if successful, or an error value otherwise.

Remarks

The bounding rectangle is defined by the location of the top left corner on the screen, and the dimensions.

No clipping is required if the element is partly obscured or partly off-screen. The IsOffscreen property should be set to indicate whether the rectangle is actually visible.

Not all points within the bounding rectangle are necessarily clickable.

Example

The following example implementation by a list item provider calculates the bounding rectangle for the item based on its height and position within the containing list box.

HRESULT STDMETHODCALLTYPE ListItemProvider::get_BoundingRectangle(UiaRect * pRetVal)
{
    if (pRetVal == NULL) return E_INVALIDARG;

    UiaRect parentRect;
    HRESULT hr = m_parentProvider->get_BoundingRectangle(&parentRect);
    pRetVal->left = parentRect.left;
    pRetVal->top = parentRect.top + (m_pParentControl->m_itemHeight * m_itemIndex);
    pRetVal->width = parentRect.width;
    pRetVal->height = m_pParentControl->m_itemHeight;
    return S_OK;
}             

See Also

IRawElementProviderFragment