我想添加一些字符串到一个ListView,但我不知道字符串可以多久。ListView麻烦添加项目和子项目
例如:
mystring := 'a'+|+'b'+|+ 'c'+|+ 'd'+|+ 'e'+|+ 'f'+|+ ....... '1000 of mystr';
我炸串后,我有:
'a'
'b'
'c'
.
.
.
'1000ofmystr'
我想一个新的项目添加到ListView其中 'A' 是标题和“B '和'C'是子项目。
然后添加一个新项目,其中'D'是标题,'E'和'F'是子项目。
然后继续像这样整个字符串,即使它在爆炸数据中有数百万个子字符串。
每三个子字符串都是一个ListView项目,直到字符串耗尽。
我不知道如何做到这一点,这就是为什么我在这里问。我想要做的是这样的画面:
我需要的东西,这样的代码:
ListView1.Items.Add;
ListView1.Caption:= StrArr[0]; // id of the book number one
SubItems.Add(StrArr[1]); //its title
SubItems.Add(StrArr[2]); // its editor
ListView1.Items.Add;
ListView1.Caption:= StrArr[3]; // id of the book number two
SubItems.Add(StrArr[4]); //its title
SubItems.Add(StrArr[5]); // its editor
ListView1.Items.Add;
ListView1.Caption:= StrArr[6]; // id of the book number three
// and so on for other books for an unknown number of strings
请告诉我正确的代码来做到这一点。
所以,尽管写的代码。什么阻止了你。 –
好吧我不知道主人做那就是那为什么我问他这样我想在图片中做什么https://s24.postimg.org/cry3s6hs5/Captussssssssre.png然后ListView1.Items.Add; ListView1.Caption:= StrArr [0];书号1 SubItems.Add(StrArr [1]); //其标题 SubItems.Add(StrArr [2]); //其编辑器 SubItems.Add(StrArr [3]);书号拖曳的编号 SubItems.Add(StrArr [4]); //其标题 SubItems.Add(StrArr [5]); //其编辑器 SubItems.Add(StrArr [6]); ///和其他书籍 UNTIL UNCKONOWN SubItems.Add(StrArr [100000000]); – Mario
这不是我们在这里。阅读[help] –