我使用了CPropertySheet类以后,窗体的大小和字体的大小就无法自己控制了
都是系统给搞定(让系统设为一个默认值了)我创建了一个CPropertySheet的子类CMyPropertySheet
在里面写了一个函数进行调整,可惜无法实现
void CMyPropertySheet::SetRect(LPRECT lpRc)
{
 CRect rectWnd;
 GetWindowRect(rectWnd);
 SetWindowPos(NULL, 0, 10,
  lpRc->right - 10,
  rectWnd.Height(),
  SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE); // Increase width of the tab control by 100 pixel
 GetTabControl()->GetWindowRect(rectWnd);
 GetTabControl()->SetWindowPos(NULL, 0, 0,
  lpRc->right- lpRc->left- 10+ rectWnd.left,
  rectWnd.Height(),
  SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE); // Increase the width of the property page by 100 pixels
 CPropertyPage* pPage = GetActivePage();
 pPage->GetWindowRect(rectWnd);
 rectWnd.right= lpRc->right- lpRc->left- 10+ rectWnd.left;
 ScreenToClient(rectWnd);
 pPage->MoveWindow(rectWnd);}然后在使用CMyPropertySheet的对话框的OnSize里对该函数进行调用
m_Sheet.SetRect(&rc);
可惜无法达到调整窗体大小的目的(也尝试过在OnPaint里进行调用)。
另外小弟也尝试过改变窗体的字体大小:
在CMyProperySheet的OnInitDialog()里调用以下语句:
CFont *font = new CFont;
 font->CreateFont(100, 0, 0, 0, 900, 0, 0, 0, ANSI_CHARSET, 
OUT_DEFAULT_PRECIS,
  CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH|FF_DONTCARE,
  "arial");
 SetFont(font);
可惜也无法达到调整字体大小的目的通过网上查证:CPropertySheet,MFC进行了默认处理
请各位高手大大指教:
如何将窗体大小加大,不受限制???
如何将字体自由变化????? 

解决方案 »

  1.   

    Two CPropertySheet/CPropertyPage derived classes to implement resizable property sheets or wizard dialogs with MFC  
    http://www.codeproject.com/property/resizableproperties.aspResizable CPropertySheet
    http://www.codeguru.com/Cpp/controls/propertysheet/sizing/article.php/c599/
      

  2.   

    Prpfont.exe sample demonstrates how to set the desired font for your CPropertyPages in Visual C++http://support.microsoft.com/default.aspx?scid=kb;en-us;142170
      

  3.   

    // This code shows how to resize a modeless CPropertySheet and
    // add a button.// CMySheet is derived from CPropertySheet
    BOOL CMySheet::OnInitDialog()
    {
              CPropertySheet::OnInitDialog();          RECT rc;
              GetWindowRect (&rc);
              // Increase the height of the CPropertySheet by 30
              rc.bottom += 30;
              // Increase the width of CPropertySheet by 50
              rc.right +=50;
              // Resize the CPropertySheet
              MoveWindow (rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top);          // Convert to client coordinates
              ScreenToClient (&rc);
              // m_Button is of type CButton and is a member of CMySheet
              m_Button.Create ("&MyButton", WS_CHILD | WS_VISIBLE | WS_TABSTOP,
                 CRect (5, rc.bottom-30, 80, rc.bottom-5), this, IDC_MYBUTTON);
              return TRUE;
    }
      

  4.   

    CPropertySheet now always changes its font to the default font. Even if the font of the property pages is changed in the resource editor, property pages will be displayed at run-time with the system font. If it is necessary to change the font, call SetFont in OnInitDialog and then do an appropriate MoveWindow to resize the sheet and move and resize all controls on the page. Also, the property sheet is set back to its original size whenever a page is activated, so it is necessary to resize the page in response to a click on the tab control. For more information, see the Knowledge Base article Q142170