Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Appointment Headers (Read 3858 times)
ColinA
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 21
Joined: Aug 27th, 2013
Appointment Headers
Sep 3rd, 2013 at 9:03am
Print Post  
Hi

I'm trying to set the header to a solid color but tries the .style  and no luck so far

Cheers
Colin
  
Back to top
 
IP Logged
 
ColinA
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 21
Joined: Aug 27th, 2013
Re: Appointment Headers
Reply #1 - Sep 3rd, 2013 at 9:46am
Print Post  
using .Style.Brush = New MindFusion.Drawing.SolidBrush(Color.Green)  set the whole app to green but using Style.HeaderBrush = New MindFusion.Drawing.SolidBrush(Color.Green)  doesn't seem to have any effect  must be missing something Sad  I just want to color the header area
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Appointment Headers
Reply #2 - Sep 3rd, 2013 at 10:39am
Print Post  
Hi,

It is not possible to style only the header area of an appointment (Style.HeaderBrush does not seem to be used for items). You need to rely on custom drawing to paint the header in different color. To do this, set Calendar.CustomDraw to CustomDrawElements.TimetableItem and handle the Calendar.Draw event. In the event handler use the following code:

Code
Select All
// Calculate the header area
Rectangle r = new Rectangle(e.Bounds.X + 1, e.Bounds.Y + 1,
    e.Bounds.Width - 2, weekView.ItemSettings.HeaderSize);

// Fill the header area
e.Graphics.FillRectangle(Brushes.Red, r);

// Redraw the header text
SolidBrush textBrush = new SolidBrush(e.Style.HeaderTextColor);
StringFormat textFormat = new StringFormat(StringFormat.GenericTypographic);
textFormat.Alignment = StringAlignment.Center;
textFormat.LineAlignment = StringAlignment.Center;
e.Graphics.DrawString(e.Item.HeaderText, e.Style.HeaderFont, textBrush, r, textFormat);
textFormat.Dispose();
textBrush.Dispose(); 


Note that you need to redraw the header text as well. Otherwise, the header text will not be visible after you fill the header area with your custom color, because the custom drawing occurs after the default drawing of the item.

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


I Love MindFusion!

Posts: 21
Joined: Aug 27th, 2013
Re: Appointment Headers
Reply #3 - Sep 3rd, 2013 at 11:07am
Print Post  
Hi Meppy

Thanks for that  1 proble
e.Graphics.DrawString(e.Item.HeaderText, e.Style.HeaderFont, textBrush, r, textFormat)  give the error

value of type mindfusion.drawing.solidbrush cannot be converted to system.drawing.brush
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Appointment Headers
Reply #4 - Sep 3rd, 2013 at 11:27am
Print Post  
Use the full System.Drawing.SolidBrush name:

Code
Select All
System.Drawing.SolidBrush textBrush = new System.Drawing.SolidBrush(e.Style.HeaderTextColor); 


Regards,
Meppy
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint