2

我有一个 VB 6.0 应用程序,它在 imagelist 控件中包含一些图像。我想知道这些图像在系统中的存储位置。(因为我想在另一个应用程序中使用这些图像并且我没有在系统中单独保存图像)所以,唯一的方法是从 Visusal basic 6.0 项目中获取图像. 我们有类似.Net 的资源文件夹吗?

请尽快告诉我。

谢谢鲁帕

4

3 回答 3

6
  • 启动一个空项目。
  • 将引用 (Ctrl+T) 添加到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
于 2010-11-01T14:55:27.320 回答
1

前段时间我遇到了同样的问题。我最终用 imagelist 的形式编写了一个小函数,该函数“手动”将 imagelist 中的每个图像保存到磁盘。

于 2010-10-31T17:42:40.687 回答
0
' 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
于 2012-01-31T19:39:56.947 回答