应X86的说法,俺不采用新的.NET编程工具,用Delphi 6编写。源代码如下:
unit Unit1;
interface
uses
Windows,FileCtrl,Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, jpeg;
type
TForm1 = class(TForm)
Panel1: TPanel;
ScrollBox1: TScrollBox;
Image1: TImage;
Timer1: TTimer;
procedure Timer1Timer(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormKeyPress(Sender: TObject; var Key: Char);
procedure Image1ContextPopup(Sender: TObject; MousePos: TPoint;
var Handled: Boolean);
procedure Image1DblClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
mm:array[1..300] of string;
i:integer=1;
j:integer=1;
implementation
{$R *.dfm}
procedure TForm1.Timer1Timer(Sender: TObject);
begin
image1.Picture.LoadFromFile(mm[j]);
j:=j+1;
if j=i then
begin
Timer1.Enabled:=False;
if Messagebox(0,chr(13)+';目录内的文件已经播放完毕,是否再看一遍?';,';→无条件为你⊙提示您:';,MB_YESNO+MB_ICONINFORMATION)=IDNO then close;
j:=1;
Timer1.Enabled:=True;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
var
sr:TSearchRec;
d:string;
begin
SelectDirectory(';选择目录:';,';';,d);
if length(d)=0 then
begin
Messagebox(0,chr(13)+';你没有选择任何目录,因此无法启动本程序进行图片播放!';,';→无条件为你⊙制作,联系QQ:335342';,MB_OK+MB_ICONSTOP);
halt;
end;
form1.WindowState:=wsMaximized;
form1.BorderStyle:=bsNone;
form1.KeyPreview:=True;
image1.Center:=True;
Panel1.Caption:=';按数字键盘区的1~9之间的数字调整播放速度,在屏幕上方双击鼠标控制播放的 暂停/继续,按Alt+F4键或ESC直接退出!';;
ChDir(d);
if FindFirst(';*.*';, faAnyFile, sr) = 0 then
begin
repeat
if pos(';.jpg';,lowercase(sr.Name))+pos(';.bmp';,lowercase(sr.Name))>0 then
begin
mm:=sr.Name;
i:=i+1;
end;
until FindNext(sr) <> 0;
FindClose(sr);
end;
if i=1 then
begin
Messagebox(0,chr(13)+';所选择目录中不存在JPG或BMP格式的图片,播放图片失败,程序终止!';,';→无条件为你⊙制作,联系QQ:335342';,MB_OK+MB_ICONSTOP);
halt;
end;
Timer1.Enabled:=True;
end;
procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char);
begin
if key in [';1';..';9';] then Timer1.Interval:=strtoint(key)*300;
if key=#27 then close;
end;
procedure TForm1.Image1ContextPopup(Sender: TObject; MousePos: TPoint;
var Handled: Boolean);
begin
Panel1.Visible:= Not Panel1.Visible;
end;
procedure TForm1.Image1DblClick(Sender: TObject);
begin
Timer1.Enabled:=Not Timer1.Enabled;
end;
end.
|