list box caracters format

M

Mihai

In a list box I have on each line a combination of string1 + String2.
I want to write string 1 with a colour and string2 with another colour.
I tried to use string1.format but I cannot find any styles arguments for
string.

Is it possible ?
If yes, please give me an example .

regards,
Mihai
 
L

Lloyd Sheen

Mihai said:
In a list box I have on each line a combination of string1 + String2.
I want to write string 1 with a colour and string2 with another colour.
I tried to use string1.format but I cannot find any styles arguments for
string.

Is it possible ?
If yes, please give me an example .

regards,
Mihai

Mihai,

Colors have nothing to do with strings, that is why you would see no
arguments like that.

Is this a windows app or asp?

For a listview in a windows app you cannot have different colors for the
same item. The string you would provide would be one color not a
combination.

For asp you create a listitem and apply attributes to it to get the back
and fore colors. There is still a restriction that the entire string will
be the fore color so again no multi-color listitems.


Lloyd Sheen
 
H

Herfried K. Wagner [MVP]

Mihai said:
In a list box I have on each line a combination of string1 + String2.
I want to write string 1 with a colour and string2 with another colour.
I tried to use string1.format but I cannot find any styles arguments for
string.

Is it possible ?

Not out of the box. You may want to take a look at the listbox' 'DrawMode'
property and its 'OnDrawItem' and 'OnMeasureItem' methods, which can be used
to add custom drawing to the controls.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top