注册 登录
编程论坛 VC++/MFC

VS2010 默认单文档OutlookBar的设置问题

gx1536603998 发布于 2015-07-13 12:59, 3583 次点击
只有本站会员才能查看附件,请 登录

BOOL CMainFrame::CreateOutlookBar(CMFCOutlookBar& bar, UINT uiID, CMFCShellTreeCtrl& tree, CCalendarBar& calendar, int nInitialWidth)
{
    bar.SetMode2003();

    BOOL bNameValid;
    CString strTemp;
    bNameValid = strTemp.LoadString(IDS_SHORTCUTS);
    ASSERT(bNameValid);
    if (!bar.Create(strTemp, this, CRect(0, 0, nInitialWidth, 32000), uiID, WS_CHILD | WS_VISIBLE | CBRS_LEFT))
    {
        return FALSE; // 未能创建
    }

    CMFCOutlookBarTabCtrl* pOutlookBar = (CMFCOutlookBarTabCtrl*)bar.GetUnderlyingWindow();

    if (pOutlookBar == NULL)
    {
        ASSERT(FALSE);
        return FALSE;
    }

    pOutlookBar->EnableInPlaceEdit(TRUE);

    static UINT uiPageID = 1;

    // 可浮动,可自动隐藏,可调整大小,但不能关闭
    DWORD dwStyle = AFX_CBRS_FLOAT | AFX_CBRS_AUTOHIDE | AFX_CBRS_RESIZE;

    CRect rectDummy(0, 0, 0, 0);
    const DWORD dwTreeStyle = WS_CHILD | WS_VISIBLE | TVS_HASLINES | TVS_LINESATROOT | TVS_HASBUTTONS;

    tree.Create(dwTreeStyle, rectDummy, &bar, 1200);
    bNameValid = strTemp.LoadString(IDS_FOLDERS);
    ASSERT(bNameValid);
    pOutlookBar->AddControl(&tree, strTemp, 2, TRUE, dwStyle);

    calendar.Create(rectDummy, &bar, 1201);
    bNameValid = strTemp.LoadString(IDS_CALENDAR);
    ASSERT(bNameValid);
    pOutlookBar->AddControl(&calendar, strTemp, 3, TRUE, dwStyle);

    bar.SetPaneStyle(bar.GetPaneStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);

    pOutlookBar->SetImageList(theApp.m_bHiColorIcons ? IDB_PAGES_HC : IDB_PAGES, 24);
    pOutlookBar->SetToolbarImageList(theApp.m_bHiColorIcons ? IDB_PAGES_SMALL_HC : IDB_PAGES_SMALL, 16);
    pOutlookBar->RecalcLayout();

    BOOL bAnimation = theApp.GetInt(_T("OutlookAnimation"), TRUE);
    CMFCOutlookBarTabCtrl::EnableAnimation(bAnimation);

    bar.SetButtonsFont(&afxGlobalData.fontBold);

    return TRUE;
}
通过什么函数能对导航栏选项进行更改。比如添加选项,在选项中能修改图标、名称等
2 回复
#2
gx15366039982015-07-13 12:59
纠结好几天的问题了。真的很急。求大神帮忙。
#3
gx15366039982015-07-13 18:37
这个论坛都没人的吗?
1