共用方式為


CTabCtrl::AdjustRect

Calculates a tab control's display area given a window rectangle, or calculates the window rectangle that would correspond to a given display area.

void AdjustRect(
  BOOL bLarger,
  LPRECT lpRect 
);

Parameters

  • bLarger
    Indicates which operation to perform. If this parameter is TRUE, lpRect specifies a display rectangle and receives the corresponding window rectangle. If this parameter is FALSE, lpRect specifies a window rectangle and receives the corresponding display rectangle.

  • lpRect
    Pointer to a RECT structure that specifies the given rectangle and receives the calculated rectangle.

Example

void CTabDlg::OnSize(UINT nType, int cx, int cy)
{
   CDialog::OnSize(nType, cx, cy);

   if(m_TabCtrl.m_hWnd == NULL)
      return;      // Return if window is not created yet.

   RECT rect;

   // Get size of dialog window.
   GetClientRect(&rect);

   // Adjust the rectangle to fit the tab control into the 
   // dialog's client rectangle.
   m_TabCtrl.AdjustRect(FALSE, &rect);

   // Move the tab control to the new position and size.
   m_TabCtrl.MoveWindow(&rect, TRUE);   
}

Requirements

Header: afxcmn.h

See Also

Concepts

CTabCtrl Class

CTabCtrl Members

Hierarchy Chart

CTabCtrl::SetItemSize

CTabCtrl::GetItemRect

CTabCtrl::AdjustRect