How To Set Calendar Control Font? |
Post Reply |
Author | |
prashant
Senior Member Joined: 19 February 2007 Location: India Status: Offline Points: 165 |
Post Options
Thanks(0)
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. |
|
prashant
Senior Member Joined: 19 February 2007 Location: India Status: Offline Points: 165 |
Post Options
Thanks(0)
|
I want to set "Verdana" font to the calendar control event, also I want font size 12. How to do that?
|
|
AndreiM
Moderator Group Joined: 18 August 2007 Status: Offline Points: 132 |
Post Options
Thanks(0)
|
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.
|
|
prashant
Senior Member Joined: 19 February 2007 Location: India Status: Offline Points: 165 |
Post Options
Thanks(0)
|
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. |
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
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!
|
|
prashant
Senior Member Joined: 19 February 2007 Location: India Status: Offline Points: 165 |
Post Options
Thanks(0)
|
Hi Mark,
Worked fine for Day mode, but I guess for Week and Month mode SetTextColor function is not available. Is it so? |
|
prashant
Senior Member Joined: 19 February 2007 Location: India Status: Offline Points: 165 |
Post Options
Thanks(0)
|
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? |
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
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); |
|
prashant
Senior Member Joined: 19 February 2007 Location: India Status: Offline Points: 165 |
Post Options
Thanks(0)
|
Hi Mark,
Is there any solution for this if wanted to use Office 2007 theme? |
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
check void CCalendarDemoView::OnBeforeDrawThemeObject(XTP_NOTIFY_CODE Event, WPARAM wParam , LPARAM lParam) function
|
|
prashant
Senior Member Joined: 19 February 2007 Location: India Status: Offline Points: 165 |
Post Options
Thanks(0)
|
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); */ |
|
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 |