跟哪个一起使用啊?ListView还是listBox?
具体怎么使用?谢谢!

解决方案 »

  1.   

    一般而言不会单独使用,往往在 listview或listbox中使用,这是例子: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;
      

  2.   

    没有写说明?只有当listview为的viewstyle为vsreport时,headercontrol 才有用,
    在这里headercontrol中加了两项内容:
    // Create two columns to show during viewing as vsReport
        NewColumn := Columns.Add;
        NewColumn.Caption := 'Column 1';
        NewColumn := Columns.Add;
        NewColumn.Caption := 'Column 2';