Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - RichEditControl Item
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

RichEditControl Item

 Post Reply Post Reply
Author
Message
anp410g View Drop Down
Newbie
Newbie
Avatar

Joined: 30 July 2020
Location: Moldova
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote anp410g Quote  Post ReplyReply Direct Link To This Post Topic: RichEditControl Item
    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 ).
 

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.125 seconds.