CPropertySheet在.DoModal()后,它自动的变成最大的PropertyPage的尺寸,如何改变它的大小呢?

解决方案 »

  1.   

    CPropertySheet总会比PropertyPage大的
      

  2.   

    Property sheets do have a minimum size. However, you can adjust the
    size in the property sheet's OnInitDialog handler.BOOL CXPropSheet::OnInitDialog() 
    {
     HWND hWnd = (HWND)::GetDlgItem(m_hWnd, AFX_IDC_TAB_CONTROL); CRect rectOld;
     ::GetWindowRect(hWnd, &rectOld);
     ScreenToClient(rectOld);
     int nCy = rectOld.Width()/2;
     rectOld.right -= nCy; // move tab control
     ::SetWindowPos(hWnd, NULL, 0, 0,
      rectOld.Width(), rectOld.Height(),
      SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE); GetWindowRect(&rectOld);
     rectOld.right -= nCy; SetWindowPos(NULL, 0, 0, rectOld.Width(), rectOld.Height(),
      SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE); return CPropertySheet::OnInitDialog();
    }
      

  3.   

    请问kingzai(studying C#) ,我是在菜单函数中
    CPropertySheet dlgPropertySheet(AFX_IDS_APP_TITLE);
    CSelListPropage DispPropage; dlgPropertySheet.AddPage(&DispPropage); if (dlgPropertySheet.DoModal() == IDOK){         }那如何添加类似BOOL CXPropSheet::OnInitDialog() 的 PropertySheet的事件响应函数呢?
      

  4.   

    derive your own CXproSheet class from CPropertySheet,then overide it ,such as 
    CXPropSheet dlgPropertySheet(AFX_IDS_APP_TITLE);
    CSelListPropage DispPropage; dlgPropertySheet.AddPage(&DispPropage); if (dlgPropertySheet.DoModal() == IDOK){         }