RichEditControl Item |
Post Reply |
Author | |
anp410g
Newbie Joined: 30 July 2020 Location: Moldova Status: Offline Points: 2 |
Post Options
Thanks(0)
Posted: 30 July 2020 at 6:42am |
Hi everyone,
I want to implement my own XTPReportRecordItem Class , that must behave as a RichEdit element ( The CRichEditCtrl (V 4.1) object is declared as a class member). But I got problems resizing the item. 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 .. } Is there any way to change the height of the row (also width of the column) in the control, so all the richedit content properly fits in the control ? I've tried to create my own PaintManager Class and overwrite the GetRowHeight Function and it worked , but all the rows get a common height ( actually I want all of them to have their own height ). |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |