当前位置:编程学习 > VB >>

谁有记忆拼图的vb 程式

追问:大哥可不可以发个,form 给我, rengmo1@163.com
答案:Dim numer() As Integer
Dim nn() As Integer
Dim WhichVisible() As Integer
Dim kk As Integer
Dim ck As Integer
Dim a As Integer, b As Integer
Dim o As Integer
Dim Tf As Boolean
Dim r As Integer

Private Sub bb_Click()
End
End Sub

Private Sub dd_Click()
Dim e As Integer
Dim q As Integer
If kk > 0 Then
For i = 1 To 8
Unload Image1(i)
Next
End If
e = 8
q = 2
Image1(0).Visible = False
Call abc(e, q)
ReDim Preserve WhichVisible(0 To 8)
ReDim numer(1 To 4)
 numer(1) = Int(Rnd * 7) + 1
    Do
        numer(2) = Int(Rnd * 7) + 1
    Loop While numer(1) = numer(2)
    Do
        numer(3) = Int(Rnd * 7) + 1
    Loop While numer(1) = numer(3) Or numer(2) = numer(3)
    Do
        numer(4) = Int(Rnd * 7) + 1
    Loop While numer(1) = numer(4) Or numer(2) = numer(4) Or numer(3) = numer(4)
ReDim nn(8, 2)
For i = 1 To 4
nn(i, 2) = numer(Int(Rnd * 2) + 1)
nn(i + 4, 2) = nn(i, 2)
Image1(i).Picture = LoadPicture(App.Path & "\" & 8 & ".jpg")
Next
End Sub

Private Sub ee_Click()
Dim s As Integer
Dim z As Integer

  If kk > 0 Then
    For i = 1 To 4
    Unload Image1(i)
    Next
End If
s = 4
z = 2

Image1(0).Visible = False
Call abc(s, z)
ReDim Preserve WhichVisible(0 To 4)
ReDim numer(1 To 2)
numer(1) = Int(Rnd * 7) + 1
    Do
        numer(2) = Int(Rnd * 7) + 1
    Loop While numer(1) = numer(2)
ReDim nn(1 To 4, 1 To 2)
For i = 1 To 4
nn(i, 2) = numer(Int(Rnd * 2) + 1)
Image1(i).Picture = LoadPicture(App.Path & "\" & 8 & ".jpg")
Next
End Sub

 

Private Sub Image1_Click(Index As Integer)
Static z12 As Integer, z21 As Integer
Debug.Print Index
 ck = ck + 1
If ck Mod 2 <> 0 Then
 a = Index
 Image1(a).Picture = LoadPicture(App.Path & "\" & nn(a, 2) & ".jpg")
 WhichVisible(a) = True
 If a <> b Then
 If WhichVisible(a) And WhichVisible(b) Then
 If nn(a, 2) = nn(b, 2) Then
Tf = True
 End If
End If
End If
 Timer1.Enabled = True
               
    Else
       b = Index
         Image1(b).Picture = LoadPicture(App.Path & "\" & nn(b, 2) & ".jpg")
        WhichVisible(b) = True
                If a <> b Then
                    If WhichVisible(a) And WhichVisible(b) Then
                         If nn(a, 2) = nn(b, 2) Then
                             Tf = True
                         End If
                    End If
                 End If
        Timer2.Enabled = True
  End If
      
End Sub
Public Sub abc(k, x)
For n = 1 To k
Load Image1(n)
kk = n
Image1(n).Visible = True
Image1(n).Top = -200 + Int((n + 1) / x) * 800
Image1(n).Left = (n Mod x) * 1000 + 150
Image1(n).Picture = LoadPicture(App.Path & "\" & 8 & ".jpg")
Next
End Sub

Private Sub Timer1_Timer()
If Tf Then
                  Debug.Print "dsdsdsdsdsdsdsdsdsdsd"; a; b
 Image1(a).Visible = False
 Image1(b).Visible = False
 Tf = False
 kk = kk - 2.1
 If kk = 0 Then
 r = MsgBox("恭喜你赢了,你是个天才", vbOKOnly, "做人要知足,赢了就放电脑一次吧")
End
 End If
 Else
Image1(a).Picture = LoadPicture(App.Path & "\" & 8 & ".jpg")
WhichVisible(a) = False
End If
 Timer1.Enabled = False
 
  End Sub

Private Sub Timer2_Timer()
If Tf Then

Image1(a).Visible = False
Image1(b).Visible = False
 Tf = False
 kk = kk - 2.1
 If kk = 0 Then
r = MsgBox("恭喜你赢了", vbOKOnly, "嘿嘿")
End
End If
 Else
Image1(b).Picture = LoadPicture(App.Path & "\" & 8 & ".jpg")
WhichVisible(b) = False
End If
 Timer2.Enabled = False
End Sub

上一个:How to read the internal table from VB?
下一个:vb中的start和shell的区别

CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,