problems printing dayview (bug?)
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=12520
Printed Date: 23 November 2024 at 11:05am Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com
Topic: problems printing dayview (bug?)
Posted By: Alex H.
Subject: problems printing dayview (bug?)
Date 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):
|
Replies:
Posted By: Oleg
Date Posted: 29 October 2008 at 5:26am
Hi,
Run our sample, click Page Setup and change Print Range.
------------- Oleg, Support Team CODEJOCK SOFTWARE SOLUTIONS
|
Posted By: prashant
Date Posted: 13 January 2009 at 6:51am
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?
|
Posted By: mdoubson
Date Posted: 13 January 2009 at 12:04pm
Just select 2 months in DatePicker and you will have it in print
|
Posted By: prashant
Date Posted: 14 January 2009 at 12:21am
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.)
|
Posted By: mdoubson
Date Posted: 14 January 2009 at 1:39am
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
|
Posted By: mdoubson
Date Posted: 14 January 2009 at 2:04am
What do you want to show in the case DatePicker selection covered 5 months - now it show 1st and 5th
|
Posted By: mdoubson
Date Posted: 14 January 2009 at 2:14am
I decide that if DatePicker selection covered 2 or more months - keep old logic, if 1 month or less - use bool flag - show 1 small calendar or 3 (prev, current, next month). Sound good?
|
Posted By: prashant
Date Posted: 14 January 2009 at 3:01am
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"
|
Posted By: mdoubson
Date Posted: 14 January 2009 at 3:06am
Posted By: prashant
Date Posted: 14 January 2009 at 3:19am
See Result??
I didn't understand..please explain.
|
Posted By: mdoubson
Date Posted: 14 January 2009 at 3:22am
https://forum.codejock.com/uploads/20090115_113916_CalendarUpdates.rar - uploads/20090115_113916_CalendarUpdates.rar I mean see the snapshot in my previous note - it already go in release 13
Default - 3 (only for 1 month or less selection) other case - old logic
|
Posted By: prashant
Date Posted: 14 January 2009 at 3:31am
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.
|
Posted By: prashant
Date Posted: 15 January 2009 at 8:27am
Mark,
Can you please send me modified files for Calendar Print Preview issue?
I already mailed you / Oleg at mailto:support@codejock.com - support@codejock.com
Thanks.
|
Posted By: mdoubson
Date Posted: 15 January 2009 at 11:41am
https://forum.codejock.com/uploads/20090115_122129_Resource.rar - 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
|
Posted By: prashant
Date Posted: 16 January 2009 at 1:35am
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:
|
Posted By: mdoubson
Date Posted: 16 January 2009 at 10:25am
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);
}
|
Posted By: mdoubson
Date Posted: 16 January 2009 at 10:26am
It means: in NonRTL mode Dec, Jan, Feb order,
in RTL - Feb, Jan, Dec
|
Posted By: prashant
Date Posted: 19 January 2009 at 5:43am
Replaced my code, tested.
Working very Fine :)
Also following bug got resolved:
https://forum.codejock.com/forum_posts.asp?TID=13189&KW=
Thanks
|
Posted By: mdoubson
Date Posted: 19 January 2009 at 8:34am
OK - put same conclusion in parallel post https://forum.codejock.com/forum_posts.asp?TID=13189&KW
|
|