Print Page | Close Window

ThemeOffice2007 and cell backgroundcolor

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Calendar
Forum Description: Topics Related to Codejock Calendar
URL: http://forum.codejock.com/forum_posts.asp?TID=5212
Printed Date: 28 September 2024 at 3:26pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: ThemeOffice2007 and cell backgroundcolor
Posted By: KlausConlé
Subject: ThemeOffice2007 and cell backgroundcolor
Date Posted: 04 October 2006 at 6:12am
Hello, I would like to change the background colour of each cell individually.  With the event BeforeDrawDayViewCell with the help of the class CalendarDayViewCellParams is possible. 
Now would I like to work with ThemeOffice2007, the appropriate event is BeforeDrawThemeObject, how I come to the Claas CalendarDayViewCellParams around the background colour of the cell to change?


-------------
kc



Replies:
Posted By: sserge
Date Posted: 04 October 2006 at 8:39am
Hi,

It access Cell parameters using Theme2007 object.

There are some info on it in another topic (with the example): http://forum.codejock.com/forum_posts.asp?TID=5170 - http://forum.codejock.com/forum_posts.asp?TID=5170

--
WBR,
Serge


Posted By: KlausConlé
Date Posted: 04 October 2006 at 8:59am
Thanks for the fast answer. I can set so the background color for the cells Work/NonWork, but as I can change the color for a certain cell?  I believe, I do not understand it correctly.

-------------
kc


Posted By: sserge
Date Posted: 12 October 2006 at 7:47am
Yes, you can.

Use flag
xtpCalendarBeforeDraw_DayViewCell
and set members:
CalendarControl.Theme.DayView.Day.Group.Cell.WorkCell.BackgroundColor
CalendarControl.Theme.DayView.Day.Group.Cell.NonWorkCell.BackgroundColor

Params member is:
CalendarThemeDayViewCellParams

--
WBR,
Serge


Posted By: sserge
Date Posted: 15 October 2006 at 3:34pm
BTW, below is the example (in VB.NET):

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        AxCalendarControl1.SetTheme(New CalendarThemeOffice2007Class)
        AxCalendarControl1.DayView.ShowDays(Now, Now.AddDays(2))

        If Not AxCalendarControl1.BeforeDrawThemeObjectFlags Is Nothing Then
            AxCalendarControl1.BeforeDrawThemeObjectFlags.SetFlag(CalendarBeforeDrawThemeObject.xtpCalendarBeforeDraw_DayViewCell)
        End If

        AxCalendarControl1.Populate()
    End Sub

    Private Sub AxCalendarControl1_BeforeDrawThemeObject(ByVal sender As Object, ByVal e As AxXtremeCalendarControl._DCalendarControlEvents_BeforeDrawThemeObjectEvent) Handles AxCalendarControl1.BeforeDrawThemeObject
        Dim pTheme2007 As CalendarThemeOffice2007
        pTheme2007 = AxCalendarControl1.Theme
        Dim pParam As CalendarThemeDayViewCellParams

        If e.eObjType = CalendarBeforeDrawThemeObject.xtpCalendarBeforeDraw_DayViewCell Then
            pParam = e.drawParams
            If pParam.BeginTime > Now Then
                pTheme2007.DayView.Day.Group.Cell.WorkCell.BackgroundColor = RGB(50, 150, 150)
                pTheme2007.DayView.Day.Group.Cell.NonWorkCell.BackgroundColor = RGB(50, 150, 150)
            End If
        End If
    End Sub

    Private Function RGB(ByVal r As Long, ByVal g As Long, ByVal b As Long) As UInt32
        RGB = Convert.ToUInt32(r + g * 256 + b * 256 * 256)
    End Function


--
WBR,
Serge



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net