Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

i have a listview with 4 columns. In every items of listview, i have text with color. I want to copy(convert) these texts with color to array[4]. How can i do it?
Posted
Comments
[no name] 27-Jul-15 8:36am    
Once it's out of your listview, you will lose your color. Strings do not have colors.
lukeer 27-Jul-15 9:24am    
You could store the color alongside its text in a custom class.

1 solution

You'll have to create a custom store for text with colors:
C#
public class ColoredText
{
    public Color TextColor { get; private set; }
    public String Text { get; private set; }

    public ColoredText(Color color, String text)
    {
        TextColor = color;
        Text = text;
    }
}

// Store four texts along with their colors
ColoredText[] line = new ColoredText[4];
You can then store four texts with their respective colors in the line variable.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900