Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

changing forecolor mid sentence of label.caption

Status
Not open for further replies.

gmkfusion

Programmer
Feb 14, 2004
5
US
Hello,

I have searched the web and several of my VB books, and I can not find how to do this. I did it once a few weeks back, but did not save it or remember how. I am trying to change the font forecolor of one word within a label.caption sentence.

for example, label.caption of

Suspension types are Strut and SLA.

Any help, please.

tia,
fusion
 
It's easy if you use a RichTextBox. Look up SelStart, SeEnd and SelColor properties.

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'
 
Thank you johnwm, but I do not want to use the RichTextBox for this, and I did it before with a standard textbox. And if I remember, it was rather easy to do. Hopefully, someone can refresh me on this. I prefer to do it with a label or textbox.

Thanks,
gmkfusion
 
>I did it before with a standard textbox. And if I remember, it was rather easy to do

I think you misremember. Neither textboxes nor labels can mix fonts - not without subclassing them and making them ownerdraw, which doesn't fall in the category of "rather easy" (particularly for a label, which is a 'lightweight' control and doesn't have a window handle...)
 
Is there a reason why you don't want a RTB? If there is, we may look in other directions

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top