Fórum Imagem #332974
10/11/2006
0
Pessoal alguem saberia me explicar como posso fazer pra pegar todas as imagens de uma determinada pasta digamos da pasta : C:\Documents and Settings\user\Meus documentos\Minhas imagens
e passar uma por uma na tela ... tipoo clika no botao proximo ele mostra a proxima imagem???
Output
Curtir tópico
+ 0Posts
11/11/2006
Output
Gostei + 0
05/12/2006
Output
private
{ Private declarations }
Lista: TStringList;
Count: Integer;
procedure BuscaListaArquivosPasta(pasta: string; lista: TStringList);
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.BuscaListaArquivosPasta(pasta: string; lista: TStringList);
var
x: integer;
SearchRec: TSearchRec;
intControl: integer;
ext: string;
begin
lista.Clear;
intControl:=FindFirst(pasta + ´\*.*´, faArchive, SearchRec);
if intControl = 0 then
begin
while (intControl = 0) do
begin
ext:=ExtractFileExt(SearchRec.Name);
if ((ext = ´.jpg´) or (ext = ´.jpeg´) or (ext = ´.bmp´) or (ext = ´.ico´) or (ext = ´.emf´) or (ext = ´.wmf´)) then
lista.Add(pasta + ´\´ + SearchRec.Name);
intControl:=FindNext(SearchRec);
end;
FindClose(SearchRec);
end;
for x:=lista.Count - 1 downto 0 do
if ((lista.Strings[x] = ´.´) or (lista.Strings[x] = ´..´)) then
lista.Delete(x);
end;
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
Lista:=TStringList.Create;
BuscaListaArquivosPasta(GetEnvironmentVariable(´USERPROFILE´) + ´\Meus Documentos\Minhas Figuras´,Lista);
Count:=0;
end;
procedure TForm1.BitBtn2Click(Sender: TObject);
begin
lblCaminho.Caption:=Lista.Strings[Count];
Image1.Picture.LoadFromFile(lblCaminho.Caption);
lblTamanho.Caption:=´Tamanho: ´ + IntToStr(Image1.Picture.Graphic.Width) + ´ X ´ + IntToStr(Image1.Picture.Graphic.Height);
if count = Lista.Count - 1 then
count:=0
else
Inc(Count);
end;
end.Gostei + 0
05/12/2006
Eniorm
abraço
Gostei + 0
05/12/2006
Ronithd
private
{ Private declarations }
Lista: TStringList;
Count: Integer;
procedure BuscaListaArquivosPasta(pasta: string; lista: TStringList);
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.BuscaListaArquivosPasta(pasta: string; lista: TStringList);
var
x: integer;
SearchRec: TSearchRec;
intControl: integer;
ext: string;
begin
lista.Clear;
intControl:=FindFirst(pasta + ´\*.*´, faArchive, SearchRec);
if intControl = 0 then
begin
while (intControl = 0) do
begin
ext:=ExtractFileExt(SearchRec.Name);
if ((ext = ´.jpg´) or (ext = ´.jpeg´) or (ext = ´.bmp´) or (ext = ´.ico´) or (ext = ´.emf´) or (ext = ´.wmf´)) then
lista.Add(pasta + ´\´ + SearchRec.Name);
intControl:=FindNext(SearchRec);
end;
FindClose(SearchRec);
end;
for x:=lista.Count - 1 downto 0 do
if ((lista.Strings[x] = ´.´) or (lista.Strings[x] = ´..´)) then
lista.Delete(x);
end;
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
Lista:=TStringList.Create;
BuscaListaArquivosPasta(GetEnvironmentVariable(´USERPROFILE´) + ´\Meus Documentos\Minhas Figuras´,Lista);
Count:=0;
end;
procedure TForm1.BitBtn2Click(Sender: TObject);
begin
lblCaminho.Caption:=Lista.Strings[Count];
Image1.Picture.LoadFromFile(lblCaminho.Caption);
lblTamanho.Caption:=´Tamanho: ´ + IntToStr(Image1.Picture.Graphic.Width) + ´ X ´ + IntToStr(Image1.Picture.Graphic.Height);
if count = Lista.Count - 1 then
count:=0
else
Inc(Count);
end;
end.Rodrigo, você poderia me ajudar de como se faz isso?
Gostei + 0
05/12/2006
Ronithd
private
{ Private declarations }
Lista: TStringList;
Count: Integer;
procedure BuscaListaArquivosPasta(pasta: string; lista: TStringList);
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.BuscaListaArquivosPasta(pasta: string; lista: TStringList);
var
x: integer;
SearchRec: TSearchRec;
intControl: integer;
ext: string;
begin
lista.Clear;
intControl:=FindFirst(pasta + ´\*.*´, faArchive, SearchRec);
if intControl = 0 then
begin
while (intControl = 0) do
begin
ext:=ExtractFileExt(SearchRec.Name);
if ((ext = ´.jpg´) or (ext = ´.jpeg´) or (ext = ´.bmp´) or (ext = ´.ico´) or (ext = ´.emf´) or (ext = ´.wmf´)) then
lista.Add(pasta + ´\´ + SearchRec.Name);
intControl:=FindNext(SearchRec);
end;
FindClose(SearchRec);
end;
for x:=lista.Count - 1 downto 0 do
if ((lista.Strings[x] = ´.´) or (lista.Strings[x] = ´..´)) then
lista.Delete(x);
end;
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
Lista:=TStringList.Create;
BuscaListaArquivosPasta(GetEnvironmentVariable(´USERPROFILE´) + ´\Meus Documentos\Minhas Figuras´,Lista);
Count:=0;
end;
procedure TForm1.BitBtn2Click(Sender: TObject);
begin
lblCaminho.Caption:=Lista.Strings[Count];
Image1.Picture.LoadFromFile(lblCaminho.Caption);
lblTamanho.Caption:=´Tamanho: ´ + IntToStr(Image1.Picture.Graphic.Width) + ´ X ´ + IntToStr(Image1.Picture.Graphic.Height);
if count = Lista.Count - 1 then
count:=0
else
Inc(Count);
end;
end.Rodrigo, você poderia me ajudar de como se faz isso?
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)