【问题标题】:Mfc feature pack CMFCOutlookBar not showingMfc 功能包 CMFCOutlookBar 未显示
【发布时间】:2016-02-18 17:22:37
【问题描述】:

我正在使用 MFC 2010 开发一个 SDI 项目,使用“新”MFC 功能包来添加一些东西。

模板为我添加了日历栏和树栏,对我的应用程序非常无用。我删除了其中一些并用 CDialogEx 派生类替换了一个,一切正常。

现在,我确实想删除所有旧模板面板并使用我的,但是一旦我删除注释它的代码,整个控件将不再显示。

最糟糕的部分,如果我取消控制仍然不显示。有时,删除关联的注册表项只会让控件显示一次。

我会粘贴代码:

///////////////////////////////////////////> .H File
class CMainFrame : public CFrameWndEx
{
    DECLARE_DYNCREATE(CMainFrame)
    DECLARE_MESSAGE_MAP()
    protected:
         CCalendarBar           m_wndCalendar; //> Old pane
CEliCUTP140PannelloDlg* m_pPannelloDlg;        //> Derived from CDialogEx
CMFCMenuBar             m_wndMenuBar;
CMFCOutlookBar          m_wndBarraPannelli;    //> Outlook bar
CMFCOutlookBarPane*     m_pCurrOutlookPage;    //> Dunno what's for
CMFCOutlookBarTabCtrl*  m_pCurrOutlookWnd;     //> Same as above
CMFCShellTreeCtrl       m_wndTree;             //> Old pane
CMFCStatusBar           m_wndStatusBar;
CMFCToolBar             m_wndToolBar;
CMFCToolBarImages       m_UserImages;
//////////////////////////////////////////> .CPP file.
m_wndBarraPannelli.SetMode2003();
if (strTemp.LoadString(theApp.m_hRisorse, IDS_SHORTCUTS) == FALSE)
{
    m_Log.AddString(_T("CMainFrame::CreateOutlookBar - Impossibile caricare la stringa IDS_SHORTCUTS."));
    throw CGUIException(E_GE_IMP_CAR_STR);
}
dwOpzioni = WS_CHILD | WS_VISIBLE | CBRS_LEFT;
if (m_wndBarraPannelli.Create(strTemp, this, CRect(0, 0, nInitialWidth, 32000), uiID, dwOpzioni, AFX_CBRS_OUTLOOK_TABS) == FALSE)
    return FALSE;
dwStyle = AFX_CBRS_FLOAT | AFX_CBRS_AUTOHIDE | AFX_CBRS_RESIZE;
dwOpzioni = CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC;
m_wndBarraPannelli.SetPaneStyle(m_wndBarraPannelli.GetPaneStyle() | dwOpzioni);
m_wndBarraPannelli.SetButtonsFont(&afxGlobalData.fontBold);

pOutlookBar = (CMFCOutlookBarTabCtrl *)m_wndBarraPannelli.GetUnderlyingWindow();
if (pOutlookBar == NULL)
    return FALSE;
pOutlookBar->EnableInPlaceEdit(FALSE);
pOutlookBar->EnableAnimation(TRUE);
pOutlookBar->EnableScrollButtons();
pOutlookBar->SetBorderSize(1);
pOutlookBar->SetPageButtonTextAlign(TA_LEFT);

    /* the last panel which I'm trying to remove
    const DWORD             dwTreeStyle = WS_CHILD | WS_VISIBLE | TVS_HASLINES | TVS_LINESATROOT | TVS_HASBUTTONS;

    tree.Create(dwTreeStyle, rectDummy, pOutlookBar, 1200);
    if (strTemp.LoadString(theApp.m_hRisorse, IDS_FOLDERS) == FALSE)
    {
        m_Log.AddString(_T("CMainFrame::CreateOutlookBar - Impossibile caricare la stringa IDS_FOLDERS."));
        throw CGUIException(E_GE_IMP_CAR_STR);
    }
    pOutlookBar->AddControl(&tree, strTemp, 2, TRUE, dwStyle);**/

if (m_pPannelloDlg == NULL)
    m_pPannelloDlg = new CEliCUTP140PannelloDlg();
m_pPannelloDlg->m_pSuperParent = this;
bNameValid = m_pPannelloDlg->Create(IDD_ELICUTP140PANNELLODLG, &m_wndBarraPannelli);
m_pPannelloDlg->ShowWindow(SW_SHOW);
if (strTemp.LoadString(theApp.m_hRisorse, IDS_PAN_MOV) == FALSE)
{
    m_Log.AddString(_T("CMainFrame::CreateOutlookBar - Impossibile caricare la stringa IDS_PAN_MOV."));
    throw CGUIException(E_GE_IMP_CAR_STR);
}
pOutlookBar->AddControl(m_pPannelloDlg, strTemp, 0, TRUE, dwStyle);
m_wndBarraPannelli.ShowWindow(SW_SHOW);

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();
bAnimation = theApp.GetInt(_T("OutlookAnimation"), TRUE);
CMFCOutlookBarTabCtrl::EnableAnimation(bAnimation);

如果我应该粘贴额外的代码,请告诉我。 任何帮助表示赞赏。

【问题讨论】:

  • 您也可以发布头文件(.h)代码吗?需要知道这些变量的类类型。 m_wndBarraPannelli、tree 和 m_pPannelloDlg 专门
  • 代码已更新。我在某处读到 CDialogEx 不能用作面板,但文档说我可以使用任何 CWnd。老实说,我很困惑。

标签: visual-studio-2010 mfc visual-c++-2010 mfc-feature-pack


【解决方案1】:

对于那些对此问题感兴趣的人:

SOCIAL MSDN

这是带有答案的微软论坛的链接。版主可以关闭此主题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-10-26
    • 1970-01-01
    • 2021-03-12
    • 2015-08-30
    • 2011-06-27
    • 2010-10-04
    • 1970-01-01
    相关资源
    最近更新 更多