使用VC++ 2008 创建了一个CTabCtrl,使用CTabCtrl类提供的AdjustRect不能修改控件的宽度只能修改高度。请问如何在控件创建之后修改控件的宽度?
p.s. 创建控件的时候使用的是CTabCtrl::Create方法,指定的是TCS_TABS | WS_CHILD | WS_VISIBLE风格参数

解决方案 »

  1.   

    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);   
    }