Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Calendar
  New Posts New Posts RSS Feed - Office 2007 theme base color.
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Office 2007 theme base color.

 Post Reply Post Reply
Author
Message
rory33 View Drop Down
Newbie
Newbie


Joined: 22 September 2009
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote rory33 Quote  Post ReplyReply Direct Link To This Post Topic: Office 2007 theme base color.
    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
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 22 September 2009 at 3:49am
Hi,
 
its RGB value - try some 0xRRGGBB value. (0xff00ff )
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
rory33 View Drop Down
Newbie
Newbie


Joined: 22 September 2009
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote rory33 Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post 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;
        }
Back to Top
rory33 View Drop Down
Newbie
Newbie


Joined: 22 September 2009
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote rory33 Quote  Post ReplyReply Direct Link To This Post Posted: 22 September 2009 at 8:55am
Thanks supermario that worked perfectly  - a nice pink ;-).

Cheers

Rory
Back to Top
rory33 View Drop Down
Newbie
Newbie


Joined: 22 September 2009
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote rory33 Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
rory33 View Drop Down
Newbie
Newbie


Joined: 22 September 2009
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote rory33 Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
mdoubson View Drop Down
Senior Member
Senior Member
Avatar

Joined: 17 November 2008
Status: Offline
Points: 1705
Post Options Post Options   Thanks (0) Thanks(0)   Quote mdoubson Quote  Post ReplyReply Direct Link To This Post 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)?

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.156 seconds.