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

Theme and AddColorBlend, NOT Working.

3 Answers 110 Views
Themes and Visual Style Builder
This is a migrated thread and some comments may be shown as answers.
Lee
Top achievements
Rank 1
Lee asked on 04 Apr 2010, 06:52 PM
Hi
i am pissed off... this little code is not working past 3 hrs.
What i want to do is apply breeze theme with "RED" color instead of "Blue" color. 
I am trying to do as show in example "Integration/Theme color blending".  but don;t know what i am missing.

 

private void Form3_Load(object sender, EventArgs e)

 

{

 

this.masterCountryTableAdapter.Fill(this.dsDataSet.MasterCountry);

 

 

ThemeResolutionService.ApplyThemeToControlTree(this.radGridView1, "Breeze");

 

}


 

private void button1_Click(object sender, EventArgs e)

 

{


currentTheme =

ThemeResolutionService.GetTheme("Breeze");

 

 

//if (currentTheme.ThemeProperties.ContainsKey("BaseColor"))

 

 

//{

 

 

// this.colorForm.SelectedHslColor = (HslColor)currentTheme.ThemeProperties["BaseColor"];

 

 

// return;

 

 

//}

 

 

HslColor baseColor = HslColor.FromColor(Color.FromArgb(250, 0, 0));

 

 

//this.colorForm.SelectedHslColor = baseColor;

 

currentTheme.AddColorBlend(

"BaseColor", baseColor);

 

}

3 Answers, 1 is accepted

Sort by
0
Accepted
Nikolay
Telerik team
answered on 08 Apr 2010, 12:40 PM
Hello Lee,

Thank you for the question.

As described in this help article, you need to set the ThemeProperties of the currentTheme instance. However, there is no such setting in your code snippet. In addition, the baseColor instance should actually contain the base color which appears originally in the Breeze theme, but not the color that you want to set. Please refer to the correct code snippet which will make the Breeze theme red:
Theme currentTheme = Telerik.WinControls.ThemeResolutionService.GetTheme("Breeze");
HslColor baseColor = HslColor.FromArgb(255, 56, 154, 254);
currentTheme.AddColorBlend("BaseColor", baseColor);
currentTheme.ThemeProperties["BaseColor"] = HslColor.FromArgb(255, 254, 56, 56);

I hope this helps. If you have additional questions, feel free to contact me.

Greetings,
Nikolay
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Lee
Top achievements
Rank 1
answered on 08 Apr 2010, 04:49 PM
Wow! Thanks Nikolay , That did worked.

I can see the difference between my and your code and i believe, I miss-used function Argb.  I understand r,g,b . but what does 'A' stands for?   (  I see that we have specified 255 value for 1st parameter of the function.  )

Few more questions.
1. like ThemeProperties["BaseColor"]  what are other properties, I can play around with.?   Do we have a list?

2. Eg. at http://www.telerik.com/help/winforms/color_blending_.html   it says "If the resulting skin still needs some touches, you can export the modified theme data to xml files".   How to export  theme modified at runtime ?  is there any example for it?


Regards
lee.
0
Nikolay
Telerik team
answered on 14 Apr 2010, 05:06 PM
Hi Lee,

The 'A' letter stands for the Alpha value of the defined color. For additional information about the FromArgb signature, please refer to MSDN.

The BaseColor value that used to get an item from ThemeProperties is actually the value defined before that in the added color blend. It does not matter whether the BaseColor string is called BaseColor1 or BaseColor5, it is important that you get an item from the ThemeProperties by passing the value defined for the color blend.

As to the process of exporting your blended themes, please refer to the attached sample project. It demonstrates the approach that you should follow.

I hope this helps. If you have additional questions, feel free to contact me.

Best wishes,
Nikolay
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Themes and Visual Style Builder
Asked by
Lee
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Lee
Top achievements
Rank 1
Share this question
or