I have a TWebLabel which I want to underline using code.
During design-time, I can underline it through the properties:
But in run-time, it's not showing as underlined:
How can I solve this underline issue or do this via code instead of a design-time property?
Here's what I've tried and the errors I got:
WebLinkLabel1.Font.Style.fsUnderline := True;[Error] illegal qualifier "." after "Style:set of TFontStyle"
WebLinkLabel1.Font.Style := fsUnderline;[Error] Incompatible types: got "TFontStyle" expected "set of TFontStyle""
WebLinkLabel1.Font.Style := [fsUnderline];No error, but the label isn't underlined. It's not working.
What is the correct way to underline a TWebLabel in TMS WEB Core using Delphi?



The
Styleproperty requires a set.So I needed to do the following in order to underline the
TWebLabelusing code:But also note that if you have any CSS classes attached to the
TWebLabelvia theElementClassNameproperty, then theFont.Stylewon't work at all. In this case, you need to underline theTWebLabelusing the following code:Alternatively, if you're using Bootstrap, then you can just add the
text-decoration-underlineclass to theElementClassNameproperty on the `TWebLabel. That will also underline it.