Print Page | Close Window

Office 2007 theme base color.

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=15219
Printed Date: 15 September 2025 at 11:17am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Office 2007 theme base color.
Posted By: rory33
Subject: Office 2007 theme base color.
Date Posted: 22 September 2009 at 3:38am
Hi Folks,

I'm trying to set the office 2007 theme and I have that successfully, but I want to set the BaseColor property so I can have different modes e.g. a blue, black, grey, red, orange, yellow etc.

So far I have (in C#):

CalendarThemeOffice2007 calTheme = new CalendarThemeOffice2007Class();
calTheme.BaseColor = ???; // The BaseColor property expects a Uint - how can I work out the values to set this?
calTheme.RefreshMetrics();
myCalendarControl.SetTheme(calTheme);

So my problem is how to set the correct UInt for the BaseColor.

Any help would be amazing,

Cheers

Rory



Replies:
Posted By: Oleg
Date Posted: 22 September 2009 at 3:49am
Hi,
 
its RGB value - try some 0xRRGGBB value. (0xff00ff )


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: rory33
Date Posted: 22 September 2009 at 3:54am
Thanks Oleg, do you have an example as to how I do this in C# though? It is this that I am struggling with.

Thanks
Rory


Posted By: SuperMario
Date Posted: 22 September 2009 at 8:43am
Try something like:


calTheme.BaseColor = (uint)HexToDecimal("FF00FF");

        public int HexToDecimal(string HexString)
        {
            char[] HexColor = HexString.ToCharArray();
            int DecimalColor = 0;
            int iLength = HexColor.Length - 1;
            int iDecimalNumber;

            foreach(char cHexValue in HexColor)
            {
                if (char.IsNumber(cHexValue))
                {
                    iDecimalNumber = int.Parse(cHexValue.ToString());
                }
                else
                {
                    iDecimalNumber = Convert.ToInt32(cHexValue) - 55;
                }

                DecimalColor += iDecimalNumber * (Convert.ToInt32(Math.Pow(16, iLength)));
                iLength--;
            }
            return DecimalColor;
        }


Posted By: rory33
Date Posted: 22 September 2009 at 8:55am
Thanks supermario that worked perfectly  - a nice pink ;-).

Cheers

Rory


Posted By: rory33
Date Posted: 22 September 2009 at 10:38am
On a similar note, I have a Date picker which I want to theme the same way I have themed the calendar. Naturally, I thought I could just do myDatePickerControl.SetTheme(calTheme); as I did myCalendarControl.SetTheme(calTheme); but this does not work. There is the DatePickerThemeOffice2007 which I have tried as follows:

DatePickerThemeOffice2007 datePickerTheme = new DatePickerThemeOffice2007Class();

and I figured I could then set the base color on that, e.g.:
datePickerTheme.BaseColor = (uint)HexToDecimal("70DB93");

and then do:
myDatePickerControl.SetTheme(datePickerTheme);

which would be the same as how the calendar theme is set. Does anyone have any clues as to how to achieve this?

Thanks in advance

Rory



Posted By: rory33
Date Posted: 28 September 2009 at 3:42am
Hi does anyone know how to theme the Date Picker the same way as the Calendar?

Thanks

Rory


Posted By: mdoubson
Date Posted: 30 September 2009 at 7:06pm

Why you need to use hex instead of usual decimal RGB with 0-255 values for each base color (r, g, b)?



-------------
Mark Doubson, Ph.D.



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