Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic fill color/header brush (Read 3383 times)
dimmer
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 21
Joined: Jun 27th, 2007
fill color/header brush
Jul 23rd, 2007 at 1:38pm
Print Post  
Hello

I would like to change the fill color on appointments depending on certain criteria when the form containing the calendar object is loaded, basically the same as was listed in this post:

http://mindfusion.org/cgi/Forum/YaBB.pl?board=calnet_disc;action=display;num=117...

I tried the suggestions that were made in the post listed above but without any luck...

I'm using the calendar with the single month view, and here is the code that is running on the form_load event:


Dim cmd As SqlCommand
       Dim conn As SqlConnection
       Dim dr As SqlDataReader

       Dim app As Appointment


       conn = New SqlConnection("server=rhdb4;database=calendarTest;trusted_connection=true")
       conn.Open()

       cmd = New SqlCommand("SELECT * FROM dbo.tblAppointment", conn)
       dr = cmd.ExecuteReader

       While (dr.Read)

           app = New Appointment
           app.StartTime = dr("appStartTime")
           app.EndTime = dr("appEndTime")
           app.DescriptionText = dr("appDescriptionText")
           app.Subject = dr("appSubject")
           app.Id = dr("ScheduleID")


'***here is where I would like to set the fill color
           If dr("appSubject") = "test" Then

               'app.Style.FillColor = Black
               app.Style.HeaderBrush = New MindFusion.Drawing.SolidBrush(Color.Black)
               MsgBox("test")

               app.Style.BorderTopColor = Yellow
           Else
               app.Style.BorderTopColor = Black

           End If




           calendar.Schedule.Items.Add(app)
       End While


The border colors change no problem, but the header fill color nevers does...I've checked through the properties for the calendar and tried changing a few values but cannot get it to work properly...

Thanks for any further suggestions
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: fill color/header brush
Reply #1 - Jul 23rd, 2007 at 1:48pm
Print Post  
Use the Item.Style.Brush and Item.SelectedStyle.Brush properties for this purpose. There is a very helpful topic in the documentation illustrating how various aspects of the item are affected by its associated style. The topic can be found under Overview / Customizing Appearance / Customizing the Appearance of Items.

Meppy
  
Back to top
 
IP Logged
 
dimmer
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 21
Joined: Jun 27th, 2007
Re: fill color/header brush
Reply #2 - Jul 23rd, 2007 at 3:05pm
Print Post  
Hi Meppy

I read what you suggested and if I understand correctly that will allow me to set the general appearance for the calendar; more specifically, if I set the fill color this way, all appointment headers will have the color that I set.

What I want to do is set a different fill color for the header depending on a field from my database.

When I'm filling the calendar with appointments, I want to query a field called fillColor and then set the fill color of the header to that value.  For instance:

If dr("fillColor") = "Yellow" Then
app.style.fillcolor = "Yellow"
ElseIf dr("FillColor") = "Black" Then
app.style.fillcolor = "Black"
etc...

Not sure if this makes sense but it's what I'm trying to do...

Thanks


  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: fill color/header brush
Reply #3 - Jul 23rd, 2007 at 4:13pm
Print Post  
Hi there,

You can set the style of individual appointments as well, e.g.:

anApppointment.Style.HeaderBrush = new SolidBrush(Color.Yellow);

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: fill color/header brush
Reply #4 - Jul 23rd, 2007 at 4:15pm
Print Post  
But in some views the HeaderBrush might not be used. Try setting the app.Style.Brush as well.

Stoyan
  
Back to top
 
IP Logged
 
dimmer
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 21
Joined: Jun 27th, 2007
Re: fill color/header brush
Reply #5 - Jul 23rd, 2007 at 4:20pm
Print Post  
Awesome; I'm using the single month view. app.style.headerbrush wasn't working but app.style.brush did the job...

Thanks again for your help
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint