unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls;
type
TForm1 = class(TForm)
ListView1: TListView;
procedure FormShow(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormShow(Sender: TObject);
var
i: Integer;
x: Integer;
r: TRect;
pb: TProgressBar;
begin
Listview1.ViewStyle := vsReport;
Listview1.Columns.Add.Width := 100;
Listview1.Columns.Add.Width := 200;
for i:=0 to 200 do
begin
x := Random(100);
Listview1.Items.Add.Caption := 'Wert: ' + IntToStr(x);
r := Listview1.Items[i].DisplayRect(drBounds);
r.Left := r.Left + Listview1.columns[0].Width;
r.Right := r.Left + Listview1.columns[1].Width;
pb := TProgressBar.Create(Self);
pb.Parent := Listview1;
pb.BoundsRect := r;
pb.Position := x;
Listview1.Items[i].Data := pb;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
with Form1 do
begin
Top := 200;
Left := 200;
Height := 250;
Width := 400;
end;
with ListView1 do
begin
Left := 16;
Top := 16;
Height := 185;
Width := 360;
end;
end;
end.