2011-05-19 25 views
0

在Visual C++時消失,我已經與創建的CMFCOutlookBarTabCtrl:CMFCOutlookBarPane圖標拖動

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

其中wndContextBar是CMyOutlookBar即是I類從CMFCOutlookBar

衍生

我也有3個CMFCOutlookBarPanes我內若跌破創建:

DWORD dwPaneStyle = AFX_DEFAULT_TOOLBAR_STYLE | CBRS_FLOAT_MULTI; 

// can float, can autohide, can resize, CAN NOT CLOSE 
DWORD dwStyle = AFX_CBRS_FLOAT | AFX_CBRS_AUTOHIDE | AFX_CBRS_RESIZE | CBRS_GRIPPER; 

if (!m_wndPane0.Create(&m_wndContextBar, dwPaneStyle, PANE0_ID, dwStyle) || 
    !m_wndPane1.Create(&m_wndContextBar, dwPaneStyle, PANE1_ID, dwStyle) || 
    !m_wndPane2.Create(&m_wndContextBar, dwPaneStyle, PANE2_ID, dwStyle)) 
    ) 
{ 
    ASSERT(FALSE); 
    return FALSE; 
} 

,代碼如下:

m_wndPane0.SetOwner(this); 
m_wndPane1.SetOwner(this); 
m_wndPane2.SetOwner(this); 
m_wndPane0.EnableTextLabels(); 
m_wndPane1.EnableTextLabels(); 
m_wndPane2.EnableTextLabels(); 

m_wndPane0.EnableDocking(CBRS_ALIGN_ANY); 
m_wndPane1.EnableDocking(CBRS_ALIGN_ANY); 
m_wndPane2.EnableDocking(CBRS_ALIGN_ANY); 

    [....]//Code for adding buttons inside the panes, it is irrelevant for this discussion 

pOutlookBar->SetImageList(IDB_CONTEXT_ICONS, 32, RGB(255,255,255)); 

sTitle.LoadString(IDS_PANE0); 
pOutlookBar->AddControl(&m_wndPane0, sTitle, 0, TRUE, dwStyle); 
m_wndPane0.EnableDocking(CBRS_ALIGN_ANY); 
m_wndPane0.SetDefaultState(); 

sTitle.LoadString(IDS_PANE1); 
pOutlookBar->AddControl(&m_wndPane1, sTitle, 1, TRUE, dwStyle); 
m_wndPane1.EnableDocking(CBRS_ALIGN_ANY); 
m_wndPane1.SetDefaultState(); 

sTitle.LoadString(IDS_PANE2); 
pOutlookBar->AddControl(&m_wndPane2, sTitle, 2, TRUE, dwStyle); 
m_wndPane2.EnableDocking(CBRS_ALIGN_ANY); 
m_wndPane2.SetDefaultState(); 

m_wndContextBar.SetPaneStyle(m_wndContextBar.GetPaneStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC); 
m_wndContextBar.FillDefaultTabsOrderArray(); 

pOutlookBar->EnableTabSwap(TRUE); 

CMFCOutlookBarTabCtrl::EnableAnimation(TRUE); 

UpdateMDITabbedBarsIcons(); 

我定義圖標將出現在上面的SetImageList行的窗格上。當我創建工具欄時,一切正常。但是,當我嘗試將其中一個窗格拖到Outlook欄中的其他位置時,其圖標消失。

那麼,拖動後圖像可見的解決方案是什麼?

備註:拖動時,窗格會暫時通過一個未連接的狀態,其標題欄較短且沒有圖標,這對我來說似乎不正確。真正令人惱火的是,當窗格被重新鎖定到返回到原始高度的時候,這個圖標並沒有顯示出來。

預先感謝幫助, 塞爾吉奧

回答

0

不是一個真正的解決方案了,但我已經成功地擁有面板「位置鎖定」,而不具備模式2003:

CString sTitle; 
sTitle.LoadString(IDS_CONTEXT); 

//m_wndContextBar.SetMode2003(); 
if (!m_wndContextBar.Create(sTitle, this, CRect(0, 0, 150, 400), CONTEXT_TAB_ID, 
          WS_CHILD|WS_VISIBLE|CBRS_LEFT/*|CBRS_GRIPPER*/, 
          AFX_CBRS_RESIZE|AFX_CBRS_CLOSE|AFX_CBRS_AUTOHIDE/*|AFX_CBRS_FLOAT*/)) 
{ 
    ASSERT(FALSE); 
    return FALSE; 
} 

CMFCOutlookBarTabCtrl* pOutlookBar = (CMFCOutlookBarTabCtrl*) m_wndContextBar.GetUnderlyingWindow(); 
if (!pOutlookBar) 
{ 
    ASSERT(FALSE); 
    return FALSE; 
} 

DWORD dwPaneStyle = AFX_DEFAULT_TOOLBAR_STYLE; 
DWORD dwStyle = NULL; 

if (!m_wndPane0.Create(&m_wndContextBar, dwPaneStyle, PANE0_ID, dwStyle) || 
    !m_wndPane1.Create(&m_wndContextBar, dwPaneStyle, PANE1_ID, dwStyle) || 
    !m_wndPane2.Create(&m_wndContextBar, dwPaneStyle, PANE2_ID, dwStyle)) 
{ 
    ASSERT(FALSE); 
    return FALSE; 
} 

m_wndPane0.SetOwner(this); 
m_wndPane1.SetOwner(this); 
m_wndPane2.SetOwner(this); 
m_wndPane0.EnableTextLabels(); 
m_wndPane1.EnableTextLabels(); 
m_wndPane2.EnableTextLabels(); 

m_wndPane0.EnableDocking(CBRS_ALIGN_TOP); 
m_wndPane1.EnableDocking(CBRS_ALIGN_TOP); 
m_wndPane2.EnableDocking(CBRS_ALIGN_TOP); 

[...] //代碼裏面添加按鈕窗格,這與討論無關

pOutlookBar->SetImageList(IDB_CONTEXT_ICONS, 32, RGB(255,255,255)); 

sTitle.LoadString(IDS_PANE0); 
pOutlookBar->AddControl(&m_wndPane0, sTitle, 0, TRUE, dwStyle); 
m_wndPane0.SetDefaultState(); 

sTitle.LoadString(IDS_PANE1); 
pOutlookBar->AddControl(&m_wndPane1, sTitle, 1, TRUE, dwStyle); 
m_wndPane1.SetDefaultState(); 

sTitle.LoadString(IDS_PANE2); 
pOutlookBar->AddControl(&m_wndPane2, sTitle, 2, TRUE, dwStyle); 
m_wndPane2.SetDefaultState(); 


m_wndContextBar.SetPaneStyle(m_wndContextBar.GetPaneStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC); 
m_wndContextBar.FillDefaultTabsOrderArray(); 

pOutlookBar->EnableTabSwap(FALSE); 
pOutlookBar->EnableTabDetach(0,FALSE); 
pOutlookBar->EnableTabDetach(1,FALSE); 
pOutlookBar->EnableTabDetach(2,FALSE); 
//pOutlookBar->EnableTabDetach(3,FALSE); 

CMFCOutlookBarTabCtrl::EnableAnimation(TRUE); 

UpdateMDITabbedBarsIcons(); 
0

我最後做

m_wndContextBar.SetMode2003(); 

m_wndContextBar.Create(.....); 

所以,這樣做後,該板是不可移動外,圖標不會消失。不是一個真正的解決方案,但它現在可行。