VB拼图游戏源代码_第1页
VB拼图游戏源代码_第2页
VB拼图游戏源代码_第3页
VB拼图游戏源代码_第4页
VB拼图游戏源代码_第5页
已阅读5页,还剩8页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、Dim a As Integer, b As Integer, c As Integer, d As Integer, e As String, jb As IntegerPrivate Sub End_Click()EndEnd SubPrivate Sub Form_Load() Dim i As Integer, a As Integer, b As Integer For i = 0 To 7 Image1(i).Picture = LoadPicture("C:UsersAdministratorDesktop图片" & (i + 1) & &qu

2、ot;.jpg") Label1(i).FontSize = 110 Next i RandomizeEnd SubPrivate Sub Image1_Click(Index As Integer) If Index = 8 Then If Image1(5).Picture = False Then Image2.Picture = Image1(8).Picture Image1(8).Picture = Image1(5).Picture Image1(5).Picture = Image2.Picture e = Label1(8).Caption Label1(8).Ca

3、ption = Label1(5).Caption Label1(5) = e Text3.Text = Val(Text3.Text) + 1 Timer2.Enabled = True Else If Image1(7).Picture = False Then Image2.Picture = Image1(8).Picture Image1(8).Picture = Image1(7).Picture Image1(7).Picture = Image2.Picture e = Label1(8).Caption Label1(8).Caption = Label1(7).Captio

4、n Label1(7) = e Text3.Text = Val(Text3.Text) + 1 Timer2.Enabled = True End If End If End If If Index = 6 Then If Image1(3).Picture = False Then Image2.Picture = Image1(6).Picture Image1(6).Picture = Image1(3).Picture Image1(3).Picture = Image2.Picture e = Label1(6).Caption Label1(6).Caption = Label1

5、(3).Caption Label1(3) = e Text3.Text = Val(Text3.Text) + 1 Timer2.Enabled = True Else If Image1(7).Picture = False Then Image2.Picture = Image1(6).Picture Image1(6).Picture = Image1(7).Picture Image1(7).Picture = Image2.Picture e = Label1(6).Caption Label1(6).Caption = Label1(7).Caption Label1(7) =

6、e Text3.Text = Val(Text3.Text) + 1 Timer2.Enabled = True End If End If End If If Index = 0 Then If Image1(3).Picture = False Then Image2.Picture = Image1(0).Picture Image1(0).Picture = Image1(3).Picture Image1(3).Picture = Image2.Picture e = Label1(0).Caption Label1(0).Caption = Label1(3).Caption La

7、bel1(3) = e Text3.Text = Val(Text3.Text) + 1 Timer2.Enabled = True Else If Image1(1).Picture = False Then Image2.Picture = Image1(0).Picture Image1(0).Picture = Image1(1).Picture Image1(1).Picture = Image2.Picture e = Label1(0).Caption Label1(0).Caption = Label1(1).Caption Label1(1) = e Text3.Text =

8、 Val(Text3.Text) + 1 Timer2.Enabled = True End If End If End If If Index = 2 Then If Image1(5).Picture = False Then Image2.Picture = Image1(2).Picture Image1(2).Picture = Image1(5).Picture Image1(5).Picture = Image2.Picture e = Label1(2).Caption Label1(2).Caption = Label1(5).Caption Label1(5) = e Te

9、xt3.Text = Val(Text3.Text) + 1 Timer2.Enabled = True Else If Image1(1).Picture = False Then Image2.Picture = Image1(2).Picture Image1(2).Picture = Image1(1).Picture Image1(1).Picture = Image2.Picture e = Label1(2).Caption Label1(2).Caption = Label1(1).Caption Label1(1) = e Text3.Text = Val(Text3.Tex

10、t) + 1 Timer2.Enabled = True End If End If End If If Index = 1 Then If Image1(0).Picture = False Then Image2.Picture = Image1(1).Picture Image1(1).Picture = Image1(0).Picture Image1(0).Picture = Image2.Picture e = Label1(1).Caption Label1(1).Caption = Label1(0).Caption Label1(0) = e Text3.Text = Val

11、(Text3.Text) + 1 Timer2.Enabled = True Else If Image1(2).Picture = False Then Image2.Picture = Image1(1).Picture Image1(1).Picture = Image1(2).Picture Image1(2).Picture = Image2.Picture e = Label1(1).Caption Label1(1).Caption = Label1(2).Caption Label1(2) = e Text3.Text = Val(Text3.Text) + 1 Timer2.

12、Enabled = True Else If Image1(4).Picture = False Then Image2.Picture = Image1(1).Picture Image1(1).Picture = Image1(4).Picture Image1(4).Picture = Image2.Picture e = Label1(1).Caption Label1(1).Caption = Label1(4).Caption Label1(4) = e Text3.Text = Val(Text3.Text) + 1 Timer2.Enabled = True End If En

13、d If End If End If If Index = 3 Then If Image1(0).Picture = False Then Image2.Picture = Image1(3).Picture Image1(3).Picture = Image1(0).Picture Image1(0).Picture = Image2.Picture e = Label1(3).Caption Label1(3).Caption = Label1(0).Caption Label1(0) = e Text3.Text = Val(Text3.Text) + 1 Timer2.Enabled

14、 = True Else If Image1(6).Picture = False Then Image2.Picture = Image1(3).Picture Image1(3).Picture = Image1(6).Picture Image1(6).Picture = Image2.Picture e = Label1(3).Caption Label1(3).Caption = Label1(6).Caption Label1(6) = e Text3.Text = Val(Text3.Text) + 1 Timer2.Enabled = True Else If Image1(4

15、).Picture = False Then Image2.Picture = Image1(3).Picture Image1(3).Picture = Image1(4).Picture Image1(4).Picture = Image2.Picture e = Label1(3).Caption Label1(3).Caption = Label1(4).Caption Label1(4) = e Text3.Text = Val(Text3.Text) + 1 Timer2.Enabled = True End If End If End If End If If Index = 7

16、 Then If Image1(8).Picture = False Then Image2.Picture = Image1(7).Picture Image1(7).Picture = Image1(8).Picture Image1(8).Picture = Image2.Picture e = Label1(7).Caption Label1(7).Caption = Label1(8).Caption Label1(8) = e Text3.Text = Val(Text3.Text) + 1 Timer2.Enabled = True Else If Image1(6).Pictu

17、re = False Then Image2.Picture = Image1(7).Picture Image1(7).Picture = Image1(6).Picture Image1(6).Picture = Image2.Picture e = Label1(7).Caption Label1(7).Caption = Label1(6).Caption Label1(6) = e Text3.Text = Val(Text3.Text) + 1 Timer2.Enabled = True Else If Image1(4).Picture = False Then Image2.P

18、icture = Image1(7).Picture Image1(7).Picture = Image1(4).Picture Image1(4).Picture = Image2.Picture e = Label1(7).Caption Label1(7).Caption = Label1(4).Caption Label1(4) = e Text3.Text = Val(Text3.Text) + 1 Timer2.Enabled = True End If End If End If End If If Index = 5 Then If Image1(8).Picture = Fa

19、lse Then Image2.Picture = Image1(5).Picture Image1(5).Picture = Image1(8).Picture Image1(8).Picture = Image2.Picture e = Label1(5).Caption Label1(5).Caption = Label1(8).Caption Label1(8) = e Text3.Text = Val(Text3.Text) + 1 Timer2.Enabled = True Else If Image1(2).Picture = False Then Image2.Picture

20、= Image1(5).Picture Image1(5).Picture = Image1(2).Picture Image1(2).Picture = Image2.Picture e = Label1(5).Caption Label1(5).Caption = Label1(2).Caption Label1(2) = e Text3.Text = Val(Text3.Text) + 1 Timer2.Enabled = True Else If Image1(4).Picture = False Then Image2.Picture = Image1(5).Picture Imag

21、e1(5).Picture = Image1(4).Picture Image1(4).Picture = Image2.Picture e = Label1(5).Caption Label1(5).Caption = Label1(4).Caption Label1(4) = e Text3.Text = Val(Text3.Text) + 1 Timer2.Enabled = True End If End If End If End If If Index = 4 Then If Image1(1).Picture = False Then Image2.Picture = Image

22、1(4).Picture Image1(4).Picture = Image1(1).Picture Image1(1).Picture = Image2.Picture e = Label1(4).Caption Label1(4).Caption = Label1(1).Caption Label1(1) = e Text3.Text = Val(Text3.Text) + 1 Timer2.Enabled = True Else If Image1(3).Picture = False Then Image2.Picture = Image1(4).Picture Image1(4).P

23、icture = Image1(3).Picture Image1(3).Picture = Image2.Picture e = Label1(4).Caption Label1(4).Caption = Label1(3).Caption Label1(3) = e Text3.Text = Val(Text3.Text) + 1 Timer2.Enabled = True Else If Image1(5).Picture = False Then Image2.Picture = Image1(4).Picture Image1(4).Picture = Image1(5).Pictu

24、re Image1(5).Picture = Image2.Picture e = Label1(4).Caption Label1(4).Caption = Label1(5).Caption Label1(5) = e Text3.Text = Val(Text3.Text) + 1 Timer2.Enabled = True Else If Image1(3).Picture = False Then Image2.Picture = Image1(4).Picture Image1(4).Picture = Image1(7).Picture Image1(7).Picture = I

25、mage2.Picture e = Label1(4).Caption Label1(4).Caption = Label1(7).Caption Label1(7) = e Text3.Text = Val(Text3.Text) + 1 Timer2.Enabled = True End If End If End If End If End IfEnd SubPrivate Sub sj_Click() If c = 0 Then c = 30 End If Timer1.Enabled = TrueEnd SubPrivate Sub stop_Click() Timer1.Enabl

26、ed = FalseEnd SubPrivate Sub Timer1_Timer() If Image1(8).Picture = False Then a = Format(Rnd * 1, 0) If a = 1 Then Image2.Picture = Image1(8).Picture Image1(8).Picture = Image1(5).Picture Image1(5).Picture = Image2.Picture e = Label1(8).Caption Label1(8).Caption = Label1(5).Caption Label1(5) = e Els

27、e Image2.Picture = Image1(8).Picture Image1(8).Picture = Image1(7).Picture Image1(7).Picture = Image2.Picture e = Label1(8).Caption Label1(8).Caption = Label1(7).Caption Label1(7) = e End If End If If Image1(6).Picture = False Then a = Format(Rnd * 1, 0) If a = 1 Then Image2.Picture = Image1(6).Pict

28、ure Image1(6).Picture = Image1(3).Picture Image1(3).Picture = Image2.Picture e = Label1(6).Caption Label1(6).Caption = Label1(3).Caption Label1(3) = e Else Image2.Picture = Image1(6).Picture Image1(6).Picture = Image1(7).Picture Image1(7).Picture = Image2.Picture e = Label1(6).Caption Label1(6).Capt

29、ion = Label1(7).Caption Label1(7) = e End If End If If Image1(0).Picture = False Then a = Format(Rnd * 1, 0) If a = 1 Then Image2.Picture = Image1(0).Picture Image1(0).Picture = Image1(3).Picture Image1(3).Picture = Image2.Picture e = Label1(0).Caption Label1(0).Caption = Label1(3).Caption Label1(3)

30、 = e Else Image2.Picture = Image1(0).Picture Image1(0).Picture = Image1(1).Picture Image1(1).Picture = Image2.Picture e = Label1(0).Caption Label1(0).Caption = Label1(1).Caption Label1(1) = e End If End If If Image1(2).Picture = False Then a = Format(Rnd * 1, 0) If a = 1 Then Image2.Picture = Image1

31、(2).Picture Image1(2).Picture = Image1(5).Picture Image1(5).Picture = Image2.Picture e = Label1(2).Caption Label1(2).Caption = Label1(5).Caption Label1(5) = e Else Image2.Picture = Image1(2).Picture Image1(2).Picture = Image1(1).Picture Image1(1).Picture = Image2.Picture e = Label1(2).Caption Label1

32、(2).Caption = Label1(1).Caption Label1(1) = e End If End If If Image1(1).Picture = False Then a = Format(Rnd * 2, 0) If a = 1 Then Image2.Picture = Image1(1).Picture Image1(1).Picture = Image1(0).Picture Image1(0).Picture = Image2.Picture e = Label1(1).Caption Label1(1).Caption = Label1(0).Caption L

33、abel1(0) = e Else If a = 0 Then Image2.Picture = Image1(1).Picture Image1(1).Picture = Image1(2).Picture Image1(2).Picture = Image2.Picture e = Label1(1).Caption Label1(1).Caption = Label1(2).Caption Label1(2) = e Else Image2.Picture = Image1(1).Picture Image1(1).Picture = Image1(4).Picture Image1(4

34、).Picture = Image2.Picture e = Label1(1).Caption Label1(1).Caption = Label1(4).Caption Label1(4) = e End If End If End If If Image1(3).Picture = False Then a = Format(Rnd * 2, 0) If a = 1 Then Image2.Picture = Image1(3).Picture Image1(3).Picture = Image1(0).Picture Image1(0).Picture = Image2.Picture

35、 e = Label1(3).Caption Label1(3).Caption = Label1(0).Caption Label1(0) = e Else If a = 0 Then Image2.Picture = Image1(3).Picture Image1(3).Picture = Image1(6).Picture Image1(6).Picture = Image2.Picture e = Label1(3).Caption Label1(3).Caption = Label1(6).Caption Label1(6) = e Else Image2.Picture = Im

36、age1(3).Picture Image1(3).Picture = Image1(4).Picture Image1(4).Picture = Image2.Picture e = Label1(3).Caption Label1(3).Caption = Label1(4).Caption Label1(4) = e End If End If End If If Image1(7).Picture = False Then a = Format(Rnd * 2, 0) If a = 1 Then Image2.Picture = Image1(7).Picture Image1(7).

37、Picture = Image1(8).Picture Image1(8).Picture = Image2.Picture e = Label1(7).Caption Label1(7).Caption = Label1(8).Caption Label1(8) = e Else If a = 0 Then Image2.Picture = Image1(7).Picture Image1(7).Picture = Image1(6).Picture Image1(6).Picture = Image2.Picture e = Label1(7).Caption Label1(7).Capt

38、ion = Label1(6).Caption Label1(6) = e Else Image2.Picture = Image1(7).Picture Image1(7).Picture = Image1(4).Picture Image1(4).Picture = Image2.Picture e = Label1(7).Caption Label1(7).Caption = Label1(4).Caption Label1(4) = e End If End If End If If Image1(5).Picture = False Then a = Format(Rnd * 2,

39、0) If a = 1 Then Image2.Picture = Image1(5).Picture Image1(5).Picture = Image1(8).Picture Image1(8).Picture = Image2.Picture e = Label1(5).Caption Label1(5).Caption = Label1(8).Caption Label1(8) = e Else If a = 0 Then Image2.Picture = Image1(5).Picture Image1(5).Picture = Image1(2).Picture Image1(2).Picture = Image2.Picture e = Label1(5).Caption Label1(5).Caption = Label1(2).Caption Label1(2) = e Else Image2.Picture = Image1(5).Picture Image1(5).Picture = Image1(4).Picture

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论