⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.frm

📁 VB写的魔方游戏
💻 FRM
📖 第 1 页 / 共 3 页
字号:
      Width           =   180
   End
   Begin VB.Label Label1 
      Appearance      =   0  'Flat
      AutoSize        =   -1  'True
      BackColor       =   &H80000005&
      BackStyle       =   0  'Transparent
      Caption         =   "12"
      ForeColor       =   &H000000FF&
      Height          =   195
      Index           =   11
      Left            =   2880
      TabIndex        =   11
      Top             =   1680
      Visible         =   0   'False
      Width           =   180
   End
   Begin VB.Label Label1 
      Appearance      =   0  'Flat
      AutoSize        =   -1  'True
      BackColor       =   &H80000005&
      BackStyle       =   0  'Transparent
      Caption         =   "11"
      ForeColor       =   &H000000FF&
      Height          =   195
      Index           =   10
      Left            =   3000
      TabIndex        =   10
      Top             =   1560
      Visible         =   0   'False
      Width           =   180
   End
   Begin VB.Label Label1 
      Appearance      =   0  'Flat
      AutoSize        =   -1  'True
      BackColor       =   &H80000005&
      BackStyle       =   0  'Transparent
      Caption         =   "10"
      ForeColor       =   &H000000FF&
      Height          =   195
      Index           =   9
      Left            =   4560
      TabIndex        =   9
      Top             =   1080
      Visible         =   0   'False
      Width           =   180
   End
   Begin VB.Label Label1 
      Appearance      =   0  'Flat
      AutoSize        =   -1  'True
      BackColor       =   &H80000005&
      BackStyle       =   0  'Transparent
      Caption         =   "9"
      ForeColor       =   &H000000FF&
      Height          =   195
      Index           =   8
      Left            =   4920
      TabIndex        =   8
      Top             =   1080
      Visible         =   0   'False
      Width           =   90
   End
   Begin VB.Label Label1 
      Appearance      =   0  'Flat
      AutoSize        =   -1  'True
      BackColor       =   &H80000005&
      BackStyle       =   0  'Transparent
      Caption         =   "8"
      ForeColor       =   &H000000FF&
      Height          =   195
      Index           =   7
      Left            =   6240
      MouseIcon       =   "Main.frx":1E9FB0
      TabIndex        =   7
      Top             =   1800
      Visible         =   0   'False
      Width           =   90
   End
   Begin VB.Label Label1 
      Appearance      =   0  'Flat
      AutoSize        =   -1  'True
      BackColor       =   &H80000005&
      BackStyle       =   0  'Transparent
      Caption         =   "7"
      ForeColor       =   &H000000FF&
      Height          =   195
      Index           =   6
      Left            =   6120
      TabIndex        =   6
      Top             =   1920
      Visible         =   0   'False
      Width           =   90
   End
   Begin VB.Label Label1 
      Appearance      =   0  'Flat
      AutoSize        =   -1  'True
      BackColor       =   &H80000005&
      BackStyle       =   0  'Transparent
      Caption         =   "6"
      ForeColor       =   &H000000FF&
      Height          =   195
      Index           =   5
      Left            =   4200
      TabIndex        =   5
      Top             =   2640
      Visible         =   0   'False
      Width           =   90
   End
   Begin VB.Label Label1 
      Appearance      =   0  'Flat
      AutoSize        =   -1  'True
      BackColor       =   &H80000005&
      BackStyle       =   0  'Transparent
      Caption         =   "5"
      ForeColor       =   &H000000FF&
      Height          =   195
      Index           =   4
      Left            =   3840
      TabIndex        =   4
      Top             =   2640
      Visible         =   0   'False
      Width           =   90
   End
   Begin VB.Label Label1 
      Appearance      =   0  'Flat
      AutoSize        =   -1  'True
      BackColor       =   &H80000005&
      BackStyle       =   0  'Transparent
      Caption         =   "4"
      ForeColor       =   &H000000FF&
      Height          =   195
      Index           =   3
      Left            =   2640
      TabIndex        =   3
      Top             =   1680
      Visible         =   0   'False
      Width           =   90
   End
   Begin VB.Label Label1 
      Appearance      =   0  'Flat
      AutoSize        =   -1  'True
      BackColor       =   &H80000005&
      BackStyle       =   0  'Transparent
      Caption         =   "3"
      ForeColor       =   &H000000FF&
      Height          =   195
      Index           =   2
      Left            =   2760
      TabIndex        =   2
      Top             =   1440
      Visible         =   0   'False
      Width           =   90
   End
   Begin VB.Label Label1 
      Appearance      =   0  'Flat
      AutoSize        =   -1  'True
      BackColor       =   &H80000005&
      BackStyle       =   0  'Transparent
      Caption         =   "2"
      ForeColor       =   &H000000FF&
      Height          =   195
      Index           =   1
      Left            =   4680
      TabIndex        =   1
      Top             =   960
      Visible         =   0   'False
      Width           =   90
   End
   Begin VB.Label Label1 
      Appearance      =   0  'Flat
      AutoSize        =   -1  'True
      BackColor       =   &H80000005&
      BackStyle       =   0  'Transparent
      Caption         =   "1"
      ForeColor       =   &H000000FF&
      Height          =   195
      Index           =   0
      Left            =   5040
      TabIndex        =   0
      Top             =   960
      Visible         =   0   'False
      Width           =   90
   End
End
Attribute VB_Name = "Main_frm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Into(1 To 24) As Integer
Private BKP_Into(1 To 24) As Integer
Private Obj(1 To 24) As New Object_frm

Private Sub Blend_Cmd_Click()

  Dim I As Integer
  Dim X As Integer
    
    New_Cmd.Enabled = False
    
    If Blend_Cmd.Caption = "打乱" Then
        Blend_Cmd.Caption = "停止"
      Else
        Blend_Cmd.Caption = "打乱"
    End If

    Do While Blend_Cmd.Caption = "停止"
        DoEvents
        Do While Has_any_active
            DoEvents
        Loop
        X = Int(Rnd * 6) + 1
        Direction = 1
        If Int(Rnd * 2) = 1 Then
            Direction = -1
        End If
        Set_Trajectory X
        Set_Direction
        Make_Run
        Change_position X
    Loop
    
    New_Cmd.Enabled = True
    
End Sub

Private Sub Close_instr_Click()

    Instruction_Frame.Visible = False

End Sub

Private Sub Form_Load()

  Dim I As Integer

    Randomize

    For I = 101 To 104
        Board_Img(I - 101).Picture = LoadResPicture(I, 0)
    Next I

    Start

End Sub

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, y As Single)

  Dim I As Integer

    For I = 1 To 24
        If Obj(I).Active Then
            Exit Sub
        End If
    Next I

    If Button = 1 Then
        Direction = 1
      Else
        Direction = -1
    End If

    Select Case Mask.Point(X, y)
      Case 16711935 'PURPLE
        Set_Trajectory 1
        Set_Direction
        Make_Run
        Change_position 1
        Hits_Label = Val(Hits_Label) + 1
        If Assembly Then
            Show_Win_Message
            Exit Sub
        End If

      Case 16777024 'CYAN
        Set_Trajectory 2
        Set_Direction
        Make_Run
        Change_position 2
        Hits_Label = Val(Hits_Label) + 1
        If Assembly Then
            Show_Win_Message
            Exit Sub
        End If

      Case 16711680 'BLUE
        Set_Trajectory 3
        Set_Direction
        Make_Run
        Change_position 3
        Hits_Label = Val(Hits_Label) + 1
        If Assembly Then
            Show_Win_Message
            Exit Sub
        End If

      Case 65535 'YELLOW
        Set_Trajectory 4
        Set_Direction
        Make_Run
        Change_position 4
        Hits_Label = Val(Hits_Label) + 1
        If Assembly Then
            Show_Win_Message
            Exit Sub
        End If

      Case 255 'RED
        Set_Trajectory 5
        Set_Direction
        Make_Run
        Change_position 5
        Hits_Label = Val(Hits_Label) + 1
        If Assembly Then
            Show_Win_Message
            Exit Sub
        End If

      Case 65280 'GREEN
        Set_Trajectory 6
        Set_Direction
        Make_Run
        Change_position 6
        Hits_Label = Val(Hits_Label) + 1
        If Assembly Then
            Show_Win_Message
            Exit Sub
        End If
    End Select

End Sub

Private Sub Make_Run()

  Dim I As Integer

    For I = 1 To 24
        If Obj(I).Active Then
            Obj(I).Run
        End If
    Next I

    For I = 1 To 24
        If Obj(I).Active Then
            Make_Run
        End If
    Next I

End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, y As Single)

    MousePointer = 0
    Select Case Mask.Point(X, y)
      Case 16711935, 16777024, 16711680, 65535, 255, 65280
        MousePointer = 99
    End Select

End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)

  Dim I As Integer

    If Blend_Cmd.Caption = "停止" Then
        Blend_Cmd_Click
        Cancel = True
        Exit Sub
    End If

    For I = 1 To 24
        If Obj(I).Active Then
            Cancel = True
            Exit Sub
        End If
    Next I

    For I = 1 To 24
        Unload Obj(I)
    Next I

End Sub

Private Sub Board_Img_Click(Index As Integer)

    Picture = Board_Img(Index).Picture

End Sub

Private Sub Set_Trajectory(X As Integer)

  Dim I As Integer

    For I = 1 To 24
        If Obj(I).Active Then
            Exit Sub
        End If
    Next I

    Select Case X

      Case 1
        If Direction = 1 Then
            Obj(Into(1)).Read_Trajectory 1
            Obj(Into(7)).Read_Trajectory 2
            Obj(Into(5)).Read_Trajectory 3
            Obj(Into(3)).Read_Trajectory 4
            Obj(Into(2)).Read_Trajectory 5
            Obj(Into(8)).Read_Trajectory 6
            Obj(Into(6)).Read_Trajectory 7
            Obj(Into(4)).Read_Trajectory 8
          Else
            Obj(Into(1)).Read_Trajectory 4
            Obj(Into(7)).Read_Trajectory 1
            Obj(Into(5)).Read_Trajectory 2
            Obj(Into(3)).Read_Trajectory 3
            Obj(Into(2)).Read_Trajectory 8
            Obj(Into(8)).Read_Trajectory 5
            Obj(Into(6)).Read_Trajectory 6
            Obj(Into(4)).Read_Trajectory 7
        End If

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -