Private Sub CmdBack_Click()
FrmRecall.Hide
FrmStore.Show
End Sub
Private Sub CmdGet_Click()
Call DisplayFile
End Sub
Private Sub DisplayFile()
Dim recordNum As Integer
Dim Question As QuestAns
Open "C:\Questions.txt" For Random As #1 Len = Len(Question)
PicResult2.Cls
For recordNum = 1 To LOF(1) / Len(Question)
Get #1, recordNum, Question
PicResult2.Print "Question "; recordNum
PicResult2.Print "==>"; Question.Question; Chr(13); Tab(7); Question.Ans1; Chr(13); Tab(7); Question.Ans2; Chr(13); Tab(7); Question.Ans3; Chr(13); Tab(7); Question.Ans4
Next recordNum
Close #1
End Sub
Private Sub Form_Load()
Call SetPicSize
End Sub
Sub SetPicSize()
' Ok, the way this works is you've got two pictureboxes, Picture1
' and picture2. Picture2 is inside of Picture1 and holds the
' picture that will be seen. First we check to see how big
' Picture2 is. If it's bigger then Picture1, then we'll have to
' use the scrollbars.
If PicResult2.ScaleWidth > PicResult1.ScaleWidth Then
HScroll1.Enabled = True
HScroll1.Max = PicResult2.ScaleWidth - PicResult1.ScaleWidth
HScroll1.LargeChange = Int(HScroll1.Max \ 25) + 1
HScroll1.SmallChange = Int(HScroll1.Max \ 200) + 1
Else
HScroll1.Enabled = False
End If
If PicResult2.ScaleHeight > PicResult1.ScaleHeight Then '
VScroll1.Enabled = True
VScroll1.Max = PicResult2.ScaleHeight - PicResult1.ScaleHeight
VScroll1.LargeChange = Int(VScroll1.Max \ 25) + 1
VScroll1.SmallChange = Int(VScroll1.Max \ 200) + 1
Else
VScroll1.Enabled = False
End If
End Sub
Private Sub HScroll1_Change()
' Change the width and position of Picture2
PicResult2.Width = PicResult2.Width + HScroll1.Value
PicResult2.Left = 0 - HScroll1.Value
End Sub
Private Sub VScroll1_Change()
' Change the height and position of Picture2
PicResult2.Height = PicResult2.Height + VScroll1.Value
PicResult2.Top = 0 - VScroll1.Value
End Sub