Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Calendar
  New Posts New Posts RSS Feed - [solved] Second text line (ev note) rendered wrong
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

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

 Post Reply Post Reply
Author
Message
Marco1 View Drop Down
Senior Member
Senior Member


Joined: 16 January 2004
Location: Germany
Status: Offline
Points: 242
Post Options Post Options   Thanks (0) Thanks(0)   Quote Marco1 Quote  Post ReplyReply Direct Link To This Post Topic: [solved] Second text line (ev note) rendered wrong
    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)
Back to Top
Marco1 View Drop Down
Senior Member
Senior Member


Joined: 16 January 2004
Location: Germany
Status: Offline
Points: 242
Post Options Post Options   Thanks (0) Thanks(0)   Quote Marco1 Quote  Post ReplyReply Direct Link To This Post 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)
Back to Top
agontarenko View Drop Down
Admin Group
Admin Group


Joined: 25 March 2016
Status: Offline
Points: 98
Post Options Post Options   Thanks (0) Thanks(0)   Quote agontarenko Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Marco1 View Drop Down
Senior Member
Senior Member


Joined: 16 January 2004
Location: Germany
Status: Offline
Points: 242
Post Options Post Options   Thanks (0) Thanks(0)   Quote Marco1 Quote  Post ReplyReply Direct Link To This Post 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)
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down



This page was generated in 0.090 seconds.