如何将带有listview前景的项目转换为数组? [英] How do I convert items with forecolor of listview to array?
本文介绍了如何将带有listview前景的项目转换为数组?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好,
我有4列的列表视图。在listview的每个项目中,我都有带颜色的文本。我想用颜色复制(转换)这些文本到数组[4]。我该怎么办?
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?
推荐答案
你必须为带有颜色的文字创建一个自定义商店:
You'll have to create a custom store for text with colors:
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.
这篇关于如何将带有listview前景的项目转换为数组?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文