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
Post a Comment