我现在有个很灵异的想法,类似一种模板的思路。就是在CPropertySheet创建的时候,做一些手脚,然后呢,无论切换任何一页的时候,这个格式都能有。请问怎么实现?
这个问题貌似很难,我在网上找了很久也没有答案,希望指点。100分还望大大们不嫌少

解决方案 »

  1.   

    打个比方,就像ppt不是有模板的嘛,那么背景或是一些布局每一页都一样了。对吧?能不能在CPropertySheet里面实现类似的这样子?切换任意标签,都能套用一种格式。比如显示标志这样子
      

  2.   

    继承CPropertySheet,然后调用的时候使用自己的这个sheet,再重载CPropertySheet对应的功能...
      

  3.   

    噢,显示标志啊?OnPaint里面处理下不就好了么
      

  4.   


    void CMyPropSheet::OnPaint () 
    {
        CPaintDC dc(this); // device context for painting
        
        int nOffset = 6;
        // load IDB_BITMAP1 from our resources
        CBitmap bmp;
        if (bmp.LoadBitmap (IDB_BITMAP1))
        {
            // Get the size of the bitmap
            BITMAP bmpInfo;
            bmp.GetBitmap (&bmpInfo);
            
            // Create an in-memory DC compatible with the
            // display DC we''re using to paint
            CDC dcMemory;
            dcMemory.CreateCompatibleDC (&dc);
            
            // Select the bitmap into the in-memory DC
            CBitmap* pOldBitmap = dcMemory.SelectObject (&bmp);
            
            // Find a bottom-left point for the bitmap in the client area
            CRect rect;
            GetClientRect (&rect);
            int nX = rect.left + nOffset;
            int nY = rect.top + (rect.Height () - bmpInfo.bmHeight) - nOffset;
            
            // Copy the bits from the in-memory DC into the on-
            // screen DC to actually do the painting. Use the centerpoint
            // we computed for the target offset.
            dc.BitBlt (nX, nY, bmpInfo.bmWidth, bmpInfo.bmHeight, &dcMemory, 
                0, 0, SRCCOPY);
            
            dcMemory.SelectObject (pOldBitmap);
        }    // Do not call CPropertySheet::OnPaint() for painting messages
    }
      

  5.   

    这个是类似Logo一样的东西。你不是想要标志这样子的么
      

  6.   

    这个格式可以放到CPropertyPage中,也是继承实现自己的Page,然后使用...