Changing the size of Datepicker cells based on WTL

70 Views Asked by At

I am working on a datepicker named CDatePicker which is implemented as

class CDatePicker : public CWindowImpl<CDatePicker, WTL::CMonthCalendarCtrl >

I want to change the size of day rect, next button, previous buttons, etc. I found that the size of the rect is obtained from a call like this

SendMessage(m_CalCtrl.m_hWnd, MCM_GETCALENDARGRIDINFO, 0, (LPARAM) &gridInf)

But this fetches the size for me, so when I change the rect size for a custom paint, the control doesn't update and mouse hits don't get mapped to right cells.

I want to know how to change the size.

I have checked the msdn pages for MCM_GETCALENDARGRIDINFO, MCM_HITTEST and implemented as below.

OnPaint()
{
    // Init gridInfo
    SendMessage(MCM_GETCALENDARINFO, ....., &gridInfo);
    CRect rc = gridInfo.rc;

    ChangeRCSize(&rc);
    DrawStuff(rc, strCustomString);

    // Other stuff
}

This is what I have tried but this isn't updating the control and so mouse hits are not getting hit as it should be.

From my investigation it seems like the size of day cell is more of library based and we don't have control of it.

0

There are 0 best solutions below