添加记录用checklistbox.items.add(string);
如果我想在这个item附一个看不到的值怎么做。
还有当我选中某行时,我如何知道我选中的是哪个item,我想得到这个item的值,
但s:=checklistbox.items.text
得到的是所有items的值
如果我想在这个item附一个看不到的值怎么做。
还有当我选中某行时,我如何知道我选中的是哪个item,我想得到这个item的值,
但s:=checklistbox.items.text
得到的是所有items的值
可能item没有tag属性,可以利用它的其它属性存贮值,或用data属性
procedure TForm1.FormCreate(Sender: TObject);
var
I: Integer;
ListItem: TListItem;
NewColumn: TListColumn;
begin
// Create a ListView item for each image in the ImageList
with ListView1 do
begin
SmallImages := ImageList1;
LargeImages := ImageList1;
for I := 0 to ImageList1.Count - 1 do
begin
ListItem := Items.Add;
Listitem.Caption := 'Image' + IntToStr(I); ListItem.ImageIndex := I;
end;
// Create two columns to show during viewing as vsReport
NewColumn := Columns.Add;
NewColumn.Caption := 'Column 1';
NewColumn := Columns.Add;
NewColumn.Caption := 'Column 2';
// Add View styles and constants to the Combo Box
ComboBox1.Items.AddObject('vsIcon', TObject(vsIcon));
ComboBox1.Items.AddObject('vsList', TObject(vsList));
ComboBox1.Items.AddObject('vsReport', TObject(vsReport)); ComboBox1.Items.AddObject('vsSmallIcon', TObject(vsSmallIcon));
// Display first item in the Combo Box
ComboBox1.ItemIndex := 0;
end;
end;procedure TForm1.ComboBox1Click(Sender: TObject);
begin
with ComboBox1 do
ListView1.ViewStyle := TViewStyle(Items.Objects[ItemIndex]);
end;
listview控件前面没checkbox
CheckListBox用法也是一样
但是我想添加这个items的checked是选中状态,怎么试都不行