mercredi 6 mai 2015

How to display highlight of CDockablePane when dragging in MFC

I create a CMDI project with MainFrame and ChildFrame. Then, I add a derived class called CThumbnailPane inherited from CDockablePane inside CChildFrame (it is mandatory)

BOOL CChildFrame::CreateThumbnailPane(void)
{
    SChildFrame* member = (SChildFrame*)m;
    ASSERT(member);

    CRect r(0, 0, 150, 150);
    if (!member->m_NoteThumbnailPane.CreateEx(NULL, _T("ThumbnailPane"), this, r, TRUE, VIEWID_NOTE_THUMBNAIL_PANE, 
        WS_CHILD | WS_CLIPCHILDREN | CBRS_LEFT | CBRS_RIGHT))
    {
        return FALSE;
    }

    member->m_NoteThumbnailPane.SetMinSize(CSize(100, 100));
    member->m_NoteThumbnailPane.EnableDocking(CBRS_ALIGN_ANY);

    //show at first
    ShowToolPane(TRUE,TRUE);

    return TRUE;
}

void CChildFrame::ShowToolPane(BOOL bShow, BOOL bFirst)
{
    SChildFrame* member = (SChildFrame*)m;
    ASSERT(member);

    if (member->m_NoteThumbnailPane.GetSafeHwnd() == NULL)
        return;

    if (bShow)
    {
        if (member->isFirstDisplayThumbnail == TRUE)
        {
            member->m_NoteThumbnailPane.ShowPane(TRUE, FALSE, TRUE);
            member->m_NoteThumbnailPane.DockToFrameWindow(CBRS_ALIGN_BOTTOM);
            member->isFirstDisplayThumbnail = FALSE;
        }
        else
        {
            member->m_NoteThumbnailPane.DockToRecentPos();
            member->m_NoteThumbnailPane.ShowPane(TRUE, FALSE, TRUE);
        }
    }
    else
    {
        member->m_NoteThumbnailPane.ShowPane(FALSE, FALSE, FALSE);      
    }   
}

In order to adjust the layout of the pane, I use CSmartDockingManager:

{
    CSmartDockingManager* sdManager = m_pDockManager->GetSmartDockingManager();
    sdManager->OnPosChange();
    AFXGetParentFrame(this)->RecalcLayout();
}

=>Everything goes well BUT only 4 individual direction buttons is not ok because It does not highlight the pane location when I drag the pane such as the center group buttons

Could you guide me how to display highlight of the pane when dragging OR hide 4 individual direction buttons ?

Aucun commentaire:

Enregistrer un commentaire