小男孩‘自慰网亚洲一区二区,亚洲一级在线播放毛片,亚洲中文字幕av每天更新,黄aⅴ永久免费无码,91成人午夜在线精品,色网站免费在线观看,亚洲欧洲wwwww在线观看

分享

VS2008 Outlookbar 介紹

 Frank_Chia 2010-07-16

Introduction

This article helps to add a CMFCOutlookbar in CSplitterWnd panes. The above image shows an Office 2007 type UI that is available with Visual Studio 2008 and the MFC feature pack. Refer this link for more details: Visual C++ 2008 Feature Pack: MFC Enhancements.

Using the code

By default, the CMFCOutlookBar in the Office 2007 UI generated code is embedded in a CFrameWnd derived class. Here, we will discuss about adding a CMFCOutlookBar in CSplitterWnd/CSplitterWndEx panes.

BOOL COffice2007Frame::OnCreateClient(LPCREATESTRUCT /*lpcs*/,
    CCreateContext* pContext)
    {
    BOOL bRet=true;
    bRet=bRet&m_wndSplitter.CreateStatic(this,2,2);
    CRect rectClient;
    this->GetClientRect(&rectClient);
    bRet=bRet&m_wndSplitter.CreateView(0,0,RUNTIME_CLASS(CMFCOutlookBar),
    CSize(rectClient.Width()/4,rectClient.Height()/2),pContext);
    bRet=bRet&m_wndSplitter.CreateView(0,1,RUNTIME_CLASS(COffice2007View),
    CSize(rectClient.Width()*3/4,rectClient.Height()/2),pContext);
    bRet=bRet&m_wndSplitter.CreateView(1,0,RUNTIME_CLASS(COffice2007View),
    CSize(rectClient.Width()/4,rectClient.Height()/2),pContext);
    bRet=bRet&m_wndSplitter.CreateView(1,1,RUNTIME_CLASS(COffice2007View),
    CSize(rectClient.Width()*3/4,rectClient.Height()/2),pContext);
    return bRet;
    }

This above code divides the splitter window in four unequal panes. During the creation of the view in the first pane, a CMFCOutlookBar runtime pointer is given, so it will create an OutlookBar in the first pane.

CMFCOutlookBar* pPane_0_0=(CMFCOutlookBar*)m_wndSplitter.GetPane(0,0);
    pPane_0_0->GetParent()->ModifyStyle(WS_CHILDWINDOW,WS_CHILDWINDOW|
    WS_CLIPCHILDREN,SWP_DRAWFRAME);

In the above code, we take the pointer of the OutlookBar using the GetPane function and modify the properties of the splitter parent pane to add the WS_CLIPCHILDREN property. If we don't add this property, then on focus change, the splitter window pane will over-paint the OutlookBar.

By changing this property, it creates a problem of debug assertion fail in the Debug compile mode. To solve this problem, derive the class CSplitterWndEx and override the function OnInvertTracker().

void CDSplitterWndEx::OnInvertTracker(const CRect& rect )
    {
    this->GetPane(0,0)->GetParent()->ModifyStyle(WS_CLIPCHILDREN,
    0,SWP_DRAWFRAME);
    this->GetPane(0,1)->GetParent()->ModifyStyle(WS_CLIPCHILDREN,
    0,SWP_DRAWFRAME);
    this->GetPane(1,0)->GetParent()->ModifyStyle(WS_CLIPCHILDREN,
    0,SWP_DRAWFRAME);
    this->GetPane(1,1)->GetParent()->ModifyStyle(WS_CLIPCHILDREN,
    0,SWP_DRAWFRAME);
    CSplitterWndEx::OnInvertTracker(rect); //Base class
    this->GetPane(0,0)->GetParent()->ModifyStyle(0,
    WS_CLIPCHILDREN,SWP_DRAWFRAME);
    this->GetPane(0,1)->GetParent()->ModifyStyle(0,
    WS_CLIPCHILDREN,SWP_DRAWFRAME);
    this->GetPane(1,0)->GetParent()->ModifyStyle(0,
    WS_CLIPCHILDREN,SWP_DRAWFRAME);
    this->GetPane(1,1)->GetParent()->ModifyStyle(0,
    WS_CLIPCHILDREN,SWP_DRAWFRAME);
    }

The above code removes the WS_CLIPCHILDREN property of each pane before calling OnInverTracker to escape from a debug assertion fail, and then again adds the property back to each pane.

Points of Interest

This code is particularly useful for those who want to modify the MFC Outlook 2008 in their own way. This just demonstrates how to add a CMFCOutlookBar in a SplitterWnd pane in place of the default main frame window.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶(hù)發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買(mǎi)等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶(hù) 評(píng)論公約

    類(lèi)似文章 更多