Print Page | Close Window

How To Set Calendar Control Font?

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=11448
Printed Date: 11 May 2024 at 11:54am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: How To Set Calendar Control Font?
Posted By: prashant
Subject: How To Set Calendar Control Font?
Date Posted: 15 July 2008 at 5:11am
Hi,

Is there any way to set particular Font, size of font to the data present in Calendar Control (Event)?

Thanks in advance.



Replies:
Posted By: prashant
Date Posted: 18 July 2008 at 12:03am
I want to set "Verdana" font to the calendar control event, also I want font size 12. How to do that?


Posted By: AndreiM
Date Posted: 16 August 2008 at 4:23am
You can do this using properties of CXTPCalendarPaintManager (for Office 2003 theme) or CXTPCalendarThemeOffice2007 objects.
 
CXTPCalendarThemeOffice2007 class has many properties for customization (look at classes headers and try to find yourself:).
 
CXTPCalendarPaintManager allow you to change the fonts, but as I know no all parts may be drawn as expected if you set font size 12, but you can try.


-------------
Regards,
Andrei Melnik


Posted By: prashant
Date Posted: 28 January 2009 at 2:23am
Hi Mark,

Can you please guide me on the same?

Is it possible to set Event text font to "Verdana" size 12 and Color "Red"

How to do that? Thanks in advance.


Posted By: mdoubson
Date Posted: 28 January 2009 at 11:09am
Hi,
I did some research and can give you sample for DayView in non-Office2007 Theme:
 
COLORREF clrTxt = RGB(255,0,0);

COLORREF clrBg = RGB(224,224,224);

CFont* pFont = new CFont;

pFont->CreatePointFont(120, "Comic Sans MS");

LOGFONT lf;

pFont->GetLogFont(&lf);

GetCalendarCtrl().GetPaintManager()->GetDayViewEventPart()->SetTextColor(clrTxt);

GetCalendarCtrl().GetPaintManager()->GetDayViewEventPart()->SetBackgroundColor(clrBg);

GetCalendarCtrl().GetPaintManager()->GetDayViewEventPart()->SetTextFont(&lf);

btw - GetMonthViewEventPart() give exception!

 



Posted By: prashant
Date Posted: 29 January 2009 at 4:03am
Hi Mark,

Worked fine for Day mode, but I guess for Week and  Month  mode  SetTextColor function  is not available. Is it so?


Posted By: prashant
Date Posted: 29 January 2009 at 5:10am
Hi Mark,

Work around for Week mode is as follows:

GetCalendarCtrl().GetPaintManager()->GetWeekViewEventPart()->m_clrTextNormalColor = clrTxt;

But still wondering, How to set for Month mode?


Posted By: mdoubson
Date Posted: 29 January 2009 at 11:40pm

This is that I found for MonthView - NON Office2007 Theme!
COLORREF clrTxt = RGB(255,0,0);

COLORREF clrBg = RGB(224,224,224);

CFont* pFont = new CFont;

pFont->CreatePointFont(120, "Comic Sans MS");

LOGFONT lf;

pFont->GetLogFont(&lf);

GetCalendarCtrl().GetPaintManager()->GetMonthViewEventPart()->m_clrTextHighLightColor = clrTxt;

GetCalendarCtrl().GetPaintManager()->GetMonthViewEventPart()->m_clrMultiDayEventFrameColor = clrTxt;

GetCalendarCtrl().GetPaintManager()->GetMonthViewEventPart()->m_clrClassicUnderline = clrTxt;

GetCalendarCtrl().GetPaintManager()->GetMonthViewEventPart()->SetTextFont(&lf);



Posted By: prashant
Date Posted: 24 February 2009 at 3:56am
Hi Mark,

Is there any solution for this if wanted to use Office 2007 theme?


Posted By: mdoubson
Date Posted: 24 February 2009 at 8:02pm
check void CCalendarDemoView::OnBeforeDrawThemeObject(XTP_NOTIFY_CODE Event, WPARAM wParam , LPARAM lParam) function

-------------
Mark Doubson, Ph.D.


Posted By: prashant
Date Posted: 26 February 2009 at 4:16am
Got it, thanks :)

CFont pFont;
pFont.CreatePointFont(120, "Comic Sans MS");
pFont.CreateFontIndirect(lFont);
LOGFONT lf;
pFont.GetLogFont(&lf);


   pTheme2007->GetDayViewPartX()->GetDayPartX()->GetGroupPartX()->GetSingleDayEventPartX()->m_fcsetNormal.fcsetSubject.fntFont.SetCustomValue(&pFont);
pTheme2007->GetWeekViewPartX()->GetDayPartX()->GetSingleDayEventPartX()->m_fcsetNormal.fcsetSubject.fntFont.SetCustomValue(&pFont);
pTheme2007->GetMonthViewPartX()->GetDayPartX()->GetSingleDayEventPartX()->m_fcsetNormal.fcsetSubject.fntFont.SetCustomValue(&pFont);

   pTheme2007->GetDayViewPartX()->GetDayPartX()->GetGroupPartX()->GetMultiDayEventPartX()->m_fcsetNormal.fcsetSubject.fntFont.SetCustomValue(&pFont);
pTheme2007->GetWeekViewPartX()->GetDayPartX()->GetMultiDayEventPartX()->m_fcsetNormal.fcsetSubject.fntFont.SetCustomValue(&pFont);
pTheme2007->GetMonthViewPartX()->GetDayPartX()->GetMultiDayEventPartX()->m_fcsetNormal.fcsetSubject.fntFont.SetCustomValue(&pFont);

 ///!<Code for Non Office 2007 Theme>
 /*
GetCalendarCtrl().GetPaintManager()->GetDayViewEventPart()->SetTextFont(&lf);
 GetCalendarCtrl().GetPaintManager()->GetWeekViewEventPart()->SetTextFont(&lf);
 GetCalendarCtrl().GetPaintManager()->GetMonthViewEventPart()->SetTextFont(&lf);
*/



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net