1 unit Unit6; 2 3 interface 4 5 uses 6 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 7 Dialogs, bsSkinData, BusinessSkinForm, bsSkinCtrls, ImgList, ExtCtrls, 8 StdCtrls, bsSkinBoxCtrls, GIFImg, bsSkinExCtrls; 9 10 type 11 TForm6 = class(TForm) 12 bsBusinessSkinForm1: TbsBusinessSkinForm; 13 bsSkinData1: TbsSkinData; 14 bsCompressedStoredSkin1: TbsCompressedStoredSkin; 15 Panel: TPanel; 16 Panel1: TPanel; 17 Panel2: TPanel; 18 Panel3: TPanel; 19 Panel4: TPanel; 20 Panel5: TPanel; 21 Panel6: TPanel; 22 Panel7: TPanel; 23 Panel8: TPanel; 24 Panel9: TPanel; 25 Panel10: TPanel; 26 Panel11: TPanel; 27 Panel12: TPanel; 28 Panel13: TPanel; 29 Panel14: TPanel; 30 Panel15: TPanel; 31 Panel16: TPanel; 32 Panel17: TPanel; 33 Panel18: TPanel; 34 Panel19: TPanel; 35 Panel20: TPanel; 36 Panel21: TPanel; 37 Panel22: TPanel; 38 Panel23: TPanel; 39 Panel24: TPanel; 40 Panel25: TPanel; 41 bsSkinButton1: TbsSkinButton; 42 bsSkinMemo1: TbsSkinMemo; 43 bsSkinComboBox1: TbsSkinComboBox; 44 Label1: TLabel; 45 bsSkinButton2: TbsSkinButton; 46 Image1: TImage; 47 procedure FormCreate(Sender: TObject); 48 procedure Panel1Click(Sender: TObject); 49 procedure bsSkinButton1Click(Sender: TObject); 50 procedure bsSkinComboBox1Click(Sender: TObject); 51 procedure bsSkinButton2Click(Sender: TObject); 52 private 53 { Private declarations } 54 public 55 { Public declarations } 56 end; 57 58 var 59 Form6: TForm6; 60 p:array[1..25] of TPanel; 61 c:array[1..25] of Boolean; 62 cl:Tcolor; 63 implementation 64 65 {$R *.dfm} 66 67 68 69 procedure TForm6.bsSkinButton1Click(Sender: TObject); 70 var i:integer; 71 begin 72 for I := 1 to 25 do 73 begin 74 p[i].Tag:=i; 75 c[i]:=false; 76 p[i].Color:=clBlack; 77 end; 78 end; 79 80 procedure TForm6.bsSkinButton2Click(Sender: TObject); 81 begin 82 application.MessageBox('卓寿杰 1312070327','关于',1) ; 83 end; 84 85 procedure TForm6.bsSkinComboBox1Click(Sender: TObject); 86 begin 87 if bsSkinComboBox1.ItemIndex=0 then 88 cl:=clRed; 89 if bsSkinComboBox1.ItemIndex=1 then 90 cl:=clYellow; 91 if bsSkinComboBox1.ItemIndex=2 then 92 cl:=clBlue; 93 94 end; 95 96 procedure TForm6.FormCreate(Sender: TObject); 97 var i:integer; 98 begin 99 p[1]:=Panel1; 100 p[2]:=Panel2; 101 p[3]:=Panel3; 102 p[4]:=Panel4; 103 p[5]:=Panel5; 104 p[6]:=Panel6; 105 p[7]:=Panel7; 106 p[8]:=Panel8; 107 p[9]:=Panel9; 108 p[10]:=Panel10; 109 p[11]:=Panel11; 110 p[12]:=Panel12; 111 p[13]:=Panel13; 112 p[14]:=Panel14; 113 p[15]:=Panel15; 114 p[16]:=Panel16; 115 p[17]:=Panel17; 116 p[18]:=Panel18; 117 p[19]:=Panel19; 118 p[20]:=Panel20; 119 p[21]:=Panel21; 120 p[22]:=Panel22; 121 p[23]:=Panel23; 122 p[24]:=Panel24; 123 p[25]:=Panel25; 124 for I := 1 to 25 do 125 begin 126 p[i].Tag:=i; 127 c[i]:=false; 128 p[i].Color:=clBlack; 129 end; 130 bsskincombobox1.Items.Add('红'); 131 bsskincombobox1.Items.Add('黄'); 132 bsskincombobox1.Items.Add('蓝'); 133 bsskinComboBox1.ItemIndex:=0; 134 135 136 Image1.AutoSize := True; 137 Form6.Autosize := True; Image1.Picture.LoadFromFile('E:微云delphi电灯游戏a.gif'); 138 TGIFImage(Image1.Picture.Graphic).AnimationSpeed := 100; 139 TGIFImage(Image1.Picture.Graphic).Animate := True; 140 end; 141 142 143 procedure Change(i:integer); 144 begin 145 146 c[i]:= not c[i]; 147 if c[i] then 148 p[i].Color:=cl 149 else 150 p[i].Color:=clBlack; 151 end; 152 153 154 function CheckWin:Boolean; 155 var i:integer; 156 begin 157 result:=True; 158 for I := 1 to 25 do 159 if not c[i] then 160 begin 161 result:=false; 162 exit; 163 end; 164 end; 165 166 167 168 procedure TForm6.Panel1Click(Sender: TObject); 169 170 var i,j:integer; 171 begin 172 i:=TPanel(Sender).Tag; 173 change(i); 174 if i>5 then change(i-5); 175 if i<21 then change(i+5); 176 if (i mod 5)<>0 then change(i+1); 177 if (i mod 5)<>1 then change(i-1) ; 178 if CheckWin then Application.MessageBox('你赢了','提示信息',64); 179 end; 180 181 end.