Print Page | Close Window

[solved] Second text line (ev note) rendered wrong

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Calendar
Forum Description: Topics Related to Codejock Calendar
URL: http://forum.codejock.com/forum_posts.asp?TID=23412
Printed Date: 26 April 2024 at 10:19am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: [solved] Second text line (ev note) rendered wrong
Posted By: Marco1
Subject: [solved] Second text line (ev note) rendered wrong
Date Posted: 09 August 2017 at 11:05am
After updating to latest v18.0.1 we have in the calendar:



Tested in your calendar demo sample.
The second line (event note) should not be rendered if it doesn't fit in the event cell. Really annoying with a lot of events. This happens in Office 2007 and 2010 themes.

Please fix this and posting of a short patch here would be very kind!
Thanx!



-------------
Product: XTP 18.3.0 on VS 2017
Platform: VS 2017 / Windows 10 (64bit)



Replies:
Posted By: Marco1
Date Posted: 17 August 2018 at 7:58am
This is still NOT fixed in 18.5.0 and still annoying.
Can you pls create a fix!
Or do I have to open a support request?



-------------
Product: XTP 18.3.0 on VS 2017
Platform: VS 2017 / Windows 10 (64bit)


Posted By: agontarenko
Date Posted: 27 August 2018 at 8:33am
Hello,

I'm glad to inform you that the issue has been addressed and fixed. The fix
will be available in the next beta or final release.
As hotfix you should be replace function as below:

CSize CXTPCalendarThemeOffice2007::DrawText_Auto2SL3ML(CDC* pDC,
        LPCTSTR pcszText1, LPCTSTR pcszText2, LPCTSTR pcszText3,
        CThemeFontColorSet* pFontColor1, CThemeFontColorSet* pFontColor2,
        CThemeFontColorSet* pFontColor3,
        CRect& rcRect, LPCTSTR pcszText1Separator, UINT uWordBreakMode)

{
    CXTPFontDC autoFont(pDC, pFontColor1->Font());
    CSize szSubject = pDC->GetTextExtent(pcszText1);

    autoFont.SetFont(pFontColor2->Font());
    CSize szLocation = pDC->GetTextExtent(pcszText2);

    autoFont.SetFont(pFontColor3->Font());
    CSize szBody = pDC->GetTextExtent(pcszText3);

    if ((szSubject.cy + szLocation.cy + XTP_DPI_Y(1)) > rcRect.Height())
    {
        CString strText1 = pcszText1;
        if (_tcslen(pcszText2) > 0)
        {
            strText1 += pcszText1Separator;
        }
        return DrawLine2_CenterLR(pDC, strText1, pcszText2, pFontColor1,
            pFontColor2, rcRect, DT_VCENTER | DT_LEFT, DT_VCENTER | DT_LEFT);
    }

    UINT uFormat = DT_NOPREFIX | DT_LEFT | DT_TOP | DT_EDITCONTROL | uWordBreakMode;
    CRect rcText(rcRect);
    int nHeight = 0;

    if (pcszText1 && _tcslen(pcszText1))
    {
        rcText.top = min(rcText.top, rcRect.bottom);
        if (rcRect.bottom - rcText.top >= szSubject.cy)
        {
            autoFont.SetFontColor(pFontColor1->Font(), pFontColor1->Color());
            int nSubjectHeight = pDC->DrawText(pcszText1, &rcText, uFormat);
            rcText.top += nSubjectHeight + szSubject.cy / 4;
            nHeight += nSubjectHeight + szSubject.cy / 4;
        }
    }

    if (pcszText2 && _tcslen(pcszText2))
    {
        rcText.top = min(rcText.top, rcRect.bottom);
        if (rcRect.bottom - rcText.top >= szLocation.cy)
        {
            autoFont.SetFontColor(pFontColor2->Font(), pFontColor2->Color());
            int nLocationHeight = pDC->DrawText(pcszText2, &rcText, uFormat);
            rcText.top += nLocationHeight + szLocation.cy / 4;
            nHeight += nLocationHeight + szLocation.cy / 4;
        }
    }

    if (pcszText3 && _tcslen(pcszText3))
    {
        rcText.top = min(rcText.top, rcRect.bottom);
        if (rcRect.bottom - rcText.top >= szBody.cy)
        {
            autoFont.SetFontColor(pFontColor3->Font(), pFontColor3->Color());
            int nBodyHeight = pDC->DrawText(pcszText3, &rcText, uFormat);
            rcText.top += nBodyHeight + szBody.cy / 4;
            nHeight += nBodyHeight + szBody.cy / 4;
        }
    }

    return CSize(rcRect.Width(), nHeight);
}

Regards,
Artem Gontarenko


Posted By: Marco1
Date Posted: 30 August 2018 at 11:54am
Hi Arte,

thanks a lot, your hotfix is working fine and solved the problem!

Best regards,
Marco



-------------
Product: XTP 18.3.0 on VS 2017
Platform: VS 2017 / Windows 10 (64bit)



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