ListView Urgente ????

17/12/2003

1

Como eu faço p/a cada item do meu ListView ficar cada um com uma figura diferente....? eu monto o meu ListView em tempo de execução conforme os programas que eu tenho no meu banco de dados

e-mail: programadormaster@hotmail.com


Responder

Posts

17/12/2003

Motta

{coloque num form TListView;
TEdit;
TSpeedButton;
TImageList;
}
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Buttons, StdCtrls, ComCtrls, ImgList;

type
TForm1 = class(TForm)
ListView1: TListView;
Edit1: TEdit;
SpeedButton1: TSpeedButton;
ImageList1: TImageList;
procedure SpeedButton1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.SpeedButton1Click(Sender: TObject);
var li : TListItem;
begin
li := ListView1.Items.Add;
li.Caption := Edit1.Text;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
ListView1.LargeImages := ImageList1;
end;

end.


Responder

17/12/2003

Motta

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Buttons, StdCtrls, ComCtrls, ImgList;

type
TForm1 = class(TForm)
ListView1: TListView;
Edit1: TEdit;
SpeedButton1: TSpeedButton;
ImageList1: TImageList;
procedure SpeedButton1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
i : integer;
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.SpeedButton1Click(Sender: TObject);
var li : TListItem;
begin
li := ListView1.Items.Add;
li.Caption := Edit1.Text;
li.imageIndex := i;
Inc(i);
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
ListView1.LargeImages := ImageList1;
i:=0;
end;

end.


Responder