dbicDayView Send comments on this topic.
Developing with dbicDayView - Coloring the Time Grid

Glossary Item Box

Coloring the Time Grid

 

Prime Time and Non-Prime Time Colors

 

By default, the lines in the time grid are colored with the PrimeTimeColor and NonPrimeColor properties. The starting and ending time for prime time is determined by the PrimeTimeStart and PrimeTimeEnd properties.  Time not specified within the bounds of the PrimeTimeStart and PrimeTimeEnd values is considered to be Non-Prime Time and is colored appropriately.

 

Coloring Individual Lines

 

Lines (rows) can be individually colored at run time using code. Each time a line is drawn, the ColorLine event is fired. It is possible for the programmer to check the time value for the line and then color it. For example…

 



<VB.NET> 

    Private Sub dbicDayView1_ColorLine(sender As Object, e As Dbi.WinControl.DayView.ColorLineEventArgs) Handles dbicDayView1.ColorLine

        'This event fires every time a line is drawn in the dbicDayView control

        If (e.Time >= 60 And e.Time < 120) Then

            e.LineColor = Color.Blue    'Color the line (row) blue

        End If

    End Sub

 <C#>

        private void dbicDayView1_ColorLine(object sender, Dbi.WinControl.DayView.ColorLineEventArgs e)

        {

            //This event fires every time a line is drawn in the dbicDayView control

            if (e.Time >= 60 & e.Time < 120)

                e.LineColor = Color.Blue;    //Color the line (row) blue

        }

 

The dbiCustomArea Class

 

The dbiCustomArea class allows the developer to create a block area in the control to apply custom formatting. Formatting includes coloring, filtering (Contact, Task, or Location), and "Dead Zone" specification. These custom areas can either be created through the control designer at design time using the CustomAreas property collections, or through code at run time. For example..

 



<VB.NET> 

    'Create an instance of the CustomArea object and color it red.  NOTE: The dtStart and dtEnd values are datetime and describe the start and end of the block being created.

       Dim objArea As New Dbi.PIM.dbiCustomArea(DateTime.Now.AddHours(1), DateTime.Now.AddHours(2),Color.Red)

        'Add the CustomArea to the dbicDayView's CustomAreas collection

        dbicDayView1.CustomAreas.Add(objArea)

<C#>

            Dbi.PIM.dbiCustomArea objArea = new Dbi.PIM.dbiCustomArea(DateTime.Now.AddHours(1), DateTime.Now.AddHours(2),Color.Red);

            //Add the CustomArea to the dbicDayView's CustomAreas collection

            dbicDayView1.CustomAreas.Add(objArea);

 

Note : Please see Creating Custom Areas for additional details.

 

Using colors from the Contacts, Locations, and Tasks Class

 

It is also possible to define the prime time and non-prime colors of a column when a column is defined as a contact, location, or task through the GroupType property. In each of these classes, there is a property for BackColor and BackColorTo. If these colors are not set to empty, the BackColor property for the class will override the PrimeTimeColor property and the BackColorTo property will override the NonPrimeColor property for that column.