1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
| unit ListView_MainForm;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ComCtrls;
type
TForm1 = class(TForm)
ListView1: TListView;
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure ListView1Data(Sender: TObject; Item: TListItem);
private
{ Déclarations privées }
public
{ Déclarations publiques }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
ListView1.Items.Count := 10000;
end;
procedure TForm1.ListView1Data(Sender: TObject; Item: TListItem);
var
S: string;
begin
Item.Caption := Item.Index.ToString();
if Item.SubItems.Count = 0 then
begin
S := StringOfChar('B', Item.Index);
Item.SubItems.Add(Length(S).ToString() + ' ' + S);
S := StringOfChar('C', Item.Index);
Item.SubItems.Add(Length(S).ToString() + ' ' + S);
S := StringOfChar('D', Item.Index);
Item.SubItems.Add(Length(S).ToString() + ' ' + S);
end
else
begin
Item.SubItems[0] := 'Cas Impossible';
Item.SubItems[1] := 'en OwnerData';
end;
end;
end. |
Partager