c# - Winforms - Underline part of text to be displayed in textbox -
i have line of text display , want underline heading portion of text in display. how accomplish please?
message: message name of client.
where "message:" underlined.
if want show text using rich text box, this:
richtextbox1.selectionfont = new font("times new roman", 10, fontstyle.underline); richtextbox1.selectedtext = "message:"; richtextbox1.selectionfont = new font("times new roman", 10, fontstyle.regular); richtextbox1.selectedtext = " message name of client."; or, if message dynamic , header , text separated colon, this:
string message = "message: message name of client"; string[] parts = message.split(':'); richtextbox1.selectionfont = new font("times new roman", 10, fontstyle.underline); richtextbox1.selectedtext = parts[0] + ":"; richtextbox1.selectionfont = new font("times new roman", 10, fontstyle.regular); richtextbox1.selectedtext = parts[1]; or, if want show text dynamically in labels, this:
string message = "message: message name of client"; string[] parts = message.split(':'); label heading = new label(); heading.text = parts[0] + ":"; heading.font= new font("times new roman", 10, fontstyle.underline); heading.autosize = true; flowlayoutpanel1.controls.add(heading); label message = new label(); message.text = parts[1]; message.font = new font("times new roman", 10, fontstyle.regular); message.autosize = true; flowlayoutpanel1.controls.add(message);
Comments
Post a Comment