Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unit Unit1;
- interface
- uses
- Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
- Dialogs, ExtCtrls, StdCtrls, ComCtrls;
- type
- TForm1 = class(TForm)
- Image1: TImage;
- Timer1: TTimer;
- Button1: TButton;
- ListView1: TListView;
- OpenDialog1: TOpenDialog;
- procedure Timer1Timer(Sender: TObject);
- procedure Button1Click(Sender: TObject);
- private
- FCurFolder: string;
- FItemIndex: Integer;
- public
- { Public declarations }
- end;
- var
- Form1: TForm1;
- implementation
- {$R *.dfm}
- procedure TForm1.Button1Click(Sender: TObject);
- var
- I: Integer;
- Item: TListItem;
- begin
- if OpenDialog1.Execute then
- begin
- ListView1.Clear;
- FItemIndex := 0;
- FCurFolder := ExtractFilePath(OpenDialog1.FileName);
- ListView1.Items.BeginUpdate;
- try
- for I := 0 to OpenDialog1.Files.Count - 1 do
- begin
- Item := ListView1.Items.Add;
- Item.Caption := ExtractFileName(OpenDialog1.Files[I]);
- Item.SubItems.Add(OpenDialog1.Files[I]);
- Item.SubItems.Add(ExtractFileExt(OpenDialog1.Files[I]));
- end;
- finally
- ListView1.Items.EndUpdate;
- end;
- end;
- end;
- procedure TForm1.Timer1Timer(Sender: TObject);
- begin
- if FItemIndex < ListView1.Items.Count then
- Image1.Picture.LoadFromFile(FCurFolder + ListView1.Items[FItemIndex].Caption);
- if FItemIndex < ListView1.Items.Count - 1 then
- FItemIndex := FItemIndex + 1
- else
- FItemIndex := 0;
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement