首页 > 代码库 > Delphi 彩票抽奖机
Delphi 彩票抽奖机
unit Uni_pick;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, jpeg;type TForm1 = class(TForm) GroupBox1: TGroupBox; Label1: TLabel; Label2: TLabel; Label3: TLabel; Label4: TLabel; Label5: TLabel; Label6: TLabel; Label7: TLabel; Button1: TButton; Button2: TButton; Timer1: TTimer; Timer2: TTimer; Timer3: TTimer; Timer4: TTimer; Timer5: TTimer; Timer6: TTimer; Timer7: TTimer; Panel1: TPanel; Image1: TImage; GroupBox2: TGroupBox; Image9: TImage; Image8: TImage; Image2: TImage; Image3: TImage; Image4: TImage; Image5: TImage; Image6: TImage; Image7: TImage; procedure Timer1Timer(Sender: TObject); procedure Timer2Timer(Sender: TObject); procedure Timer3Timer(Sender: TObject); procedure Timer4Timer(Sender: TObject); procedure Timer5Timer(Sender: TObject); procedure Timer6Timer(Sender: TObject); procedure Timer7Timer(Sender: TObject); procedure ImageClick(Sender: TObject); procedure Button2Click(Sender: TObject); procedure Button1Click(Sender: TObject); procedure Image1Click(Sender: TObject); procedure FormCreate(Sender: TObject); procedure Image2Click(Sender: TObject); procedure Image3Click(Sender: TObject); procedure Image4Click(Sender: TObject); procedure Image5Click(Sender: TObject); procedure Image6Click(Sender: TObject); procedure Image7Click(Sender: TObject); procedure isAllcancel(); procedure isAllopen(); private { Private declarations } public { Public declarations } end;var Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Timer1Timer(Sender: TObject);begin Label1.Caption:=IntToStr(Random(9));end;procedure TForm1.Timer2Timer(Sender: TObject);begin Label2.Caption:=IntToStr(Random(9));end;procedure TForm1.Timer3Timer(Sender: TObject);begin Label3.Caption:=IntToStr(Random(9));end;procedure TForm1.Timer4Timer(Sender: TObject);begin Label4.Caption:=IntToStr(Random(9));end;procedure TForm1.Timer5Timer(Sender: TObject);begin Label5.Caption:=IntToStr(Random(9));end;procedure TForm1.Timer6Timer(Sender: TObject);begin Label6.Caption:=IntToStr(Random(9));end;procedure TForm1.Timer7Timer(Sender: TObject);begin Label7.Caption:=IntToStr(Random(9));end;procedure TForm1.Button2Click(Sender: TObject);var i:integer; s:TObject;begin {for i:=0 to Panel1.ControlCount-1 do begin if Panel1.Controls[i] is TImage then TImage(Panel1.Controls[i]).Picture.Assign(Image9.Picture); end;} for i:=0 to 6 do begin s:=FindComponent(‘Image‘+intToStr(i+1)); TImage(s).Picture.Assign(Image9.Picture); end; for i:=0 to componentCount-1 do begin if Components[i] is TTimer then TTimer(Components[i]).Enabled:=False; end; Button2.Enabled:=False; Button1.Enabled:=True;end;procedure TForm1.Button1Click(Sender: TObject);var i:integer; s:TObject;begin { for i:=0 to Panel1.ControlCount-1 do begin if Panel1.Controls[i] is TImage then TImage(Panel1.Controls[i]).Picture.Assign(Image8.Picture); end; } for i:=0 to 6 do begin s:=FindComponent(‘Image‘+intToStr(i+1)); TImage(s).Picture.Assign(Image8.Picture); end; for i:=0 to componentCount-1 do begin if Components[i] is TTimer then TTimer(Components[i]).Enabled:=true; end; Button1.Enabled:=False; Button2.Enabled:=true;end;procedure TForm1.Image1Click(Sender: TObject);begin ImageClick(Sender);end;procedure TForm1.Image2Click(Sender: TObject);begin ImageClick(Sender);end;procedure TForm1.Image3Click(Sender: TObject);begin ImageClick(Sender);end;procedure TForm1.Image4Click(Sender: TObject);begin ImageClick(Sender);end;procedure TForm1.Image5Click(Sender: TObject);begin ImageClick(Sender);end;procedure TForm1.Image6Click(Sender: TObject);begin ImageClick(Sender);end;procedure TForm1.Image7Click(Sender: TObject);begin ImageClick(Sender);end;procedure TForm1.ImageClick(Sender: TObject);var s:TObject;begin s:=FindComponent(‘Timer‘+intToStr(TImage(Sender).Tag+1)); if Assigned(s) then begin if TTimer(s).Enabled then begin TImage(Sender).Picture.Assign(Image9.Picture); TTimer(s).Enabled:=False; isAllcancel; end else begin TImage(Sender).Picture.Assign(Image8.Picture); TTimer(s).Enabled:=true; Button2.Enabled:=True; isAllopen; end; end;end;procedure TForm1.FormCreate(Sender: TObject);begin Image1.Picture.Assign(Image9.Picture); Image2.Picture.Assign(Image9.Picture); Image3.Picture.Assign(Image9.Picture); Image4.Picture.Assign(Image9.Picture); Image5.Picture.Assign(Image9.Picture); Image6.Picture.Assign(Image9.Picture); Image7.Picture.Assign(Image9.Picture);end;procedure TForm1.isAllcancel;var i,count:Integer;begin count:=0; for i:=0 to componentCount-1 do begin if (Components[i] is TTimer) and (TTimer(Components[i]).Enabled=false) then count:=count+1; end; if(count=7) then begin Button1.Enabled:=true; Button2.Enabled:=False; end;end;procedure TForm1.isAllopen;var i,count:Integer;begin count:=0; for i:=0 to componentCount-1 do begin if (Components[i] is TTimer) and (TTimer(Components[i]).Enabled=true) then count:=count+1; end; if(count=7) then begin Button1.Enabled:=False; Button2.Enabled:=true; end;end;end.
Delphi 彩票抽奖机
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。