Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic planner .net control :-want to change header date range text (Read 3385 times)
arry
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 2
Joined: Feb 28th, 2013
planner .net control :-want to change header date range text
Feb 28th, 2013 at 6:07am
Print Post  
Hello Experts
i am new to win form application
i am using planner .net control(ver. 4.0)
i want to change the header date
like the image in attachment here "Oct 2006 to DEC 2006" to Oct 2006
I want it to show only current month
is it possible ?
please help

thanks
  

01_mindfusion.jpg (Attachment deleted)
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: planner .net control :-want to change header date range text
Reply #1 - Feb 28th, 2013 at 7:19am
Print Post  
Hi,

This can only be done through custom drawing. First, toggle off the default header rendering by setting Calendar.WeekRangeSettings.TitleFormat to a value that will produce an empty string (double space appears to be working) and Calendar.WeekRangeSettings.TitleSeparator to an empty string:

Code
Select All
calendar.WeekRangeSettings.TitleFormat = "  ";
calendar.WeekRangeSettings.TitleSeparator = ""; 


Then, set Calendar.CustomDraw to CustomDrawElements.WeekRangeHeader and handle the Calendar.Draw event. Use the following code in the event handler:

Code
Select All
private void _calendar_Draw(object sender, DrawEventArgs e)
{
	if (e.Element == CustomDrawElements.WeekRangeHeader)
	{
		using (Brush textBrush = new SolidBrush(e.Style.HeaderTextColor))
		{
			// Note: Using centered string format for simplicity; generally
			// the string format should correspond to the e.Style.HeaderTextAlignment
			StringFormat f = new StringFormat();
			f.Alignment = StringAlignment.Center;
			f.LineAlignment = StringAlignment.Center;
			e.Graphics.DrawString(e.Date.ToString("MMM yyyy"), e.Style.HeaderFont, textBrush, e.Bounds, f);
		}
	}
} 


Let me know if this helps.

Regards,
Meppy
  
Back to top
 
IP Logged
 
arry
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 2
Joined: Feb 28th, 2013
Re: planner .net control :-want to change header date range text
Reply #2 - Feb 28th, 2013 at 10:11am
Print Post  
Thanks Meppy
It worked like a Charm Smiley
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint