http://mrxray.on.coocan.jp/Delphi/plSamples/790_ListView.htm
https://docwiki.embarcadero.com/CodeExamples/Sydney/en/ViewStyleProperty_(Delphi)
delphi ListView AddGroupItem
https://docwiki.embarcadero.com/RADStudio/Alexandria/en/Mobile_Tutorial%3A_Using_ListBox_Components_to_Display_a_Table_View_%28iOS_and_Android%29
12-1. 檔案總管的介面 表單檢視元件(ListView) 範例12-1
在範例12-1,我們的介面相當簡單,除了一個輸入資料的介面外,就是一個ListView。除了提到這些可看見的VCL元件外,我們還有放入一個Popup
menu以及一個ImageList在這個範例中。Popup
menu主要是提供滑鼠右鍵的功能選單,,而ImageList則是要提供一些Image給ListView使用。
var
item: TListItem;
I:integer;
begin
listView1.ViewStyle := vsReport;// Set ListView as report form
listView1.Columns.Add; // add 1 column
listView1.Columns.Add; // add another column
listView1.Column[0].Caption :='Serial Number'; // First column title
listView1.Column[1].Caption :='Name'; // The second column title
// Start filling the memory of this table below
// Each row of TListView is a TListItem object
item := listView1.Items.add; //Add a line, that is, add a TListItem object, and the Add function returns this TListItem object.
item.Caption := '1'; // The caption of the TLisItem object represents the first column of this row, that is, the first row and first column of the serial number column in your icon
// The SubItems of the TListItem object is a collection of strings, that is, the second to N columns of the row
item.SubItems.Add(' bian'); // Add the data in the first row and second column, which is the value of the name column
// ........
// Repeatedly add Columns and TListItem and its subitem to fill a table
for I:=0 to 13 do
begin
listView1.Items[i]:= '10'; // modify the first row and the first column
listView1.Items[i].SubItems[0]:='Zhang San'; // Modify the first row and second column
listView1.Items[i].SubItems[1]:='100 years old'; // modify the first row and the third column
listView1.items[i].subitems[2]:='110';//modify the first row and the fourth column
end;
end;
沒有留言:
張貼留言