![]() |
problems printing dayview (bug?) |
Post Reply ![]() |
Author | |
Alex H. ![]() Senior Member ![]() ![]() Joined: 12 February 2004 Status: Offline Points: 266 |
![]() ![]() ![]() ![]() ![]() Posted: 24 October 2008 at 6:03am |
The day view will be cropped when printing.
How can i fix the problem? Any patch available? Please see picture of print preview: and here is the screenshot of the view (control): |
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hi,
Run our sample, click Page Setup and change Print Range.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
prashant ![]() Senior Member ![]() ![]() Joined: 19 February 2007 Location: India Status: Offline Points: 165 |
![]() ![]() ![]() ![]() ![]() |
Hi Oleg,
In the print preview image you can see one month "Oct 2008", I wish to add 2 more months, Sept 2008 and Nov 2008. How to do that? Is it possible? |
|
![]() |
|
mdoubson ![]() Senior Member ![]() ![]() Joined: 17 November 2008 Status: Offline Points: 1705 |
![]() ![]() ![]() ![]() ![]() |
![]() |
|
![]() |
|
prashant ![]() Senior Member ![]() ![]() Joined: 19 February 2007 Location: India Status: Offline Points: 165 |
![]() ![]() ![]() ![]() ![]() |
Thanks for reply but what I want to achieve is:
Irrespective of days selected in calendar control, I wanted to show 3 months on date header in print preview. (Previous month, current month and next month.) |
|
![]() |
|
mdoubson ![]() Senior Member ![]() ![]() Joined: 17 November 2008 Status: Offline Points: 1705 |
![]() ![]() ![]() ![]() ![]() |
You can't do it youself but I can add extra option in
CXTPCalendarPageSetupDialog (current logic, always 1 small calendar, always 2 small calendars, always 3 small calendars) - be in Feb release 13 |
|
![]() |
|
mdoubson ![]() Senior Member ![]() ![]() Joined: 17 November 2008 Status: Offline Points: 1705 |
![]() ![]() ![]() ![]() ![]() |
What do you want to show in the case DatePicker selection covered 5 months - now it show 1st and 5th |
|
![]() |
|
mdoubson ![]() Senior Member ![]() ![]() Joined: 17 November 2008 Status: Offline Points: 1705 |
![]() ![]() ![]() ![]() ![]() |
![]() |
|
![]() |
|
prashant ![]() Senior Member ![]() ![]() Joined: 19 February 2007 Location: India Status: Offline Points: 165 |
![]() ![]() ![]() ![]() ![]() |
That really sounds great
![]() My opinion is, we should have logic as follows: Case 1) If more than one month selected then show number of months selected Case 2) If dates ranging for one month only then add Previous and Next month alongwith current month Another Idea: Give option to user (Check box in Calendar page setup) "Display Next and Previous month" |
|
![]() |
|
mdoubson ![]() Senior Member ![]() ![]() Joined: 17 November 2008 Status: Offline Points: 1705 |
![]() ![]() ![]() ![]() ![]() |
see result
|
|
![]() |
|
prashant ![]() Senior Member ![]() ![]() Joined: 19 February 2007 Location: India Status: Offline Points: 165 |
![]() ![]() ![]() ![]() ![]() |
See Result??
I didn't understand..please explain. |
|
![]() |
|
mdoubson ![]() Senior Member ![]() ![]() Joined: 17 November 2008 Status: Offline Points: 1705 |
![]() ![]() ![]() ![]() ![]() |
uploads/20090115_113916_CalendarUpdates.rar
![]() Default - 3 (only for 1 month or less selection) other case - old logic
|
|
![]() |
|
prashant ![]() Senior Member ![]() ![]() Joined: 19 February 2007 Location: India Status: Offline Points: 165 |
![]() ![]() ![]() ![]() ![]() |
Ok great, Nice work, thanks :)
When shall I expect release 13? What you have added? Whether you gave option to user? or by default you are showing Next , Current and Previous month? Thanks again. |
|
![]() |
|
prashant ![]() Senior Member ![]() ![]() Joined: 19 February 2007 Location: India Status: Offline Points: 165 |
![]() ![]() ![]() ![]() ![]() |
Mark,
Can you please send me modified files for Calendar Print Preview issue? I already mailed you / Oleg at support@codejock.com Thanks. |
|
![]() |
|
mdoubson ![]() Senior Member ![]() ![]() Joined: 17 November 2008 Status: Offline Points: 1705 |
![]() ![]() ![]() ![]() ![]() |
uploads/20090115_122129_Resource.rar
Look in one of previous the post in the begining of post - I attached files there
You need update files form CalendarUpdates.rar into Source\Calendar
from Resource.rar - resource.h going to Source\Calendar
Resource.rc - into Source\Calendar\res
|
|
![]() |
|
prashant ![]() Senior Member ![]() ![]() Joined: 19 February 2007 Location: India Status: Offline Points: 165 |
![]() ![]() ![]() ![]() ![]() |
Hi Mark,
Code is ok. Just reverse the display sequence to: ( Previous - Current - Next ) i.e. Dec - Jan - Feb Current sequence is:- ( Next - Current - Previous ) i.e. Feb - Jan - Dec Also as discussed try to add "Page Setup" button on Print preview Toolbar. (Same as Outlook), please see attached image: |
|
![]() |
|
mdoubson ![]() Senior Member ![]() ![]() Joined: 17 November 2008 Status: Offline Points: 1705 |
![]() ![]() ![]() ![]() ![]() |
I implemented RTL - NonRTL 3 small calendars in Page header function - this is updated code:
void CXTPCalendarControlView::DrawDateHeader(BOOL bCalculate, CDC* pDC,CXTPCalendarControlViewPrintOptions* pOptions, CRect& rrcHeader) { COleDateTime dtYearMonth1, dtYearMonth2; CString strHeader1, strHeader2, strHeaderWeekDay; int nMonths = _GetDateHeaderMonths(dtYearMonth1, dtYearMonth2, strHeader1, strHeader2, strHeaderWeekDay); if (!strHeader2.IsEmpty())strHeader1 += _T( " -");CRect rcCalendar1 = rrcHeader; CRect rcCalendar2(0, 0, 0, 0); CRect rcCalendar3(0, 0, 0, 0); BOOL bRTL = FALSE; if (GetCalendarCtrl().GetExStyle() & WS_EX_LAYOUTRTL)bRTL = TRUE; int iYear = dtYearMonth1.GetYear(); int iMonth = dtYearMonth1.GetMonth(); if (nMonths == 1 && pOptions->m_b3SmallCal){ if (bRTL){ if (iMonth > 1)iMonth--; else{ iMonth = 12; iYear--; } dtYearMonth1.SetDateTime(iYear, iMonth, 1,0,0,0); } else{ if (iMonth < 12)iMonth++; else{ iMonth = 1; iYear++; } dtYearMonth1.SetDateTime(iYear, iMonth, 1,0,0,0); } } _DrawDateHeaderCalendar(TRUE, pDC, pOptions, dtYearMonth1, rcCalendar1); int nCalendar1XPos = rrcHeader.right - rcCalendar1.Width() * 11/10; int nCalendar2XPos = nCalendar1XPos;CFont fntDateHeader; VERIFY( fntDateHeader.CreateFontIndirect(&pOptions->m_lfDateHeaderFont) ); CXTPFontDC fntDC(pDC, &fntDateHeader); CSize sizeText = pDC->GetTextExtent(strHeader1); CFont fntDateHeaderWeekDay; VERIFY( fntDateHeaderWeekDay.CreateFontIndirect(&pOptions->m_lfDateHeaderWeekDayFont) ); fntDC.SetFont(&fntDateHeaderWeekDay); CSize sizeTextWD = pDC->GetTextExtent(_T( "WD"), 2); int nDatesCaptionHeight = sizeText.cy * 225/100 + sizeTextWD.cy * 125/100; int nMaxHeight = max(rcCalendar1.Height() * 11/10, nDatesCaptionHeight);rrcHeader.bottom = rrcHeader.top + nMaxHeight; int nCalendarYPos = rrcHeader.top + nMaxHeight/2 - rcCalendar1.Height() / 2;MoveRectToXY(rcCalendar1, nCalendar1XPos, nCalendarYPos); if (bCalculate) return; //===========================================================================COLORREF clrPrev = pDC->SetTextColor(0); int nBkModePrev = pDC->SetBkMode(TRANSPARENT); //--------------------------------------------------------------------------- if (nMonths > 1){ rcCalendar2 = rcCalendar1; nCalendar2XPos = nCalendar1XPos - rcCalendar1.Width() * 11 / 10; MoveRectToXY(rcCalendar1, nCalendar2XPos, nCalendarYPos); } if (!m_pPrintOptions->m_bBlackWhitePrinting)pDC->FillSolidRect(&rrcHeader, RGB(229, 229, 229)); pDC->Draw3dRect(&rrcHeader, 0, 0); _DrawDateHeaderCalendar(FALSE, pDC, pOptions, dtYearMonth1, rcCalendar1); if (nMonths > 1)_DrawDateHeaderCalendar(FALSE, pDC, pOptions, dtYearMonth2, rcCalendar2); if (nMonths == 1 && pOptions->m_b3SmallCal){ rcCalendar2 = rcCalendar1; nCalendar2XPos = nCalendar1XPos - rcCalendar1.Width() * 11 / 10; MoveRectToXY(rcCalendar2, nCalendar2XPos, nCalendarYPos); if (bRTL){ if (iMonth < 12)iMonth++; else{ iMonth = 1; iYear++; } dtYearMonth1.SetDateTime(iYear, iMonth, 1,0,0,0); } else{ if (iMonth > 1)iMonth--; else{ iMonth = 12; iYear--; } dtYearMonth1.SetDateTime(iYear, iMonth, 1,0,0,0); } _DrawDateHeaderCalendar(FALSE, pDC, pOptions, dtYearMonth1, rcCalendar2); rcCalendar3 = rcCalendar2; nCalendar2XPos = nCalendar2XPos - rcCalendar2.Width() * 11 / 10; MoveRectToXY(rcCalendar3, nCalendar2XPos, nCalendarYPos); if (bRTL){ if (iMonth < 12)iMonth++; else{ iMonth = 1; iYear++; } dtYearMonth1.SetDateTime(iYear, iMonth, 1,0,0,0); } else{ if (iMonth > 1)iMonth--; else{ iMonth = 12; iYear--; } dtYearMonth1.SetDateTime(iYear, iMonth, 1,0,0,0); } _DrawDateHeaderCalendar(FALSE, pDC, pOptions, dtYearMonth1, rcCalendar3); } CRect rcHeader1(0, 0, 0, 0); CRect rcHeader2(0, 0, 0, 0); CRect rcHeader3(0, 0, 0, 0); rcHeader1 = rrcHeader; rcHeader1.DeflateRect(10, 5, 10, 5); rcHeader1.right = nCalendar2XPos - 20; rcHeader2 = rcHeader1; fntDC.SetFont(&fntDateHeader); UINT uDrawFlags = DT_TOP | DT_LEFT | DT_WORDBREAK | DT_NOPREFIX; int nHeight1 = pDC->DrawText(strHeader1, &rcHeader1, uDrawFlags); if (!strHeader2.IsEmpty()){ rcHeader2.top += nHeight1 + sizeText.cy / 4; if (rcHeader2.top < rcHeader2.bottom){ pDC->DrawText(strHeader2, &rcHeader2, uDrawFlags); } } if (!strHeaderWeekDay.IsEmpty()){ fntDC.SetFont(&fntDateHeaderWeekDay); rcHeader3 = rcHeader2; rcHeader3.top += nHeight1 + sizeTextWD.cy / 5; if (rcHeader3.top < rcHeader3.bottom){ pDC->DrawText(strHeaderWeekDay, &rcHeader3, uDrawFlags); } } //---------------------------------------------------------------------------pDC->SetTextColor(clrPrev); pDC->SetBkMode(nBkModePrev); } |
|
![]() |
|
mdoubson ![]() Senior Member ![]() ![]() Joined: 17 November 2008 Status: Offline Points: 1705 |
![]() ![]() ![]() ![]() ![]() |
It means: in NonRTL mode Dec, Jan, Feb order,
in RTL - Feb, Jan, Dec
|
|
![]() |
|
prashant ![]() Senior Member ![]() ![]() Joined: 19 February 2007 Location: India Status: Offline Points: 165 |
![]() ![]() ![]() ![]() ![]() |
Replaced my code, tested.
Working very Fine :) Also following bug got resolved: https://forum.codejock.com/forum_posts.asp?TID=13189&KW= Thanks ![]() |
|
![]() |
|
mdoubson ![]() Senior Member ![]() ![]() Joined: 17 November 2008 Status: Offline Points: 1705 |
![]() ![]() ![]() ![]() ![]() |
OK - put same conclusion in parallel post https://forum.codejock.com/forum_posts.asp?TID=13189&KW |
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |