예제 #1
0
void CDxDatePickerMonth::Draw(CDCHandle dc)
{
    // draw header
    DrawMonthHeader(dc);

    // draw days of week
    DrawDaysOfWeek(dc);

    //  draw all days
    int nDaysCount = GetDayCount();
    for (int nIndex = 0; nIndex < nDaysCount; nIndex++)
    {
        CDxDatePickerDay* pDay = GetDay(nIndex);
        pDay->Draw(dc);
    }
}
예제 #2
0
/////////////////////////////////////////////////////////////////////////////
// CMiniCalendarCtrl message handlers
//
void CMiniCalendarCtrl::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	CMemDC dcDraw(&dc);

	if (!m_bSizeComputed)
		ComputeSize();

	CRect rcClient;
	GetClientRect(rcClient);

	dcDraw.FillSolidRect(0, 0, rcClient.Width(), rcClient.Height(), m_cBackColor);

	int iY = 0;
	int iMonth = m_iCurrentMonth;
	int iYear = m_iCurrentYear;

	// draw each row individually
	for (int iRow = 1; iRow <= m_iRows; iRow++)
	{		
		int iCurrentX = 0;
		int iCurrentY = iY;

		iCurrentY += DrawHeader(dcDraw, iCurrentY, iCurrentX, iRow, iMonth, iYear);
		iCurrentY += DrawDaysOfWeek(dcDraw, iCurrentY, iCurrentX, iRow);
		iCurrentY += DrawDays(dcDraw, iCurrentY, iCurrentX, iRow, iMonth, iYear);
		iCurrentX += m_szMonthSize.cx;

		iMonth++;
		if (iMonth > 12)
		{
			iMonth = 1;
			iYear++;
		}

		iY += m_szMonthSize.cy;
	}
}