Multi Colored Text in Controls

wehttam13
01-09-2005, 06:40 PM
I'm trying to make a program that will make use of a combo box/list box sort of control that needs to have multiple lines of text. Each of these lines of text may need to be a different color. Are these controls capable of doing that, or is there another control that could do that?

thanks,
wehttam13

webbone
01-09-2005, 07:22 PM
There is a subclassing example in the code library that deals with what you are trying to do - not for the faint of heart but definitely doable: http://www.xtremevbtalk.com/showthread.php?s=&threadid=23505

lebb
01-09-2005, 07:32 PM
You can also simulate this effect by using a MSFlexGrid control instead of a listbox (with a single column, gridlines turned off, etc.). It is less flexible than the subclassing method, but also simpler.

wehttam13
01-11-2005, 08:13 AM
I tried using the subclassing method, but that doesn't work. The flexgrid doesn't appear to be what i'm looking for(it leaves one blank cell at the top of the control). Is there an API or anything else that will allow me to do this?

thanks,
wehttam13

lebb
01-11-2005, 08:30 AM
You shouldn't have a blank cell at the top. Either you've neglected to set FixedRows to 0, or else you need to adjust your code for the fact that flexgrids start numbering from 0 instead of 1. What do you mean, the subclassing method doesn't work?

wehttam13
01-11-2005, 04:57 PM
the line of code went like this: list1.additem "FC[red,green,blue]Text Goes here]".
i copied the code exactly, and i even used the project that the code author gave, but the List control read the string literally, instead of applying the color.

lebb
01-11-2005, 08:26 PM
If that's the way you typed it, it appears that you have an extra closing bracket in your text.

wehttam13
01-11-2005, 09:10 PM
If that's the way you typed it, it appears that you have an extra closing bracket in your text.


i accidentally mistyped it in my post. the way i have it in my code is: "FC[red,green,blue]Text Goes here".

lebb
01-11-2005, 09:23 PM
If you noticed from his instructions, the "red,green,blue" should contain actual numbers for the colors. So do you have those typed out, or are you using something like
"FC[0,80,255]Text Goes here"
or
"FC[" & red & "," & green & "," & blue & "]Text Goes here"
?

Of course you can always rewrite it to handle color names if you like.

wehttam13
01-12-2005, 04:57 PM
If you noticed from his instructions, the "red,green,blue" should contain actual numbers for the colors. So do you have those typed out, or are you using something like
"FC[0,80,255]Text Goes here"
or
"FC[" & red & "," & green & "," & blue & "]Text Goes here"
?

Of course you can always rewrite it to handle color names if you like.

I did put in numbers for the red,green,blue parts of the text. I ran the program that he had attached to the post, and that one did not work either. Apparently it worked for others who used it, but the same thing happened when I ran his program. When i added something to the listbox, it literally appeared "FC[red,green,blue] Text"

thanks,
wehttam13

lebb
01-12-2005, 05:16 PM
What numbers are you using? Can you attach a screen shot? Also, put some Debug.Print statements in the NewWindowProc sub to show you what the values of iRed, iGreen, and iBlue are getting set to at runtime.

wehttam13
01-12-2005, 05:48 PM
What numbers are you using? Can you attach a screen shot? Also, put some Debug.Print statements in the NewWindowProc sub to show you what the values of iRed, iGreen, and iBlue are getting set to at runtime.

Sorry for wasting anybody's time, but I just found out that the issue was the order that i connected the elements of the project in. The main module from the program downloaded from the page that has the project wasn't the startup module when i first tried it. this prevented some methods from being called, which prevented it from working properly.

thanks for your time,
wehttam13

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum