我有一个 VB 6.0 应用程序,它在 imagelist 控件中包含一些图像。我想知道这些图像在系统中的存储位置。(因为我想在另一个应用程序中使用这些图像并且我没有在系统中单独保存图像)所以,唯一的方法是从 Visusal basic 6.0 项目中获取图像. 我们有类似.Net 的资源文件夹吗?
请尽快告诉我。
谢谢鲁帕
Microsoft Windows Common Controls 5.0 or 6.0
Form1
ImageList1
使用此代码
Dim lIdx As Long
For lIdx = 1 To ImageList1.ListImages.Count
SavePicture ImageList1.ListImages(lIdx).Picture, "C:\TEMP\img" & lIdx & ".bmp"
Next
前段时间我遇到了同样的问题。我最终用 imagelist 的形式编写了一个小函数,该函数“手动”将 imagelist 中的每个图像保存到磁盘。
' utility to save images from a VB6 imagelist - example ExtractVB6ImageListImages(ImageListModes,"ImageListModes")
Function ExtractVB6ImageListImages(myimagelist As ImageList, listname As String)
Dim nCount As Integer
Dim nIndex As Integer
Dim sKey As String
Dim temp As Image
nCount = myimagelist.ListImages.count()
For nIndex = 1 To nCount
If nIndex < 10 Then
SavePicture myimagelist.ListImages(nIndex).Picture, listname + "00" + Mid(Str(nIndex), 2) + ".bmp"
ElseIf nIndex < 100 Then
SavePicture myimagelist.ListImages(nIndex).Picture, listname + "0" + Mid(Str(nIndex), 2) + ".bmp"
Else
SavePicture myimagelist.ListImages(nIndex).Picture, listname + Mid(Str(nIndex), 2) + ".bmp"
End If
Next
End Function