2011-05-19 97 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(.....); 

所以,这样做后,该板是不可移动外,图标不会消失。不是一个真正的解决方案,但它现在可行。