This is a migrated thread and some comments may be shown as answers.

Themes Colour Blending

2 Answers 146 Views
Themes and Visual Style Builder
This is a migrated thread and some comments may be shown as answers.
Kenneth Jackson
Top achievements
Rank 1
Kenneth Jackson asked on 19 Nov 2008, 05:08 AM
I recently installed the Q3 components and really like the themes colour blending addition.
I attempted to use this in a test app I created to test the new features.

Now this is really simple code (love it) but for some reason I cannot get it to work.

I have a form that inherits radform. I have a ribbonbar (pointless but just for testing) , a status
bar and a button. The button , statusbar and form all use the desert theme and the ribbonbar
the standard blue theme. I attempt to apply the colour blending after the button is clicked.
The code for it is as follows.

 

public partial class frmMain : RadForm
{
 private Theme currentTheme;
 private const string baseColorParamName = "BaseColor";

 public frmMain()
 {

     InitializeComponent();

 }

 private void radButton1_Click(object sender, EventArgs e)
 {

  currentTheme = ThemeResolutionService.GetTheme("Desert");
  HslColor baseColor = HslColor.FromAhsl(0.118, 0.9, 0.9);
  currentTheme.AddColorBlend(baseColorParamName,baseColor);
  currentTheme.ThemeProperties[baseColorParamName] = baseColor;
 }

}


The code generates no errors and the form borders sort of flicker as it happens,
the colour blending however has no effect. I assume I am missing something
simple but the code above barring the moving of some lines to a single proc,
is identical to that in the examples.

Could anyone shed some light on what I am doing incorrectly ?

 

2 Answers, 1 is accepted

Sort by
0
Mike
Telerik team
answered on 19 Nov 2008, 08:16 PM
Hello Kenneth Jackson,

You can get this functionality working with just a few changes in the code you are using. Since this code was designed to work with the Desert theme you will not be able to use it with the RadRibbonBar control - the Desert theme does not apply for it. But you can modify this to work with the default themes for all controls - i.e. the ControlDefault theme.

As you may have noticed the default theme of the RadRibobnBar control resembles the Office 2007-Blue theme. Thus we should change also the base-color which the blend will be calculated upon - in other words it should be blueish. For more info you may take a look at my blog post on theme color blends:
http://blogs.telerik.com/MihailValkov/Posts/08-10-31/Chameleon_skinning_coming_up_to_WinForms_in_Q3_2008.aspx

Here is the modified code you may use:
 
Theme currentTheme = ThemeResolutionService.GetTheme("ControlDefault"); 
HslColor baseColor = HslColor.FromColor(Color.FromArgb(193, 216, 240)); 
currentTheme.AddColorBlend(baseColorParamName, baseColor); 
 
currentTheme.ThemeProperties[baseColorParamName] = HslColor.FromColor(Color.FromArgb(255, 216, 208)); 

 
It styles the ribbon like this:
 
Red Ribbon

Let me know if you need assistance any further.
 

Kind regards,
Mike
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Kenneth Jackson
Top achievements
Rank 1
answered on 19 Nov 2008, 09:17 PM
Hi Mike , thanks for the code as well as the explanation.

Makes alot more sense now .

Ken

Tags
Themes and Visual Style Builder
Asked by
Kenneth Jackson
Top achievements
Rank 1
Answers by
Mike
Telerik team
Kenneth Jackson
Top achievements
Rank 1
Share this question
or