开发者

CMFCOutlookBarPane icons disappearing when dragging

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

CMFCOutlookBarTabCtrl* pOutlookBar = (CMFCOutlookBarTabCtrl*) m_wndContextBar.GetUnderlyi开发者_JS百科ngWindow();

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

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;
}

And the code follows:

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();

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?

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.

Thanks in advance for help, Sérgio


I ended doing

m_wndContextBar.SetMode2003();

before

m_wndContextBar.Create( ..... );

So, after doing that, the panels are not moveable outside, and the icon does not disappear. Not really a solution, but it works for now.


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();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜