拖动时CMFCOutlookBarPane图标消失 [英] CMFCOutlookBarPane icons disappearing when dragging

查看:250
本文介绍了拖动时CMFCOutlookBarPane图标消失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Visual C ++中,我有一个CMFCOutlookBarTabCtrl,它是用以下代码创建的:

In Visual C++, I have a CMFCOutlookBarTabCtrl that has been created with:

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

其中wndContextBar是一个CMyOutlookBar,它是从CMFCOutlookBar派生的类

where wndContextBar is a CMyOutlookBar that is a class I derived from CMFCOutlookBar

我还在下面的if中创建了3个CMFCOutlookBarPanes:

I also have the 3 CMFCOutlookBarPanes I create within the if below:

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栏内的另一个位置时,它的图标就会消失。

I define that icons will be appearing on the panes with the SetImageList line above. When I create the Toolbar everything is OK. But when I try to drag one of the Panes to another position inside the Outlook bar, its icon disappears.

那么,图像的解决方案是什么?拖动?

So, what is the solution for the image to be visible after dragging?

旁注:当拖动时,窗格暂时传递到它未对接的状态,其标题栏较短且没有图标,似乎不显示对我不对。真正令人恼火的是,当Pane被重新锁定时,返回到原来的高度,但是图标没有显示。

Side note: When dragging, the Pane passes temporarily to a state where it is undocked, where its title bar is shorter and has no icon, which does not seem incorrect to me. What is really irritating is when the Pane is redocked the returns to its original height as expexted, but the icon isn't shown.

预先感谢您的帮助,$ b $bSérgio

Thanks in advance for help, Sérgio

推荐答案

不是真正的解决方案,但我设法让面板锁定位置而没有模式2003:

Not really a solution again, but I've managed to have the panels "position-locked" without having the mode 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);

[....] //在窗格内添加按钮的代码,与此无关讨论

[....]//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.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();

这篇关于拖动时CMFCOutlookBarPane图标消失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆