LoadPicture出错,大家来看看!
F_4_ 2004-11-21 05:14:44 我编了2个窗体,frmFile和frmPic
'=================frmfile================
......
Private Sub cmdOK_Click()
If File1.ListCount = 0 Then
i = 0
Else
i = 1
End If
frmPic.File1.Path = frmFile.File1.Path
frmPic.txt3.Text = "当前文件夹:" & Dir1.Path
frmPic.txt2.Text = "共 " & File1.ListCount & " 张," & "第 " & i & " 张"
Unload Me
End Sub
'设置
Private Sub Drive1_Change()
Dir1.Path = Drive1.Drive
End Sub
Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub
'=================frmPic======================
'加载图片
Private Sub File1_Click()
Dim i As Integer
i = File1.ListIndex + 1
txt2.Text = "共 " & File1.ListCount & " 张," & "第 " & i & " 张"
Pic.Picture = LoadPicture(frmFile.Dir1.Path & "\" & File1.List(File1.ListIndex))
'Pic.Picture = LoadPicture("")
End Sub
上面的这段程序在第一次加载的时候,能正确显示图片,如“d:\...\1.gif”
第二次加载的时候,显示错误,说什么“d:\...\2.gif”不能打开
而我第二次加载的明明是其他路径下的2.gif,也就是路径还是第一次的,怎么回事啊?
还有,FileListBox每次打开程序都显示当前路径下的图片,怎么让他第一次启动的时候,不显示呢?