Fórum listview1 com Icons de extenção ? #356150
28/03/2008
0
aguardo respostas ? :wink:
flw
Warfighter
Curtir tópico
+ 0Posts
01/04/2008
Warfighter
Gostei + 0
01/04/2008
Tonidavi2004
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ShellApi, ComCtrls, StdCtrls, ImgList;
type
TForm1 = class(TForm)
Button1: TButton;
ListView1: TListView;
OpenDialog1: TOpenDialog;
ImageList1: TImageList;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var
List: TListItem;
Icon: TIcon;
Index: word;
begin
Index := 0;
if OpenDialog1.Execute then
begin
List := ListView1.Items.Add;
List.Caption := ExtractFileName(OpenDialog1.FileName);
try
Icon := TIcon.Create;
Icon.Handle := ExtractAssociatedIcon(Handle, PAnsiChar(OpenDialog1.FileName), Index);
List.ImageIndex := ImageList1.AddIcon(Icon);
finally
FreeAndNil(Icon);
end;
end;
end;
end.
Gostei + 0
02/04/2008
Warfighter
Isso seria possivel ?
Gostei + 0
03/04/2008
Tonidavi2004
Tipo esse exemplo não serviria pq os arquivos estão listados no listview1, eu gostaria de add os icons apartir de suas extenções de arquivo Ex: (.txt = .bmp = .jpg) Isso seria possivel ?
Seja mais claro, porque não estou entendendo o que vc quer realmente. Um abraço.
Gostei + 0
05/04/2008
Warfighter
arquivo.exe
arquivo.txt
arquivo.bmp
arquivo.jpg
gostaria que ele add os icons nesses arquivos dependendo de suas extenção
alguém sabe ?
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)