home *** CD-ROM | disk | FTP | other *** search
/ Dan Appleman's Visual Bas…s Guide to the Win32 API / Dan.Applmans.Visual.Basic.5.0.Programmers.Guide.To.The.Win32.API.1997.Ziff-Davis.Press.CD / VB5PG32.mdf / vbpg32 / samples4 / ch09 / puzzle2.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1997-02-16  |  3.5 KB  |  121 lines

  1. VERSION 4.00
  2. Begin VB.Form Puzzle2 
  3.    Caption         =   "Load Bitmap"
  4.    ClientHeight    =   2535
  5.    ClientLeft      =   1275
  6.    ClientTop       =   2085
  7.    ClientWidth     =   8085
  8.    BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  9.       Name            =   "MS Sans Serif"
  10.       Size            =   8.25
  11.       Charset         =   0
  12.       Weight          =   700
  13.       Underline       =   0   'False
  14.       Italic          =   0   'False
  15.       Strikethrough   =   0   'False
  16.    EndProperty
  17.    ForeColor       =   &H80000008&
  18.    Height          =   2940
  19.    Left            =   1215
  20.    LinkMode        =   1  'Source
  21.    LinkTopic       =   "Form1"
  22.    ScaleHeight     =   2535
  23.    ScaleWidth      =   8085
  24.    Top             =   1740
  25.    Width           =   8205
  26.    Begin VB.PictureBox picPreview 
  27.       Height          =   2295
  28.       Left            =   5400
  29.       ScaleHeight     =   2265
  30.       ScaleWidth      =   2565
  31.       TabIndex        =   5
  32.       Top             =   120
  33.       Width           =   2595
  34.    End
  35.    Begin VB.CommandButton CmdCancel 
  36.       Caption         =   "Cancel"
  37.       Height          =   375
  38.       Left            =   4140
  39.       TabIndex        =   4
  40.       Top             =   2040
  41.       Width           =   1095
  42.    End
  43.    Begin VB.CommandButton CmdLoad 
  44.       Caption         =   "Load"
  45.       Height          =   375
  46.       Left            =   2880
  47.       TabIndex        =   3
  48.       Top             =   2040
  49.       Width           =   1095
  50.    End
  51.    Begin VB.DirListBox Dir1 
  52.       Height          =   1815
  53.       Left            =   120
  54.       TabIndex        =   1
  55.       Top             =   600
  56.       Width           =   2535
  57.    End
  58.    Begin VB.FileListBox File1 
  59.       BackColor       =   &H00FFFFFF&
  60.       Height          =   1785
  61.       Left            =   2820
  62.       Pattern         =   "*.bmp"
  63.       TabIndex        =   2
  64.       Top             =   120
  65.       Width           =   2415
  66.    End
  67.    Begin VB.DriveListBox Drive1 
  68.       Height          =   315
  69.       Left            =   120
  70.       TabIndex        =   0
  71.       Top             =   120
  72.       Width           =   2535
  73.    End
  74. Attribute VB_Name = "Puzzle2"
  75. Attribute VB_Creatable = False
  76. Attribute VB_Exposed = False
  77. Option Explicit
  78. ' Copyright 
  79.  1997 by Desaware Inc. All Rights Reserved
  80. '   Hide the form and return control to the Puzzle form
  81. Private Sub CmdCancel_Click()
  82.     Puzzle2.Hide
  83. End Sub
  84. '   Load the selected file
  85. Private Sub CmdLoad_Click()
  86.     LoadBitmapFile
  87. End Sub
  88. Private Sub Dir1_Change()
  89.     File1.Path = Dir1.Path
  90. End Sub
  91. Private Sub Drive1_Change()
  92.     Dir1.Path = Drive1.Drive
  93. End Sub
  94. Private Sub File1_Click()
  95.     Dim fname$
  96.     Dim di&
  97.     If File1.filename <> "" Then
  98.         fname$ = File1.Path
  99.         If fname$ <> "\" Then fname$ = fname$ + "\"
  100.         fname$ = fname$ + File1.filename
  101.         picPreview.Picture = LoadPicture(fname$)
  102.     End If
  103. End Sub
  104. '   Load the selected file
  105. Private Sub File1_DblClick()
  106.     LoadBitmapFile
  107. End Sub
  108. '   Loads the bitmap file specified in the file box
  109. '   into bitmap 2 and reinitializes.
  110. Private Sub LoadBitmapFile()
  111.     Dim fname$
  112.     If File1.filename <> "" Then
  113.         fname$ = File1.Path
  114.         If fname$ <> "\" Then fname$ = fname$ + "\"
  115.         fname$ = fname$ + File1.filename
  116.         Puzzle.Picture2.Picture = LoadPicture(fname$)
  117.         DoTheUpdate% = -1
  118.     End If
  119.     Puzzle2.Hide    ' And exit this form
  120. End Sub
  121.