Changing style at runtime

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

Hi,

I’m trying to change the Fontstyle or Forecolor of a label at runtime based on a condition, something like:

lblCount.Font = new Font(lblCount.Font, (String.IsNullOrEmpty(_selCriteria) ? FontStyle.Regular : FontStyle.Bold));

but it doesn’t work. Is this a bug, or there is another recommended way to do it?

Best,
Alex

  • You must to post comments
0
0

Too much beer is not a problem – it’s an enhancement.

The font issue is fixed. Also SystemFonts are mapped to themed fonts if available.

Best,

Luca

  • You must to post comments
0
0

Hi Luca,

Thanks for the update.

You are right, I don’t see it with ForeColor anymore. To be honest, I had seen it a while ago, and since I remembered I couldn’t change color, I tried to change style yesterday. And when I saw that style didn’t change I thought it was the same effect I had seen earlier with colour and reported it. But I was obviously wrong. The colour was either fixed since the day I saw it, or I had too much beer that day. Sorry.

Alex

  • You must to post comments
0
0

It’s a bug when using a theme font as the base. Logged as WJ-7469.

Theme fonts have the OriginalName starting with @. Like the theme colors. When you use new Font(font, style) System.Drawing copies over also the OriginalName and Wisej detects it as a theme font and doesn’t check if it was altered. If you create the font using the name it works.

You can also define several theme fonts and use them by name, like new Font(“@mybold”, …). Wisej will use the “mybold” font in the theme. Which can also be a webfont. The new build will also recognize SystemFonts by name if they are defined in the theme.

Cannot reproduce the issue with ForeColor.

Best,

Luca

  • You must to post comments
Showing 3 results
Your Answer
Post as a guest by filling out the fields below or if you already have an account.
Name*
E-mail*
Attachment
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