home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / bmp_db / bmp_db.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-05-08  |  4.8 KB  |  157 lines

  1. VERSION 2.00
  2. Begin Form BMP_DB 
  3.    BorderStyle     =   3  'Fixed Double
  4.    Caption         =   "Bitmap DataBase Demo"
  5.    ClientHeight    =   2055
  6.    ClientLeft      =   2550
  7.    ClientTop       =   2220
  8.    ClientWidth     =   3495
  9.    Height          =   2460
  10.    Icon            =   BMP_DB.FRX:0000
  11.    Left            =   2490
  12.    LinkTopic       =   "Form1"
  13.    MaxButton       =   0   'False
  14.    ScaleHeight     =   2055
  15.    ScaleWidth      =   3495
  16.    Top             =   1875
  17.    Width           =   3615
  18.    Begin PictureBox Picture1 
  19.       Height          =   975
  20.       Left            =   240
  21.       ScaleHeight     =   945
  22.       ScaleWidth      =   1065
  23.       TabIndex        =   6
  24.       Top             =   2160
  25.       Width           =   1095
  26.    End
  27.    Begin CommandButton Exit 
  28.       Cancel          =   -1  'True
  29.       Caption         =   "Exit"
  30.       Height          =   375
  31.       Left            =   1920
  32.       TabIndex        =   4
  33.       Top             =   1560
  34.       Width           =   1455
  35.    End
  36.    Begin CommandButton Load_DB 
  37.       Caption         =   "Load DB"
  38.       Height          =   375
  39.       Left            =   1920
  40.       TabIndex        =   5
  41.       Top             =   120
  42.       Width           =   1455
  43.    End
  44.    Begin CommandButton Add_Pic 
  45.       Caption         =   "Add..."
  46.       Default         =   -1  'True
  47.       Enabled         =   0   'False
  48.       Height          =   375
  49.       Left            =   1920
  50.       TabIndex        =   3
  51.       Top             =   840
  52.       Width           =   1455
  53.    End
  54.    Begin VScrollBar VScroll1 
  55.       Enabled         =   0   'False
  56.       Height          =   1815
  57.       Left            =   1560
  58.       Min             =   1
  59.       TabIndex        =   0
  60.       Top             =   120
  61.       Value           =   1
  62.       Width           =   255
  63.    End
  64.    Begin CommonDialog CMDialog1 
  65.       Left            =   2400
  66.       Top             =   1320
  67.    End
  68.    Begin Shape Shape1 
  69.       Height          =   1335
  70.       Left            =   120
  71.       Top             =   120
  72.       Width           =   1455
  73.    End
  74.    Begin Label Recnum 
  75.       BorderStyle     =   1  'Fixed Single
  76.       Caption         =   "Record# x of y"
  77.       Height          =   255
  78.       Left            =   120
  79.       TabIndex        =   2
  80.       Top             =   1680
  81.       Width           =   1455
  82.    End
  83.    Begin Label Pic_Caption 
  84.       BorderStyle     =   1  'Fixed Single
  85.       Caption         =   "Caption"
  86.       Height          =   255
  87.       Left            =   120
  88.       TabIndex        =   1
  89.       Top             =   1440
  90.       Width           =   1455
  91.    End
  92.    Begin Image Image1 
  93.       Height          =   1335
  94.       Left            =   120
  95.       Stretch         =   -1  'True
  96.       Top             =   120
  97.       Width           =   1455
  98.    End
  99. ' Declare Form Variables:
  100. Dim Data_file As String ' Declare File Name Variable
  101. Dim Num_of_Entries As Integer ' Number of Records in File.
  102. Sub Add_Pic_Click ()
  103. ' Set Dialog Options for Add File
  104. CMDialog1.DialogTitle = "Add File"
  105. CMDialog1.Filter = "All Files (*.*)|*.*|Graphic Files|*.BMP; *.RLE; *.DIB; *.WMF|Bitmaps (*.BMP)|*.BMP|Run-Length Encoding (*.RLE)|*.RLE|DIB (*.DIB)|*.DIB)|Windows Metafile (*.WMF)|*.WMF"
  106. CMDialog1.FilterIndex = 2
  107. CMDialog1.Filename = ""
  108. CMDialog1.Action = 1
  109. ' Check for Cancel
  110. If CMDialog1.Filename = "" Then Exit Sub
  111. ' Call PiCDB_Add File Routine
  112. P$ = CMDialog1.Filename
  113. PicDB_Add Data_file, P$, InputBox$("Enter Picture Title:", "Picture Title"), Picture1
  114. Num_of_Entries = Num_of_Entries + 1
  115. Recnum.Caption = "Record" + Str$(Vscroll1.Value) + " of" + Str$(Num_of_Entries)
  116. Vscroll1.Enabled = True
  117. Vscroll1.Max = Num_of_Entries
  118. 'Update Scroll Bar
  119. VScroll1_Change
  120. End Sub
  121. Sub Exit_Click ()
  122. ' Exit Program
  123. End Sub
  124. Sub Load_DB_Click ()
  125. ' Set Options for Open Dialogbox.
  126. CMDialog1.DialogTitle = "Load DataBase"
  127. CMDialog1.Filename = ""
  128. CMDialog1.Filter = "All Files (*.*)|*.*|Data Files (*.DAT)|*.DAT"
  129. CMDialog1.FilterIndex = 2
  130. ' Show Dialog
  131. CMDialog1.Action = 1
  132. ' Check for Cancel
  133. If CMDialog1.Filename = "" Then Exit Sub
  134. ' Enable File
  135. Data_file = CMDialog1.Filename
  136. Add_Pic.Enabled = True
  137. ' Check for Records
  138. Open Data_file For Binary As #1
  139. If LOF(1) = 0 Then Vscroll1.Enabled = False: Close #1: Exit Sub' If no data, disable Scroll Controll, Close File, and exit this sub
  140. Get #1, 1, Num_of_Entries
  141. 'After gettin # of entries, display data in Label and Scroll Bar.
  142. Recnum.Caption = "Record 1 of" + Str$(Num_of_Entries)
  143. Vscroll1.Max = Num_of_Entries
  144. Close #1
  145. Vscroll1.Enabled = True
  146. 'Update Scroll Box
  147. VScroll1_Change
  148. End Sub
  149. Sub VScroll1_Change ()
  150. 'Load Picture and Caption
  151. L% = Vscroll1.Value
  152. PICDB_Load Data_file, L%, P$, Me.Picture1
  153. Image1.Picture = Picture1.Picture
  154. Pic_Caption.Caption = P$
  155. Recnum.Caption = "Record" + Str$(Vscroll1.Value) + " of" + Str$(Vscroll1.Max)
  156. End Sub
  157.