相信大家看到也有点烦,但帮帮小弟吧,我是自学的,没其它朋友可以问了帮帮忙吧,最好能详细及通俗点, 谢谢!!
Private Sub ShowAllPhotos() '在列表框lstAllPhotos中列出所有像册内照片名称并把对数组Photos赋值 Dim i As Integer '声明一个循环计数器 Dim MyPhotoCount As Integer '声明一个图片张数变量,为整数类型 PhotoFile = App.Path & "\Photos.ini" '读取ini文件的文件路径 If Len(Dir(PhotoFile)) = 0 Then '这里的Dir是什么意思? MsgBox "文件" & PhotoFile & "不存在!", vbExclamation, "错误提示" Else RecordLength = LenB(CurrentRecord) '计算每条记录的长度 FileNum = FreeFile 请问这里的FreeFile是什么?在程序中第一次出现,应该不是自定义变量 MyPhotoCount = 0 PhotoCount = 0
以下这些希望能帮忙注释谢谢!! '以下用 Open 语句打开文件 Open PhotoFile For Random As FileNum Len = RecordLength Do MyPhotoCount = MyPhotoCount + 1 ReDim Preserve Photos(1 To MyPhotoCount) As PhotoType Get FileNum, MyPhotoCount, CurrentRecord If CurrentRecord.PhotoNo = 1 Then PhotoCount = PhotoCount + 1 Photos(PhotoCount).PhotoNo = CurrentRecord.PhotoNo Photos(PhotoCount).FileName = Trim(CurrentRecord.FileName) Photos(PhotoCount).PhotoName = Trim(CurrentRecord.PhotoName) End If Loop Until Photos(MyPhotoCount).PhotoNo = 0 Close FileNum Me.lstAllPhotos.Clear For i = 1 To PhotoCount Me.lstAllPhotos.AddItem (Photos(i).PhotoName) Next i End If End Sub