Einzelnen Beitrag anzeigen

Benutzerbild von Luckie
Luckie

Registriert seit: 29. Mai 2002
37.621 Beiträge
 
Delphi 2006 Professional
 
#15

Re: Tlistbox und mehrere Ergebnisse nebeneinander?

  Alt 10. Jun 2004, 13:48
Zitat von OH:
Contains the list of items displayed by the list view.

property Items: TListItems;

Description

Use Items to directly access the TListItem objects that represent the items in the list. Setting this property at design time brings up the ListView Items Editor. Use this dialog to add or delete items or subitems, and to edit their display properties. At runtime, use each item's Caption, ImageIndex and StateIndex properties to change the appearance of the list items.

Warning: Items is read-only if the application is running in virtual mode.
Zitat:
This example requires only a blank form. All other objects: TListView, TListColumns, TListItems, are created dynamically. file.You must add comctrls to the uses clause of the unit file.
Delphi-Quellcode:
procedure TForm1.FormCreate(Sender: TObject);

const
  Names: array[0..5, 0..1] ofstring = (
    ('Rubble', 'Barney'),
    ('Michael', 'Johnson'),
    ('Bunny', 'Bugs'),
    ('Silver', 'HiHo'),
    ('Simpson', 'Bart'),
    ('Squirrel', 'Rocky')
    );

var
  I: Integer;
  NewColumn: TListColumn;
  ListItem: TListItem;
  ListView: TListView;
begin
  ListView := TListView.Create(Self);
  with ListView do
  begin
    Parent := Self;
    Align := alClient;

    ViewStyle := vsReport;

    NewColumn := Columns.Add;
    NewColumn.Caption := 'Last';
    NewColumn := Columns.Add;
    NewColumn.Caption := 'First';

    for I := Low(Names) to High(Names) do
    begin
      ListItem := Items.Add;
      ListItem.Caption := Names[I][0];
      ListItem.SubItems.Add(Names[I][1]);
    end;
  end;
end;
Michael
Ein Teil meines Codes würde euch verunsichern.
  Mit Zitat antworten Zitat