Here , I've overwritten CXTPReportRecordItem::OnDrawCaption() , to initialize every item of the row.
void CXTPReportRecordItemRichControl::OnDrawCaption(XTP_REPORTRECORDITEM_DRAWARGS* pDrawArgs, XTP_REPORTRECORDITEM_METRICS* pMetrics)
{
if (!(pDrawArgs && pMetrics))
return;
//CXTPReportRecordItem::OnDrawCaption(pDrawArgs, pMetrics);
CWnd* pControlWnd = dynamic_cast<CWnd*>(pDrawArgs->pControl);
CRect rect = pDrawArgs->rcItem;
DWORD dwStyle = ES_MULTILINE | WS_CHILD | WS_VISIBLE /*| WS_MAXIMIZE*/;
EDITSTREAM es = { reinterpret_cast<DWORD_PTR>(m_strRTFStream.GetString()), NULL, StreamInCallback };
if (pControlWnd == nullptr)
return;
if (m_pRichCtrl == nullptr)
{
m_pRichCtrl = new CRichEditCtrl();
if (m_pRichCtrl->Create(dwStyle, rect, pControlWnd, IDS_ML_RICHEDITCTRL))
{
m_pRichCtrl->SetReadOnly();
m_pRichCtrl->SetFont(GetFont());
m_pRichCtrl->SetBackgroundColor(FALSE, GetBackgroundColor());
m_pRichCtrl->StreamIn(SF_RTF, es);
}
}
else
m_pRichCtrl->SetRect(rect);
//m_pRichCtrl->RequestResize(); // Not working..
m_nCurrRowSize = pDrawArgs->pControl->GetPaintManager()->CalculateRowHeight(m_pRichCtrl->GetDC(), m_strRTFStream, MAXINT) + 50; // Here I get the Real Height of RichControl after inserting RTF Data
//pDrawArgs->pDC->Rectangle(rect.left, rect.top, rect.right, rect.bottom + m_nCurrRowSize); // Not working ..
}