home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 5_2007-2008.ISO / data / Zips / Puzzle_Gam2061654222007.psc / Form1.frm < prev    next >
Text File  |  2007-04-22  |  8KB  |  299 lines

  1. VERSION 5.00
  2. Begin VB.Form Form1 
  3.    AutoRedraw      =   -1  'True
  4.    Caption         =   "Waguih Puzzle"
  5.    ClientHeight    =   5760
  6.    ClientLeft      =   60
  7.    ClientTop       =   345
  8.    ClientWidth     =   7395
  9.    LinkTopic       =   "Form1"
  10.    ScaleHeight     =   384
  11.    ScaleMode       =   3  'Pixel
  12.    ScaleWidth      =   493
  13.    StartUpPosition =   3  'Windows Default
  14.    Begin VB.Frame Frame1 
  15.       BackColor       =   &H00C0C000&
  16.       Caption         =   "Options"
  17.       ForeColor       =   &H8000000E&
  18.       Height          =   1560
  19.       Left            =   5775
  20.       TabIndex        =   0
  21.       Top             =   315
  22.       Width           =   1395
  23.       Begin VB.CommandButton cmdSolve 
  24.          BackColor       =   &H8000000C&
  25.          Caption         =   "Solve"
  26.          Height          =   495
  27.          Left            =   150
  28.          Style           =   1  'Graphical
  29.          TabIndex        =   2
  30.          Top             =   330
  31.          Width           =   1080
  32.       End
  33.       Begin VB.CommandButton cmdScramble 
  34.          BackColor       =   &H8000000C&
  35.          Caption         =   "shuffle"
  36.          Height          =   495
  37.          Left            =   165
  38.          Style           =   1  'Graphical
  39.          TabIndex        =   1
  40.          Top             =   900
  41.          Width           =   1080
  42.       End
  43.    End
  44.    Begin VB.Timer Timer1 
  45.       Interval        =   10
  46.       Left            =   405
  47.       Top             =   4500
  48.    End
  49.    Begin VB.Label Label1 
  50.       BackStyle       =   0  'Transparent
  51.       Caption         =   "Click to Drag and Drop in the empty Square"
  52.       BeginProperty Font 
  53.          Name            =   "MS Sans Serif"
  54.          Size            =   12
  55.          Charset         =   178
  56.          Weight          =   700
  57.          Underline       =   0   'False
  58.          Italic          =   0   'False
  59.          Strikethrough   =   0   'False
  60.       EndProperty
  61.       ForeColor       =   &H00C00000&
  62.       Height          =   645
  63.       Left            =   390
  64.       TabIndex        =   3
  65.       Top             =   4470
  66.       Width           =   2775
  67.    End
  68.    Begin VB.Image Image1 
  69.       Height          =   1140
  70.       Left            =   3360
  71.       Stretch         =   -1  'True
  72.       Top             =   4530
  73.       Width           =   2400
  74.    End
  75.    Begin VB.Shape Shape1 
  76.       Height          =   3960
  77.       Left            =   360
  78.       Top             =   330
  79.       Width           =   5265
  80.    End
  81.    Begin VB.Image Pic 
  82.       Appearance      =   0  'Flat
  83.       BorderStyle     =   1  'Fixed Single
  84.       Height          =   1305
  85.       Index           =   11
  86.       Left            =   4275
  87.       Stretch         =   -1  'True
  88.       Top             =   2955
  89.       Width           =   1305
  90.    End
  91.    Begin VB.Image Pic 
  92.       Appearance      =   0  'Flat
  93.       BorderStyle     =   1  'Fixed Single
  94.       Height          =   1305
  95.       Index           =   10
  96.       Left            =   2985
  97.       Stretch         =   -1  'True
  98.       Top             =   2955
  99.       Width           =   1305
  100.    End
  101.    Begin VB.Image Pic 
  102.       Appearance      =   0  'Flat
  103.       BorderStyle     =   1  'Fixed Single
  104.       Height          =   1305
  105.       Index           =   9
  106.       Left            =   1695
  107.       Stretch         =   -1  'True
  108.       Top             =   2955
  109.       Width           =   1305
  110.    End
  111.    Begin VB.Image Pic 
  112.       Appearance      =   0  'Flat
  113.       BorderStyle     =   1  'Fixed Single
  114.       Height          =   1305
  115.       Index           =   8
  116.       Left            =   405
  117.       Stretch         =   -1  'True
  118.       Top             =   2955
  119.       Width           =   1305
  120.    End
  121.    Begin VB.Image Pic 
  122.       Appearance      =   0  'Flat
  123.       BorderStyle     =   1  'Fixed Single
  124.       Height          =   1305
  125.       Index           =   0
  126.       Left            =   405
  127.       Stretch         =   -1  'True
  128.       Top             =   375
  129.       Width           =   1305
  130.    End
  131.    Begin VB.Image Pic 
  132.       Appearance      =   0  'Flat
  133.       BorderStyle     =   1  'Fixed Single
  134.       Height          =   1305
  135.       Index           =   1
  136.       Left            =   1695
  137.       Stretch         =   -1  'True
  138.       Top             =   390
  139.       Width           =   1305
  140.    End
  141.    Begin VB.Image Pic 
  142.       Appearance      =   0  'Flat
  143.       BorderStyle     =   1  'Fixed Single
  144.       Height          =   1305
  145.       Index           =   2
  146.       Left            =   2985
  147.       Stretch         =   -1  'True
  148.       Top             =   390
  149.       Width           =   1305
  150.    End
  151.    Begin VB.Image Pic 
  152.       Appearance      =   0  'Flat
  153.       BorderStyle     =   1  'Fixed Single
  154.       Height          =   1305
  155.       Index           =   3
  156.       Left            =   4275
  157.       Stretch         =   -1  'True
  158.       Top             =   375
  159.       Width           =   1305
  160.    End
  161.    Begin VB.Image Pic 
  162.       Appearance      =   0  'Flat
  163.       BorderStyle     =   1  'Fixed Single
  164.       Height          =   1305
  165.       Index           =   7
  166.       Left            =   4275
  167.       Stretch         =   -1  'True
  168.       Top             =   1665
  169.       Width           =   1305
  170.    End
  171.    Begin VB.Image Pic 
  172.       Appearance      =   0  'Flat
  173.       BorderStyle     =   1  'Fixed Single
  174.       Height          =   1305
  175.       Index           =   6
  176.       Left            =   2985
  177.       Stretch         =   -1  'True
  178.       Top             =   1665
  179.       Width           =   1305
  180.    End
  181.    Begin VB.Image Pic 
  182.       Appearance      =   0  'Flat
  183.       BorderStyle     =   1  'Fixed Single
  184.       Height          =   1305
  185.       Index           =   5
  186.       Left            =   1695
  187.       Stretch         =   -1  'True
  188.       Top             =   1665
  189.       Width           =   1305
  190.    End
  191.    Begin VB.Image Pic 
  192.       Appearance      =   0  'Flat
  193.       BorderStyle     =   1  'Fixed Single
  194.       Height          =   1305
  195.       Index           =   4
  196.       Left            =   405
  197.       Stretch         =   -1  'True
  198.       Top             =   1665
  199.       Width           =   1305
  200.    End
  201. End
  202. Attribute VB_Name = "Form1"
  203. Attribute VB_GlobalNameSpace = False
  204. Attribute VB_Creatable = False
  205. Attribute VB_PredeclaredId = True
  206. Attribute VB_Exposed = False
  207. Dim F, M, Z, OldNumber(12), NewNumber
  208.  
  209. Private Sub cmdScramble_Click()
  210. Z = 1
  211. Dim i
  212. For i = 0 To 12
  213. OldNumber(i) = 0
  214. Next
  215. Timer1_Timer
  216. End Sub
  217.  
  218. Private Sub cmdSolve_Click()
  219. Dim i
  220. For i = 1 To 11
  221. Pic(i).Picture = LoadPicture(App.Path & "\Pic" & i + 1 & ".jpg")
  222. Next
  223. End Sub
  224.  
  225. Private Sub Form_Load()
  226. F = 0
  227. M = 0
  228. Z = 1
  229. Image1.Picture = LoadPicture(App.Path & "\fountain.jpg")
  230. Form1.Picture = LoadPicture(App.Path & "\marble.jpg")
  231. Form1.Icon = LoadPicture(App.Path & "\cube.ico")
  232.  
  233. End Sub
  234.  
  235. Private Sub Form_Activate()
  236. Dim i
  237. For i = 0 To 12
  238. OldNumber(i) = 0
  239. Next
  240.  
  241. '*****************
  242. Dim intX As Integer
  243.     Dim intY As Integer
  244.     Dim sngWidth As Single
  245.     Dim sngHeight As Single
  246.     
  247.     sngWidth = 65 'Form1.Picture.Width
  248.     sngHeight = 60 'Form1.Picture.Height
  249.     For intX = 0 To Int(Form1.ScaleWidth / sngWidth)
  250.         For intY = 0 To Int(Form1.ScaleHeight / sngHeight)
  251.             PaintPicture Form1.Picture, intX * sngWidth, intY * sngHeight, sngWidth, sngHeight, 0, 0
  252.         Next
  253.     Next
  254.  
  255.  
  256. End Sub
  257.  
  258. Private Sub Pic_DragDrop(Index As Integer, Source As Control, X As Single, Y As Single)
  259. M = Index
  260. If Pic(M).Picture = LoadPicture("") Then
  261. Pic(M).Picture = Pic(F).Picture
  262. Pic(F).Picture = LoadPicture("")
  263. M = 0
  264. F = 0
  265. End If
  266. End Sub
  267.  
  268. Private Sub Pic_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
  269. F = Index
  270. Pic(F).Drag vbBeginDrag
  271.  
  272. End Sub
  273.  
  274. Private Sub Timer1_Timer()
  275.  
  276. Do While Z < 12
  277.  
  278. NewNumber = Int(12 * Rnd + 1)
  279. 10:
  280. If NewNumber = OldNumber(1) Or NewNumber = OldNumber(2) _
  281. Or NewNumber = OldNumber(3) Or NewNumber = OldNumber(4) _
  282. Or NewNumber = OldNumber(5) Or NewNumber = OldNumber(6) _
  283. Or NewNumber = OldNumber(7) Or NewNumber = OldNumber(8) _
  284. Or NewNumber = OldNumber(9) Or NewNumber = OldNumber(10) _
  285. Or NewNumber = OldNumber(11) Or NewNumber = OldNumber(12) Then
  286. NewNumber = Int(12 * Rnd + 1)
  287. GoTo 10:
  288.  
  289. Else
  290. Pic(Z).Picture = LoadPicture(App.Path & "\Pic" & NewNumber & ".jpg")
  291. Z = Z + 1
  292.  
  293. End If
  294. OldNumber(Z) = NewNumber
  295. Loop
  296. End Sub
  297.  
  298.  
  299.