Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Changing color with in a single label??

0 views
Skip to first unread message

Bob Achgill

unread,
May 11, 2004, 2:52:58 AM5/11/04
to
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??

Cor Ligthert

unread,
May 11, 2004, 3:04:55 AM5/11/04
to
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.

Herfried K. Wagner [MVP]

unread,
May 11, 2004, 6:29:04 AM5/11/04
to
* "Cor Ligthert" <notfir...@planet.nl> scripsit:

> 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.).

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Bob Achgill

unread,
May 11, 2004, 10:32:43 AM5/11/04
to
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"

>.
>

Bob Achgill

unread,
May 11, 2004, 4:01:32 PM5/11/04
to
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!

>.
>

Cor Ligthert

unread,
May 11, 2004, 4:10:20 PM5/11/04
to
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


Herfried K. Wagner [MVP]

unread,
May 11, 2004, 4:28:51 PM5/11/04
to
* "Cor Ligthert" <notfir...@planet.nl> scripsit:

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

0 new messages