Theme definitions at runtime.

Welcome to Wisej Support.
Questions, suggestions and plain old bugs - are all welcome here!


So I have a theme and have defined some new Colours and Fonts.
The InitializeComponent code seems to reference these like this:

this.label1.BackColor = System.Drawing.Color.FromName(“@CMSToolBarButtonBackgroundHover”);

And that works, it displays in the desired colour.
But when I put the same code in my application, for example in a MouseHover event handler, it returns “{Name=@CMSToolBarButtonBackgroundHover, ARGB=(0, 0, 0, 0)}”¬†which seems right compared to other places, but it has no effect in the UI.

this.MouseHover += (s, ex) =>
this.BackColor = System.Drawing.Color.FromName(“@CMSToolBarButtonBackgroundHover”);

I can change the colour name in InitializeComponent and it changes the initial colour in the UI, I can also change the colour in the event handler to a non-theme colour (eg.FromARGB or Color.Black) but nothing I do in the event handler with the theme defined colour seems to have any effect.

In some cases I can setup buttons and use the theme designer to provide hover effects, but there are instances I need to do this programatically.

Any idea why this doesn’t work ?


Andi Gordon

  • You must to post comments

I added

“colors”: {
“CMSToolBarButtonBackgroundHover”: “red”

to a theme mixin and attached to the mouse hover event like this:

private void Button_MouseHover(object sender, EventArgs e)
((Button)sender).BackColor = System.Drawing.Color.FromName(“@CMSToolBarButtonBackgroundHover”);

It works here. I also tried to assign a BackColor to the button to something different than the default. Can you reproduce in a small test case?



  • You must to post comments
Showing 1 result
Your Answer
Post as a guest by filling out the fields below or if you already have an account.
File Name Size
There are currently no files uploaded.
Maximum number of files 5, maximum file size 3.9MB.
Supported file formats: zip pdf gif jpg bmp png cs vb theme json mixin.theme