万一---使用 TListView 控件(1)
转载自 万一的 Delphi 博客
当时我就想: 一定要理顺它, 这是个常用且复杂的控件!
本例效果图:
代码文件:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls;
type
TForm1 = class(TForm)
ListView1: TListView;
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
ListView1.Items.Add.Caption := 'Item' + IntToStr(ListView1.Items.Count);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
ListView1.Clear;
end;
end.