Hi! Yes it works :-)
Have a look at: Samples\CommandBars\DialogSample\DialogSampleDlg.cpp(197)
I can send you some snippets :-)
derive your dialog from
CXTPDialogBase<CXTResizeDialog>
in OnInitDialog create your commandbars
// Initialize the command bars
if(!InitCommandBars())
{
return -1;
}
// Get a pointer to the command bars object.
CXTPCommandBars* pCommandBars = GetCommandBars();
if(pCommandBars == NULL)
{
return -1; // fail to create
}
then create your ribbon:
CXTPRibbonBar* pRibbonBar = (CXTPRibbonBar*)pCommandBars->Add(_T(""), xtpBarTop, RUNTIME_CLASS(CXTPRibbonBar));
if (!pRibbonBar)
{
return FALSE;
}
pRibbonBar->EnableDocking(0);
pRibbonBar->EnableCustomization(FALSE); ... CXTPRibbonTab* pTabBase = pRibbonBar->AddTab( CMfxString(IDS_RIBBON_START) ); ...
you will nedd a helper
//---------------------------------------------------------------------------------------
void CDlgMailNew::RepositionControls()
//---------------------------------------------------------------------------------------
{
if (m_bInRepositionControls)
return;
CRect rcClientStart;
GetClientRect(rcClientStart);
if ((GetStyle() & WS_MINIMIZE) || (rcClientStart.IsRectEmpty()))
return;
m_bInRepositionControls = TRUE;
CRect rcClientNow;
RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0, reposQuery, rcClientNow);
CRect rcBorders(rcClientNow.left - rcClientStart.left, rcClientNow.top - rcClientStart.top, rcClientStart.right - rcClientNow.right,
rcClientStart.bottom - rcClientNow.bottom);
if (rcBorders != m_rcBorders)
{
CPoint ptOffset(rcBorders.left - m_rcBorders.left, rcBorders.top - m_rcBorders.top);
CSize szOffset(rcBorders.left + rcBorders.right - m_rcBorders.left - m_rcBorders.right,
rcBorders.top + rcBorders.bottom - m_rcBorders.top - m_rcBorders.bottom);
m_ptRepositionOffset = ptOffset;
CRect rcWindow;
GetWindowRect(rcWindow);
rcWindow.BottomRight() += szOffset;
Offset(ptOffset);
m_szWindow += szOffset;
m_szMin += szOffset;
MoveWindow(rcWindow, TRUE);
}
m_rcBorders = rcBorders;
RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0);
m_bInRepositionControls = FALSE;
}
----
call this helper in OnSize and in OnInitDialog
:-)
|