我想让属性页的位置top不是为0,就是在属性页顶端空出一段距离,我想放几个按钮?
还有怎么动态改变 CPropertyPage 的标题?谢谢了!
我想听听大家的思路和提示,如果是网页帮助链接就免了,嘻嘻,我也可以搜索到好多,就是试了很多都搞不定!请大家谅解啊^_^

解决方案 »

  1.   

    1.GetTabControl()->MoveWindow(...);
    2.SetWindowText
      

  2.   

    GetTabControl()->SetItem修改标题
      

  3.   

    to DentistryDoctor(雅克医生<改行做程序员了>)
    能再详细一点嘛? 譬如我要空出离顶端30,再显示属性页,还有SetWindowText怎么更改属性页的标签啊!谢谢^_^
      

  4.   

    BOOL CTestSheet::OnInitDialog() 
    {
    BOOL bResult = CPropertySheet::OnInitDialog();
    CTabCtrl* pTab = GetTabControl();
    CRect rectTab;
    pTab->GetWindowRect(&rectTab);
    rectTab.OffsetRect(0,30);
    pTab->MoveWindow(rectTab);
    ...
    }
      

  5.   

    BOOL CMyPropertySheet::OnInitDialog() 
    {
    BOOL bResult = CPropertySheet::OnInitDialog();
    //网页地址栏
        CRect CR;
        GetClientRect(&CR);
        int bh = 30 ;
        int bw = 30 ;
        int maxw = CR.right - CR.left ;
       
    m_forward.Create("前进",BS_OWNERDRAW, CRect(0, 0,
    bw, bh), this, 1);//rect(left,top,right,bootom)
    m_forward.LoadBitmaps(IDB_FORWARD);
    m_forward.ShowWindow( SW_SHOW ); m_back.Create("后退",BS_OWNERDRAW,CRect(bw,0,bw*2,
    bh),this,2);
    m_back.LoadBitmaps(IDB_BACK);
    m_back.ShowWindow(SW_SHOW); m_stop.Create("停止",BS_OWNERDRAW,CRect(bw*2,0,bw*3,
    bh),this,7);
    m_stop.LoadBitmaps(IDB_STOP);
    m_stop.ShowWindow(SW_SHOW);

    m_refresh.Create("刷新",BS_OWNERDRAW,CRect(bw*3,0,bw*4,
    bh),this,3);
    m_refresh.LoadBitmaps(IDB_REFRESH);
    m_refresh.ShowWindow(SW_SHOW); m_URL.Create(WS_VISIBLE | WS_CHILD |
    WS_BORDER | ES_WANTRETURN | ES_MULTILINE |
    ES_AUTOHSCROLL | ES_AUTOVSCROLL, CRect(bw*4, 5, maxw-bw*2, bh-5), this, 4);
    m_URL.ShowWindow(SW_SHOW); m_goto.Create("转到",BS_OWNERDRAW,CRect(maxw-bw*2,0,maxw-bw,
    bh),this,5);
    m_goto.LoadBitmaps(IDB_GOTO);
    m_goto.ShowWindow(SW_SHOW);

    m_close.Create("关闭",BS_OWNERDRAW,CRect(maxw-bw,0,maxw,
    bh),this,6);
    m_close.LoadBitmaps(IDB_CLOSE);
    m_close.ShowWindow(SW_SHOW); GetDlgItem(IDHELP)->ShowWindow(SW_HIDE);
    GetDlgItem(IDOK)->ShowWindow(SW_HIDE);
    GetDlgItem(IDCANCEL)->ShowWindow(SW_HIDE);     CRect r,test; 
         GetWindowRect(&r);
         r.bottom -= GetSystemMetrics(SM_CYMENU)+15;    MoveWindow(r);   // Init m_nMinCX/Y
       m_nMinCX = r.Width();
       m_nMinCY = r.Height();   m_bNeedInit = FALSE;
       GetClientRect(&m_rCrt);
       return bResult;
    }
    void CMyPropertySheet::OnSize(UINT nType, int cx, int cy) 
    {
       CRect r1; 
       CPropertySheet::OnSize(nType, cx, cy);
       
       if (m_bNeedInit)
          return;
       //动态重画按钮
       CRect CR;
       GetClientRect(&CR);
       int bh = 30 ;
       int bw = 30 ;
       int maxw = CR.right - CR.left ;
       if((maxw)>300)
       {
       m_forward.MoveWindow(0,0,bw,bh);
       m_back.MoveWindow(bw,0,bw*2,bh);
       m_stop.MoveWindow(bw*2,0,bw*3,bh);
       m_refresh.MoveWindow(bw*3,0,bw*4,bh);
       m_URL.MoveWindow(bw*4,5,maxw-bw*2,bh-5);
       m_goto.MoveWindow(maxw-bw*2,0,maxw-bw,bh);
       m_close.MoveWindow(maxw-bw,0,maxw,bh);
       }
     
       /**********/   CTabCtrl *pTab = GetTabControl();
       ASSERT(NULL != pTab && IsWindow(pTab->m_hWnd));
        
       int dx = cx - m_rCrt.Width();
       int dy = cy - m_rCrt.Height();
       GetClientRect(&m_rCrt);   HDWP hDWP = ::BeginDeferWindowPos(5);
       pTab->GetClientRect(&r1); 
       r1.right += dx; r1.bottom += dy;
      ::DeferWindowPos(hDWP, pTab->m_hWnd, NULL,
                       0, 0, r1.Width(), r1.Height(),
                      SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOZORDER);
       // Move all buttons with the lower right sides
       for (CWnd *pChild = GetWindow(GW_CHILD);//窗体的第一个子窗体
            pChild != NULL;
            pChild = pChild->GetWindow(GW_HWNDNEXT))//返回列表中紧跟给定窗口的兄弟窗口
       {
    if (pChild->SendMessage(WM_GETDLGCODE) & DLGC_BUTTON)//发送此消息给某个与对话框程序关联的控件,widdows控制方位键和TAB键使输入进入此控件通过响应WM_GETDLGCODE消息,应用程序可以把他当成一个特殊的输入控件并能处理它 

          {
             pChild->GetWindowRect(&r1); ScreenToClient(&r1); 
             r1.top += dy; r1.bottom += dy; r1.left+= dx; r1.right += dx;
             ::DeferWindowPos(hDWP, pChild->m_hWnd, NULL,
                              r1.left, r1.top, 0, 0,
                              SWP_NOACTIVATE|SWP_NOSIZE|SWP_NOZORDER);
          }
          // Resize everything else...
          else
          {
             pChild->GetClientRect(&r1); 
         r1.right += dx; r1.bottom += dy;
     ::DeferWindowPos(hDWP, pChild->m_hWnd, NULL, 0, 0, r1.Width(), r1.Height(),SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOZORDER);
          }   }   ::EndDeferWindowPos(hDWP);}