Print Page | Close Window

RichEditControl Item

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=24031
Printed Date: 22 December 2024 at 6:37pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: RichEditControl Item
Posted By: anp410g
Subject: RichEditControl Item
Date 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 ).
 




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net