Changing color with in a single label??

  • Thread starter Thread starter Bob Achgill
  • Start date Start date
B

Bob Achgill

Label example: "See the dog run."

I would like to be able to highlight a given word in the
example label using another color than the rest of the
words in the sentence and/or maybe underline the
highlighted word.

Said another way...Does labels support in-line font/color
tags for setting text properties such as HTML does?

If not... then I guess I will need to dynamically
concatenate and display labels on the form for each word
using the desired font/color to build out the sentence.
If I want to do this sizing at run time then how can I
know how much width (pixels) to allocate for each label
such that I can place them neatly end to end?

Maybe I should be using a text box??
 
Hi Bob,

In my opinion you can use GDI, however when it was my problem I would first
look what the Rich Text Box could do for me. (I never have done this
problem)

Cor.
 
* "Cor Ligthert said:
In my opinion you can use GDI, however when it was my problem I would first
look what the Rich Text Box could do for me. (I never have done this
problem)

Full ACK. The RichTextBox is the way to go (locked + cursor set to an
arrow etc.).
 
Rich Text Box did great!

Here is Hello World written to MyRichTextBox

rtbMyRichTextBox.SelectionFont = New Font("arial", 12,
FontStyle.Bold)

rtbMyRichTextBox.SelectionColor = Color.Red

rtbMyRichTextBox.SelectedText() = "Hello "

rtbMyRichTextBox.SelectionFont = New Font("arial", 10,
FontStyle.Bold)

rtbWordSentence.SelectionColor = Color.Black

rtbMyRichTextBox.SelectedText() = "World"
 
I take it that "locked" means to set the Rich text Box
Property: Read only set to true

But what does "set to arrow mean"?

Just wondering.

Thanks!
 
Hi Bob,

The cursor is the mouspointer, that is normal the Arrow, so you can set that
to an arrow for that box
\\\\
Me.RichTextBox1.Cursor = Cursors.Arrow
////
Cor
 
* "Cor Ligthert said:
The cursor is the mouspointer, that is normal the Arrow, so you can set that
to an arrow for that box
\\\\
Me.RichTextBox1.Cursor = Cursors.Arrow
////

ACK. In addition to that, we must prevent the user from selecting
text... I am not sure at the moment how to do that.
 
Back
Top