Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Calendar
  New Posts New Posts RSS Feed - How To Set Calendar Control Font?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How To Set Calendar Control Font?

 Post Reply Post Reply
Author
Message
prashant View Drop Down
Senior Member
Senior Member
Avatar

Joined: 19 February 2007
Location: India
Status: Offline
Points: 165
Post Options Post Options   Thanks (0) Thanks(0)   Quote prashant Quote  Post ReplyReply Direct Link To This Post Topic: How To Set Calendar Control Font?
    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.
Back to Top
prashant View Drop Down
Senior Member
Senior Member
Avatar

Joined: 19 February 2007
Location: India
Status: Offline
Points: 165
Post Options Post Options   Thanks (0) Thanks(0)   Quote prashant Quote  Post ReplyReply Direct Link To This Post 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?
Back to Top
AndreiM View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 18 August 2007
Status: Offline
Points: 132
Post Options Post Options   Thanks (0) Thanks(0)   Quote AndreiM Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
prashant View Drop Down
Senior Member
Senior Member
Avatar

Joined: 19 February 2007
Location: India
Status: Offline
Points: 165
Post Options Post Options   Thanks (0) Thanks(0)   Quote prashant Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post 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!

 

Back to Top
prashant View Drop Down
Senior Member
Senior Member
Avatar

Joined: 19 February 2007
Location: India
Status: Offline
Points: 165
Post Options Post Options   Thanks (0) Thanks(0)   Quote prashant Quote  Post ReplyReply Direct Link To This Post 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?
Back to Top
prashant View Drop Down
Senior Member
Senior Member
Avatar

Joined: 19 February 2007
Location: India
Status: Offline
Points: 165
Post Options Post Options   Thanks (0) Thanks(0)   Quote prashant Quote  Post ReplyReply Direct Link To This Post 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?
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post 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);

Back to Top
prashant View Drop Down
Senior Member
Senior Member
Avatar

Joined: 19 February 2007
Location: India
Status: Offline
Points: 165
Post Options Post Options   Thanks (0) Thanks(0)   Quote prashant Quote  Post ReplyReply Direct Link To This Post Posted: 24 February 2009 at 3:56am
Hi Mark,

Is there any solution for this if wanted to use Office 2007 theme?
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post Posted: 24 February 2009 at 8:02pm
check void CCalendarDemoView::OnBeforeDrawThemeObject(XTP_NOTIFY_CODE Event, WPARAM wParam , LPARAM lParam) function
Back to Top
prashant View Drop Down
Senior Member
Senior Member
Avatar

Joined: 19 February 2007
Location: India
Status: Offline
Points: 165
Post Options Post Options   Thanks (0) Thanks(0)   Quote prashant Quote  Post ReplyReply Direct Link To This Post 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);
*/
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.156 seconds.