Visual c++ CMFCOutlookBarPane图标在拖动时消失 创建的CMFcOutlook BARTABCTRL CMFCOutlookBarTabCtrl* pOutlookBar = (CMFCOutlookBarTabCtrl*) m_wndContextBar.GetUnderlyingWindow();
其中wndContextBar是一个CMyOutlookBar,它是从CMFCookBar派生的类I 我还在下面的if中创建了3个CMFCoutlookBarPane:Visual c++ CMFCOutlookBarPane图标在拖动时消失 创建的CMFcOutlook BARTABCTRL CMFCOutlookBarTabCtrl* pOutlookBar = (CMFCOutlookBarTabCtrl*) m_wndContextBar.GetUnderlyingWindow();,visual-c++,outlook,icons,imagelist,Visual C++,Outlook,Icons,Imagelist,其中wndContextBar是一个CMyOutlookBar,它是从CMFCookBar派生的类I 我还在下面的if中创建了3个CMFCoutlookBarPane: 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_AU
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栏中的另一个位置时,它的图标消失了
那么,拖动后图像可见的解决方案是什么
旁注:拖动时,窗格会暂时进入未锁定状态,其标题栏较短且没有图标,这在我看来并不正确。真正令人恼火的是,当窗格被重新标记时,会返回到其原始高度(如expexted),但图标不会显示
提前感谢您的帮助,
塞尔吉奥我结束了这项工作
m_wndContextBar.SetMode2003();
以前
m_wndContextBar.Create( ..... );
因此,执行此操作后,面板不能在外部移动,图标也不会消失。虽然不是一个真正的解决方案,但它目前仍然有效。又不是一个真正的解决方案,但我已经成功锁定了面板的位置,而没有使用模式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();