Changing text style of one word only within a label to bold or underline

How can I change the style of a word within a label

E.g. if I have a label that says:

Enter your user name

and I want the word "Enter" to be displayed with an underline and in a blue color, how can I do this I tried using html : <u>Enter</u> . . . but this didn't work.



Answer this question

Changing text style of one word only within a label to bold or underline

  • Alberto Grasso

    I realize that I can use two labels (actually I need 3 because the word I want to change is in the middle of a sentence), but this seems like a ridiculous solution to me. There must be some kind of an escape sequence that can convert the text to the required style in a simple way. I know that in Java html coding can be used.


  • rgallazzi

    There is a very simple solution-Use two labels next to each other :)

    For the first label,specify AutoSize = true and then set up the Font color,bold and underline.As for the second label,place it next to the label1 control by deternining the width and height and startposition of label1.Set up nornaml fonts for it and it should work :)

    Let me know if you still have a problem


  • smilyFace

    Nasty,but even this works-

    Draw directly to the form using GDI+ in the Paint event using the Graphics.DrawText.Specify the fonts for each of the text u want to write.Uae MeasureString to measure the width to position individual strings.


  • qtvali

    Hi,

    Is your problem solved

    Thank you,
    Bhanu.



  • Changing text style of one word only within a label to bold or underline