Partager via


CHeaderCtrl::Layout

Retrieves the size and position of a header control within a given rectangle.

BOOL Layout(
   HDLAYOUT* pHeaderLayout 
);

Parameters

  • pHeaderLayout
    Pointer to an HDLAYOUT structure, which contains information used to set the size and position of a header control.

Return Value

Nonzero if successful; otherwise 0.

Remarks

This function is used to determine the appropriate dimensions for a new header control that is to occupy the given rectangle.

Example

HDLAYOUT  hdl;
WINDOWPOS wpos;
RECT      rc;

// Reposition the header control so that it is placed at 
// the top of its parent window's client area.
m_myHeaderCtrl.GetParent()->GetClientRect(&rc);

hdl.prc = &rc;
hdl.pwpos = &wpos;
if (m_myHeaderCtrl.Layout(&hdl))
{
   m_myHeaderCtrl.SetWindowPos(
      CWnd::FromHandle(wpos.hwndInsertAfter),
      wpos.x,
      wpos.y,
      wpos.cx,
      wpos.cy,
      wpos.flags | SWP_SHOWWINDOW);
}

Requirements

Header: afxcmn.h

See Also

Concepts

CHeaderCtrl Class

CHeaderCtrl Members

Hierarchy Chart