如何在VB6.0中恢复imagelist控件上传的图像
我有一个VB6.0应用程序,它在imagelist控件中包含一些图像。我想知道这些图像在系统中的存储位置。(因为我想在另一个应用程序中使用这些图像,而系统中没有单独的图像) 所以,唯一的方法就是从Visusal basic 6.0项目中获取图像。 我们有类似于.Net的资源文件夹吗 请尽快告诉我 谢谢如何在VB6.0中恢复imagelist控件上传的图像,vb6,controls,imagelist,Vb6,Controls,Imagelist,我有一个VB6.0应用程序,它在imagelist控件中包含一些图像。我想知道这些图像在系统中的存储位置。(因为我想在另一个应用程序中使用这些图像,而系统中没有单独的图像) 所以,唯一的方法就是从Visusal basic 6.0项目中获取图像。 我们有类似于.Net的资源文件夹吗 请尽快告诉我 谢谢 鲁帕不久前我遇到了同样的问题。最后,我用imagelist在表单中编写了一个小函数,“手动”将imagelist中的每个图像保存到磁盘。 启动一个空项目 向Microsoft Windows通用控
鲁帕不久前我遇到了同样的问题。最后,我用imagelist在表单中编写了一个小函数,“手动”将imagelist中的每个图像保存到磁盘。
- 启动一个空项目李>
- 向Microsoft Windows通用控件5.0或6.0添加引用(Ctrl+T)
- 将图像列表控件复制/粘贴到
Form1
- 将图像列表控件重命名为
ImageList1
Dim lIdx As Long
For lIdx = 1 To ImageList1.ListImages.Count
SavePicture ImageList1.ListImages(lIdx).Picture, "C:\TEMP\img" & lIdx & ".bmp"
Next
从VB6 imagelist保存图像的实用程序-示例ExtractVB6ImageListImages(ImageListModes,“ImageListModes”)
函数ExtractVB6ImageListImages(myimagelist作为ImageList,listname作为字符串)
Dim nCount为整数
作为整数的Dim nIndex
像线一样模糊
将温度变暗为图像
nCount=myimagelist.ListImages.count()
对于nIndex=1的情况,要计算
如果nIndex<10,则
保存图片myimagelist.ListImages(nIndex).Picture,listname++“00”+Mid(Str(nIndex),2)+“.bmp”
ElseIf nIndex<100则
保存图片myimagelist.ListImages(nIndex).Picture,listname+“0”+Mid(Str(nIndex),2)+“.bmp”
其他的
保存图片myimagelist.ListImages(nIndex).Picture,listname+Mid(Str(nIndex),2)+“.bmp”
如果结束
下一个
端函数
+1您可以将此代码临时粘贴到实际项目中。你甚至可以从即时窗口运行它。这与一年前发布的公认答案几乎相同
' 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