Je développe un projet SDI avec MFC 2010 en utilisant le «nouveau» pack de fonctions MFC pour ajouter des éléments.Pack de fonctions Mfc CMFCOutlookBar ne pas afficher
Le modèle m'a ajouté la barre de calendrier et la barre d'arbre, pas très utile pour mon application. J'ai supprimé certains d'entre eux et remplacé un avec une classe dérivée de CDialogEx et tout fonctionne bien.
Maintenant, je veux définitivement enlever tout l'ancien panneau de gabarit et utiliser des mines, mais dès que j'enlèverai le code le commentant, tout le contrôle ne s'affichera plus.
Pire partie, si je décomprime le contrôle ne montre toujours pas. Parfois, la suppression de la clé de registre associée permet au contrôle de s'afficher pour une seule exécution.
Je vais coller le code:
///////////////////////////////////////////> .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);
Si je dois coller du code supplémentaire laissez-moi savoir. Toute aide appréciée.
pouvez-vous publier le code de fichier en-tête (.h) également? besoin de connaître les types de classe de ces variables. m_wndBarraPannelli, tree, et m_pPannelloDlg spécifiquement – diox8tony
Le code a été mis à jour. J'ai lu quelque part que CDialogEx ne peut pas être utilisé comme panneau, mais la documentation dit que je peux utiliser n'importe quel CWnd. Honnêtement, je suis confus. – IssamTP