Office 2007 theme base color. |
Post Reply |
Author | |
rory33
Newbie Joined: 22 September 2009 Status: Offline Points: 7 |
Post Options
Thanks(0)
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 |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi,
its RGB value - try some 0xRRGGBB value. (0xff00ff )
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
rory33
Newbie Joined: 22 September 2009 Status: Offline Points: 7 |
Post Options
Thanks(0)
|
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 |
|
SuperMario
Admin Group Joined: 14 February 2004 Status: Offline Points: 18057 |
Post Options
Thanks(0)
|
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; } |
|
rory33
Newbie Joined: 22 September 2009 Status: Offline Points: 7 |
Post Options
Thanks(0)
|
Thanks supermario that worked perfectly - a nice pink ;-).
Cheers Rory |
|
rory33
Newbie Joined: 22 September 2009 Status: Offline Points: 7 |
Post Options
Thanks(0)
|
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 |
|
rory33
Newbie Joined: 22 September 2009 Status: Offline Points: 7 |
Post Options
Thanks(0)
|
Hi does anyone know how to theme the Date Picker the same way as the Calendar?
Thanks Rory |
|
mdoubson
Senior Member Joined: 17 November 2008 Status: Offline Points: 1705 |
Post Options
Thanks(0)
|
Why you need to use hex instead of usual decimal RGB with 0-255 values for each base color (r, g, b)? |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |