c# - How do I highlight a certain word in a label? -


i have been watching couple of videos , i've noticed can highlight or set backcolor every word finds in richtextbox, tried doing label i'm working on project can't use label.find , label.selectionbackcolor etc. there way search word in label , highlight it?

here workaround, create richtextbox , use label.

set these properties make label:

richtextbox.readonly = true; richtextbox.borderstyle = borderstyle.none; richtextbox.backcolor = systemcolors.control; // or whatever background color 

work around disable user selection:

richtextbox.enabled = false; richtextbox.selectall(); richtextbox.selectioncolor = systemcolors.controltext; // or whatever want default text color // have set color or else gray because of enabled=false 

edit: tried it, after selectall(); , selectioncolor = systemcolors.controltext changing or adding of text keeps black (unless current selectionstart @ point of text color different


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -