Creating Webstyle Through Code

I’m trying to change the colour of a webtextfield font and background color using RGB values. Is it possible to do this through code?

If it is can someone give me some pointers.

Found the answer. Using HTML in the text. By generating HTML through code.

You can also use a WebStyle to change the whole text and background.

That’s true. To be honest I would prefer to use a style and change it at run-time. But I couldn’t find a way to do this. So I had to settle for second best.

The alternative would be to have hundreds of webstyles.

how did u do that??

In the WebTextField place the words ‘’ and ‘’ on the peripheries of your text then you can put any plain text or HTML text within these. It’s really cool!

does it work with webtextarea or weblabel??

I believe it works OK — try it!


Thanks Michel. That gave me what I wanted as my first choice.

self.ExecuteJavaScript(“var x=document.getElementById(’”+ self.Label8.ControlID +"’); ““rgb(0,0,255)””")

I can dynamically change the colour. And it colours the whole control instead of just the text.